Skip to content

Commit

Permalink
Fix finding batching in SameNameButDifferent
Browse files Browse the repository at this point in the history
Follow-up to a87b281. The batching mode was only breaking out of an inner loop 🤦

PiperOrigin-RevId: 564407277
  • Loading branch information
cushon authored and Error Prone Team committed Sep 11, 2023
1 parent 593f1f1 commit 5e9ae5e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,16 @@ private void handle(Tree tree) {
.map(t -> t.getQualifiedName().toString())
.collect(joining(", ", "[", "]")));
SuggestedFix fix = fixBuilder.build();
for (List<TreePath> treePaths : trimmedTable.row(simpleName).values()) {
for (TreePath treePath : treePaths) {
state.reportMatch(
buildDescription(treePath.getLeaf()).setMessage(message).addFix(fix).build());
if (batchFindings) {
break;
}
}
}
trimmedTable.row(simpleName).values().stream()
.flatMap(List::stream)
.limit(batchFindings ? 1 : Long.MAX_VALUE)
.forEach(
treePath ->
state.reportMatch(
buildDescription(treePath.getLeaf())
.setMessage(message)
.addFix(fix)
.build()));
}
}
return NO_MATCH;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ public void ungroupedOverloadsPositiveCasesCoveringOnlyFirstOverload() {
" }",
" class Two {",
" class Clash {}",
" // BUG: Diagnostic contains:",
" Clash a;",
" Clash b;",
" }",
Expand Down

0 comments on commit 5e9ae5e

Please sign in to comment.