From af624dc694f9ca989a2d01d6625d9377d8711d4d Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Mon, 12 Aug 2024 06:05:16 +0200 Subject: [PATCH] Resolve some SonarCloud complaints --- .../tech/picnic/errorprone/refasterrules/OptionalRules.java | 2 +- .../errorprone/refaster/matchers/RequiresComputation.java | 6 +----- 2 files changed, 2 insertions(+), 6 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 274a85d2b73..e053959b5a9 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 @@ -373,7 +373,7 @@ static final class OptionalOrOtherOptional { @SuppressWarnings({ "LexicographicalAnnotationAttributeListing" /* `key-*` entry must remain last. */, "NestedOptionals" /* This violation will be rewritten. */, - "OptionalOrElse" /* Here `optional2` is a stand-in for expressions that may require computation. */, + "OptionalOrElse" /* Parameters represent expressions that may require computation. */, "key-to-resolve-AnnotationUseStyle-and-TrailingComment-check-conflict" }) Optional before(Optional optional1, Optional optional2) { diff --git a/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/RequiresComputation.java b/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/RequiresComputation.java index e662c728514..f4a7e0777c2 100644 --- a/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/RequiresComputation.java +++ b/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/RequiresComputation.java @@ -74,10 +74,6 @@ private static boolean matches(ExpressionTree expressionTree) { return matches(unary.getExpression()); } - if (ASTHelpers.constValue(expressionTree) != null) { - return false; - } - - return true; + return ASTHelpers.constValue(expressionTree) == null; } }