diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/LexicographicalAnnotationAttributeListing.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/LexicographicalAnnotationAttributeListing.java index 7107ad8365..4d0fcfbaac 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/LexicographicalAnnotationAttributeListing.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/LexicographicalAnnotationAttributeListing.java @@ -220,7 +220,10 @@ private static ImmutableList> getStructure(ExpressionTree private static AnnotationAttributeMatcher createAnnotationAttributeMatcher( ErrorProneFlags flags) { return AnnotationAttributeMatcher.create( - flags.getList(INCLUDED_ANNOTATIONS_FLAG), excludedAnnotations(flags)); + flags.get(INCLUDED_ANNOTATIONS_FLAG).isPresent() + ? Optional.of(flags.getListOrEmpty(INCLUDED_ANNOTATIONS_FLAG)) + : Optional.empty(), + excludedAnnotations(flags)); } private static ImmutableList excludedAnnotations(ErrorProneFlags flags) { diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/util/Flags.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/util/Flags.java index ec5f4e92b3..349a003bef 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/util/Flags.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/util/Flags.java @@ -16,10 +16,7 @@ private Flags() {} * provided, or if the flag's value is the empty string. */ public static ImmutableList getList(ErrorProneFlags errorProneFlags, String name) { - return errorProneFlags - .getList(name) - .map(ImmutableList::copyOf) - .filter(flags -> !flags.equals(ImmutableList.of(""))) - .orElseGet(ImmutableList::of); + ImmutableList list = errorProneFlags.getListOrEmpty(name); + return list.equals(ImmutableList.of("")) ? ImmutableList.of() : list; } } diff --git a/pom.xml b/pom.xml index 584235bd0f..6d7a8f0738 100644 --- a/pom.xml +++ b/pom.xml @@ -201,7 +201,7 @@ 1.10.4 ${version.error-prone-orig} v${version.error-prone-orig}-picnic-1 - 2.21.1 + 2.22.0 0.1.20 1.0 11 @@ -1739,8 +1739,6 @@ false-positives. -XepOpt:CheckReturnValue:CheckAllMethods=true --> -XepOpt:InlineMe:SkipInliningsWithComments=false - -XepOpt:NamedLikeContextualKeyword:EnableClassNames=true - -XepOpt:NamedLikeContextualKeyword:EnableMethodNames=true -XepOpt:NullAway:AnnotatedPackages=tech.picnic -XepOpt:NullAway:AssertsEnabled=true -XepOpt:NullAway:CheckOptionalEmptiness=true diff --git a/refaster-test-support/src/main/java/tech/picnic/errorprone/refaster/test/RefasterRuleCollection.java b/refaster-test-support/src/main/java/tech/picnic/errorprone/refaster/test/RefasterRuleCollection.java index 4d68be3781..e784140407 100644 --- a/refaster-test-support/src/main/java/tech/picnic/errorprone/refaster/test/RefasterRuleCollection.java +++ b/refaster-test-support/src/main/java/tech/picnic/errorprone/refaster/test/RefasterRuleCollection.java @@ -42,7 +42,6 @@ import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.Set; import java.util.regex.Pattern; import javax.inject.Inject; import org.jspecify.annotations.Nullable; @@ -180,7 +179,7 @@ private static ImmutableRangeMap indexRuleMatches( for (Description description : matches) { String ruleName = extractRefasterRuleName(description); - Set replacements = + ImmutableSet replacements = Iterables.getOnlyElement(description.fixes).getReplacements(endPositions); for (Replacement replacement : replacements) { ruleMatches.put(replacement.range(), ruleName);