diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StaticImportCheck.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StaticImportCheck.java index 9c9abe5a0ee..cc73da727b6 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StaticImportCheck.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StaticImportCheck.java @@ -2,6 +2,7 @@ import static com.sun.source.tree.Tree.Kind.MEMBER_SELECT; import static com.sun.source.tree.Tree.Kind.METHOD_INVOCATION; +import static com.sun.source.tree.Tree.Kind.PACKAGE; import static java.util.Objects.requireNonNull; import com.google.auto.service.AutoService; @@ -184,7 +185,8 @@ private static boolean isCandidate(VisitorState state) { private static boolean isExempted(VisitorState state) { Tree currentTree = state.getPath().getLeaf(); Tree parentTree = state.getPath().getParentPath().getLeaf(); - if (currentTree.getKind() != MEMBER_SELECT && parentTree.getKind() != METHOD_INVOCATION) { + if ((currentTree.getKind() != MEMBER_SELECT && parentTree.getKind() != METHOD_INVOCATION) + || parentTree.getKind() == PACKAGE) { return false; }