From ff71c21f9f0957c42da55e3b9144733a649eb974 Mon Sep 17 00:00:00 2001 From: mlrprananta Date: Fri, 7 Apr 2023 09:59:36 +0200 Subject: [PATCH] Suggestions --- .../tech/picnic/errorprone/refasterrules/OptionalRules.java | 3 ++- .../matchers/IsMethodInvocationWithTwoOrMoreArgsTest.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/OptionalRules.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/OptionalRules.java index 130880a5a89..51b9eaf0e78 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/OptionalRules.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/OptionalRules.java @@ -225,8 +225,9 @@ T after(Optional o1, Optional o2) { /** * Prefer {@link Optional#orElseGet(Supplier)} over {@link Optional#orElse(Object)} if the given - * value is not a compile-time constant. + * value is a method invocation with two or more arguments. */ + // XXX: Extend rule to all method invocations (with less than 2 arguments). static final class OrElseToOrElseGet { @BeforeTemplate T before(Optional o, @Matches(IsMethodInvocationWithTwoOrMoreArgs.class) T value) { diff --git a/refaster-support/src/test/java/tech/picnic/errorprone/refaster/matchers/IsMethodInvocationWithTwoOrMoreArgsTest.java b/refaster-support/src/test/java/tech/picnic/errorprone/refaster/matchers/IsMethodInvocationWithTwoOrMoreArgsTest.java index 2831e490a7e..ba5b1e0b111 100644 --- a/refaster-support/src/test/java/tech/picnic/errorprone/refaster/matchers/IsMethodInvocationWithTwoOrMoreArgsTest.java +++ b/refaster-support/src/test/java/tech/picnic/errorprone/refaster/matchers/IsMethodInvocationWithTwoOrMoreArgsTest.java @@ -56,7 +56,7 @@ IsMethodInvocationWithTwoOrMoreArgsTest.MatcherTestChecker.class, getClass()) .doTest(); } - /** A {@link BugChecker} that simply delegates to {@link IsCharacter}. */ + /** A {@link BugChecker} that simply delegates to {@link IsMethodInvocationWithTwoOrMoreArgs}. */ @BugPattern( summary = "Flags expressions matched by `IsMethodInvocationWithTwoOrMoreArgs`", severity = ERROR)