Skip to content

Commit

Permalink
Wrangle MixedArrayDimensions to be an error internally, but not ext…
Browse files Browse the repository at this point in the history
…ernally.

I added the third_party exemption proactively, and had to hardcode _one last annoying exemption_.

PiperOrigin-RevId: 621130845
  • Loading branch information
graememorgan authored and Error Prone Team committed Apr 2, 2024
1 parent 48ec7d9 commit 474a4ac
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -74,9 +74,11 @@ private Description checkArrayDimensions(Tree tree, Tree type, VisitorState stat
int idx = dim.indexOf("[]", nonWhitespace);
if (idx > nonWhitespace) {
String replacement = dim.substring(idx) + dim.substring(0, idx);
// SimpleCharStream generates violations in other packages, and is challenging to fix.
// javacc generates classes in arbitrary packages with violations that are hard to fix.
var enclosingClass = enclosingClass(getSymbol(tree));
if (enclosingClass != null && enclosingClass.name.contentEquals("SimpleCharStream")) {
if (enclosingClass != null
&& (enclosingClass.name.contentEquals("SimpleCharStream")
|| enclosingClass.name.contentEquals("SimpleNode"))) {
return NO_MATCH;
}
return describeMatch(tree, SuggestedFix.replace(start, end, replacement));
Expand Down

0 comments on commit 474a4ac

Please sign in to comment.