diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/IdentityConversion.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/IdentityConversion.java index 35785f50f9f..a8f6bce2d6b 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/IdentityConversion.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/IdentityConversion.java @@ -59,6 +59,9 @@ public final class IdentityConversion extends BugChecker implements MethodInvoca "com.google.common.collect.ImmutableSetMultimap", "com.google.common.collect.ImmutableTable") .named("copyOf"), + staticMethod() + .onClass("com.google.errorprone.matchers.Matchers") + .namedAnyOf("allOf", "anyOf"), staticMethod() .onClassAny( Primitives.allWrapperTypes().stream() @@ -70,10 +73,7 @@ public final class IdentityConversion extends BugChecker implements MethodInvoca staticMethod() .onClass("reactor.core.publisher.Flux") .namedAnyOf("concat", "firstWithSignal", "from", "merge"), - staticMethod().onClass("reactor.core.publisher.Mono").namedAnyOf("from", "fromDirect"), - staticMethod() - .onClass("com.google.errorprone.matchers.Matchers") - .namedAnyOf("allOf", "anyOf")); + staticMethod().onClass("reactor.core.publisher.Mono").namedAnyOf("from", "fromDirect")); /** Instantiates a new {@link IdentityConversion} instance. */ public IdentityConversion() {} diff --git a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/IdentityConversionTest.java b/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/IdentityConversionTest.java index 3420d3e81a9..c1f5345a758 100644 --- a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/IdentityConversionTest.java +++ b/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/IdentityConversionTest.java @@ -165,9 +165,9 @@ void identification() { " Mono m2 = Mono.fromDirect(Mono.just(1));", "", " // BUG: Diagnostic contains:", - " Matcher allOfMatcher = Matchers.allOf(annotations(AT_LEAST_ONE, isType(\"foo\")));", + " Matcher matcher1 = Matchers.allOf(annotations(AT_LEAST_ONE, isType(\"foo\")));", " // BUG: Diagnostic contains:", - " Matcher anyOfMatcher = Matchers.anyOf(annotations(AT_LEAST_ONE, isType(\"foo\")));", + " Matcher matcher2 = Matchers.anyOf(annotations(AT_LEAST_ONE, isType(\"bar\")));", " }", "}") .doTest();