Skip to content

Commit

Permalink
Add a regression test for b/369862572
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 679268486
  • Loading branch information
cushon authored and Error Prone Team committed Sep 27, 2024
1 parent 2b78c1f commit db107d9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ public Description matchClass(ClassTree tree, VisitorState state) {
ClassSymbol symbol = getSymbol(tree);
String name = tree.getSimpleName().toString();
if (name.isEmpty() || isConformantUpperCamelName(name)) {
// name.isEmpty() should not happen normally but could if there are errors.
// The name can be empty for enum member declarations, which are desugared early to class
// declarations.
return NO_MATCH;
}
String renamed = suggestedClassRename(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -622,4 +622,17 @@ public void className_underscore() {
"}")
.doTest();
}

@Test
public void enumName() {
helper
.addSourceLines(
"Test.java", //
"enum Test {",
" ONE {",
" void f() {}",
" }",
"}")
.doTest();
}
}

0 comments on commit db107d9

Please sign in to comment.