Skip to content

Commit

Permalink
Break loops when result can no longer change (uber#728)
Browse files Browse the repository at this point in the history
(Code cleanup/optimization)
  • Loading branch information
XN137 committed Feb 7, 2023
1 parent de6e014 commit a2efa6e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ public NullnessStore getNullnessInfoBeforeNewContext(
if (!e.getKind().equals(ElementKind.FIELD)
|| !e.getModifiers().contains(Modifier.FINAL)) {
allAPNonRootElementsAreFinalFields = false;
break;
}
}
if (allAPNonRootElementsAreFinalFields) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ public NullnessHint onDataflowVisitMethodInvocation(
for (int idx : nullImpliesNullIndexes) {
if (!inputs.valueOfSubNode(node.getArgument(idx)).equals(NONNULL)) {
anyNull = true;
break;
}
}
return anyNull ? NullnessHint.HINT_NULLABLE : NullnessHint.FORCE_NONNULL;
Expand Down

0 comments on commit a2efa6e

Please sign in to comment.