@@ -49,24 +49,17 @@ public Description matchCompilationUnit(CompilationUnitTree tree, VisitorState s
4949 List <String > names = new ArrayList <>();
5050 for (Tree member : tree .getTypeDecls ()) {
5151 if (member instanceof ClassTree classMember ) {
52- switch (classMember .getKind ()) {
53- case CLASS , INTERFACE , ANNOTATION_TYPE , ENUM -> {
54- if (isSuppressed (classMember , state )) {
55- // If any top-level classes have @SuppressWarnings("TopLevel"), ignore
56- // this compilation unit. We can't rely on the normal suppression
57- // mechanism because the only enclosing element is the package declaration,
58- // and @SuppressWarnings can't be applied to packages.
59- return NO_MATCH ;
60- }
61- names .add (classMember .getSimpleName ().toString ());
62- }
63- default -> {}
52+ if (isSuppressed (classMember , state )) {
53+ // If any top-level classes have @SuppressWarnings("TopLevel"), ignore
54+ // this compilation unit. We can't rely on the normal suppression
55+ // mechanism because the only enclosing element is the package declaration,
56+ // and @SuppressWarnings can't be applied to packages.
57+ return NO_MATCH ;
6458 }
59+ names .add (classMember .getSimpleName ().toString ());
6560 }
6661 }
6762 if (names .size () <= 1 ) {
68- // this can happen with multiple type declarations if some of them are
69- // empty (e.g. ";" at the top level counts as an empty type decl)
7063 return NO_MATCH ;
7164 }
7265 String message =
0 commit comments