From 69d9d62fe3dc291670720ee35cb63026038e9de4 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 274a85d2b7..e053959b5a 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 e662c72851..f4a7e0777c 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; } }