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 25, 2022
1 parent 4ec3581 commit 2245e12
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 2245e12

Please sign in to comment.