Skip to content

Commit

Permalink
Change stream to foreach loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Niels de Bruin committed Oct 3, 2024
1 parent 6c21164 commit 771e21d
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ public J.Try visitTry(J.Try tryable, ExecutionContext ctx) {
private boolean hasWiderExceptionType(J.Try.Catch aCatch, J.Try.Catch next) {
if (next.getParameter().getType() instanceof JavaType.MultiCatch) {
JavaType.MultiCatch multiCatch = (JavaType.MultiCatch) next.getParameter().getType();
return multiCatch.getThrowableTypes().stream().anyMatch(alt -> TypeUtils.isAssignableTo(alt, aCatch.getParameter().getType()));
for (JavaType throwableType : multiCatch.getThrowableTypes()) {
if (TypeUtils.isAssignableTo(throwableType, aCatch.getParameter().getType())) {
return true;
}
}
return false;
}
return TypeUtils.isAssignableTo(next.getParameter().getType(), aCatch.getParameter().getType());
}
Expand Down

0 comments on commit 771e21d

Please sign in to comment.