Skip to content

Commit

Permalink
fixup! extend Onion Architecture to allow defining components by pred…
Browse files Browse the repository at this point in the history
…icate

Avoid assigning variables within while check

Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
  • Loading branch information
codecholeric committed Jun 26, 2022
1 parent ea76103 commit f86eb90
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2510,11 +2510,12 @@ private static class BelongToPredicate extends DescribedPredicate<JavaClass> {
@Override
public boolean test(JavaClass input) {
JavaClass toTest = input;
boolean result;
while (!(result = predicate.test(toTest)) && toTest.getEnclosingClass().isPresent()) {
boolean matches = predicate.test(toTest);
while (!matches && toTest.getEnclosingClass().isPresent()) {
toTest = toTest.getEnclosingClass().get();
matches = predicate.test(toTest);
}
return result;
return matches;
}
}

Expand Down

0 comments on commit f86eb90

Please sign in to comment.