From f88cf68d1cfcd636b7bc5c3e495d51a9d6f383fc Mon Sep 17 00:00:00 2001 From: Rick Ossendrijver Date: Thu, 31 Aug 2023 14:52:12 +0200 Subject: [PATCH] Suggestions --- .../tech/picnic/errorprone/refasterrules/OptionalRules.java | 4 ++-- .../errorprone/refasterrules/OptionalRulesTestInput.java | 2 +- .../errorprone/refasterrules/OptionalRulesTestOutput.java | 2 +- 3 files changed, 4 insertions(+), 4 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 95ad4ca5d45..a8eb97b4529 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 @@ -101,7 +101,7 @@ Function, T> after() { } /** Prefer {@link Optional#equals(Object)} over more contrived alternatives. */ - static final class OptionalHasValue { + static final class OptionalEqualsOptional { @BeforeTemplate boolean before(Optional optional, S value) { return Refaster.anyOf( @@ -454,5 +454,5 @@ Stream after(Optional optional) { // XXX: Add a rule for: // `optional.flatMap(x -> pred(x) ? Optional.empty() : Optional.of(x))` and variants. - // (Maybe canonicalize the inner expression. Maybe we rewrite already.) + // (Maybe canonicalize the inner expression. Maybe we rewrite it already.) } diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/OptionalRulesTestInput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/OptionalRulesTestInput.java index 841a1834211..c09719bea5d 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/OptionalRulesTestInput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/OptionalRulesTestInput.java @@ -35,7 +35,7 @@ Function, Integer> testOptionalOrElseThrowMethodReference() { return Optional::get; } - ImmutableSet testOptionalHasValue() { + ImmutableSet testOptionalEqualsOptional() { return ImmutableSet.of( Optional.of("foo").filter("bar"::equals).isPresent(), Optional.of("baz").stream().anyMatch("qux"::equals)); diff --git a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/OptionalRulesTestOutput.java b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/OptionalRulesTestOutput.java index cb3d9c194ef..88815292474 100644 --- a/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/OptionalRulesTestOutput.java +++ b/error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/OptionalRulesTestOutput.java @@ -35,7 +35,7 @@ Function, Integer> testOptionalOrElseThrowMethodReference() { return Optional::orElseThrow; } - ImmutableSet testOptionalHasValue() { + ImmutableSet testOptionalEqualsOptional() { return ImmutableSet.of( Optional.of("foo").equals(Optional.of("bar")), Optional.of("baz").equals(Optional.of("qux")));