diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ExplicitEnumOrdering.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ExplicitEnumOrdering.java index 37fb7d6086..1320503146 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ExplicitEnumOrdering.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ExplicitEnumOrdering.java @@ -72,7 +72,7 @@ private static ImmutableSet getMissingEnumValues( List expressions) { return expressions.stream() .map(ASTHelpers::getSymbol) - .filter(Symbol::isEnum) + .filter(s -> s != null && s.isEnum()) .collect( collectingAndThen( toImmutableSetMultimap(Symbol::asType, Symbol::toString), diff --git a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/ExplicitEnumOrderingTest.java b/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/ExplicitEnumOrderingTest.java index 7afdf30ac3..02f770ff94 100644 --- a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/ExplicitEnumOrderingTest.java +++ b/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/ExplicitEnumOrderingTest.java @@ -75,6 +75,8 @@ void identification() { " Ordering.explicit(IsoEra.BCE, SOURCE, RetentionPolicy.CLASS);", " // BUG: Diagnostic contains: RetentionPolicy.SOURCE, IsoEra.BCE", " Ordering.explicit(CLASS, RUNTIME, CE);", + "", + " Ordering.explicit(BCE, null, CE);", " }", "}") .doTest();