From 59212f0bd641e8c33ad7a5a995170d4949b694ef Mon Sep 17 00:00:00 2001 From: Rick Ossendrijver Date: Mon, 19 Dec 2022 17:27:14 +0100 Subject: [PATCH] Suggestionsg --- .../picnic/errorprone/bugpatterns/IdentityConversion.java | 8 ++++---- .../errorprone/bugpatterns/IdentityConversionTest.java | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) 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();