From 71c189f2caf55e7270314507547ee8813a359cb5 Mon Sep 17 00:00:00 2001 From: Picnic-Bot Date: Fri, 22 Sep 2023 01:07:08 +0000 Subject: [PATCH 1/3] Upgrade version.error-prone-orig 2.21.1 -> 2.22.0 See: - https://github.com/google/error-prone/releases/tag/v2.22.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 584235bd0f..4280ace3d4 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 From 5e46612f9000c6680c813a24832adeff1586e849 Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Fri, 22 Sep 2023 09:07:41 +0200 Subject: [PATCH 2/3] Fix build --- .../LexicographicalAnnotationAttributeListing.java | 5 ++++- .../tech/picnic/errorprone/bugpatterns/util/Flags.java | 7 ++----- .../errorprone/refaster/test/RefasterRuleCollection.java | 3 +-- 3 files changed, 7 insertions(+), 8 deletions(-) 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/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); From ac6cbbcb20971f752f0b46350d94027bd328f6d9 Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Fri, 22 Sep 2023 11:47:53 +0200 Subject: [PATCH 3/3] Drop obsolete flags --- pom.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pom.xml b/pom.xml index 4280ace3d4..6d7a8f0738 100644 --- a/pom.xml +++ b/pom.xml @@ -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