From 82025a729fcaa414f3d5c4ba2220f739abe36cc7 Mon Sep 17 00:00:00 2001 From: Picnic-Bot Date: Wed, 4 Oct 2023 10:29:27 +0200 Subject: [PATCH] Upgrade fmt-maven-plugin 2.20 -> 2.21.1 (#804) See: - https://github.com/spotify/fmt-maven-plugin/releases/tag/2.21 - https://github.com/spotify/fmt-maven-plugin/releases/tag/2.21.1 - https://github.com/spotify/fmt-maven-plugin/compare/fmt-maven-plugin-2.20...2.21.1 --- .../errorprone/bugpatterns/FormatStringConcatenation.java | 2 ++ .../LexicographicalAnnotationAttributeListing.java | 1 + .../bugpatterns/LexicographicalAnnotationListing.java | 1 + .../picnic/errorprone/bugpatterns/util/JavaKeywords.java | 3 +++ .../errorprone/bugpatterns/util/MethodMatcherFactory.java | 1 + .../errorprone/bugpatterns/util/MoreJUnitMatchers.java | 2 ++ .../tech/picnic/errorprone/refasterrules/AssortedRules.java | 3 +-- .../java/tech/picnic/errorprone/refasterrules/MapRules.java | 6 ++---- .../tech/picnic/errorprone/refasterrules/MultimapRules.java | 3 +-- pom.xml | 2 +- .../errorprone/refaster/annotation/OnlineDocumentation.java | 1 + 11 files changed, 16 insertions(+), 9 deletions(-) diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/FormatStringConcatenation.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/FormatStringConcatenation.java index 4c8f1fdd4a..7ea1f65d45 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/FormatStringConcatenation.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/FormatStringConcatenation.java @@ -59,6 +59,7 @@ public final class FormatStringConcatenation extends BugChecker implements MethodInvocationTreeMatcher { private static final long serialVersionUID = 1L; + /** * AssertJ exposes varargs {@code fail} methods with a {@link Throwable}-accepting overload, the * latter of which should not be flagged. @@ -68,6 +69,7 @@ public final class FormatStringConcatenation extends BugChecker .anyClass() .withAnyName() .withParameters(String.class.getName(), Throwable.class.getName()); + // XXX: Drop some of these methods if we use Refaster to replace some with others. private static final Matcher ASSERTJ_FORMAT_METHOD = anyOf( 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 ad46c26541..7107ad8365 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 @@ -76,6 +76,7 @@ public final class LexicographicalAnnotationAttributeListing extends BugChecker private static final String FLAG_PREFIX = "LexicographicalAnnotationAttributeListing:"; private static final String INCLUDED_ANNOTATIONS_FLAG = FLAG_PREFIX + "Includes"; private static final String EXCLUDED_ANNOTATIONS_FLAG = FLAG_PREFIX + "Excludes"; + /** * The splitter applied to string-typed annotation arguments prior to lexicographical sorting. By * splitting on {@code =}, strings that represent e.g. inline Spring property declarations are diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/LexicographicalAnnotationListing.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/LexicographicalAnnotationListing.java index 2f026938ea..694cf41cb8 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/LexicographicalAnnotationListing.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/LexicographicalAnnotationListing.java @@ -46,6 +46,7 @@ public final class LexicographicalAnnotationListing extends BugChecker implements MethodTreeMatcher { private static final long serialVersionUID = 1L; + /** * A comparator that minimally reorders {@link AnnotationType}s, such that declaration annotations * are placed before type annotations. diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/util/JavaKeywords.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/util/JavaKeywords.java index d2654086e4..6571ecccf2 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/util/JavaKeywords.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/util/JavaKeywords.java @@ -17,6 +17,7 @@ public final class JavaKeywords { */ private static final ImmutableSet BOOLEAN_AND_NULL_LITERALS = ImmutableSet.of("true", "false", "null"); + /** * List of all reserved keywords in the Java language. * @@ -76,6 +77,7 @@ public final class JavaKeywords { "void", "volatile", "while"); + /** * List of all contextual keywords in the Java language. * @@ -100,6 +102,7 @@ public final class JavaKeywords { "var", "with", "yield"); + /** List of all keywords in the Java language. */ private static final ImmutableSet ALL_KEYWORDS = Sets.union(RESERVED_KEYWORDS, CONTEXTUAL_KEYWORDS).immutableCopy(); diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/util/MethodMatcherFactory.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/util/MethodMatcherFactory.java index 6da736019f..de03abd098 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/util/MethodMatcherFactory.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/util/MethodMatcherFactory.java @@ -18,6 +18,7 @@ public final class MethodMatcherFactory { private static final Splitter ARGUMENT_TYPE_SPLITTER = Splitter.on(',').trimResults().omitEmptyStrings(); + // XXX: Check whether we can use a parser for "standard" Java signatures here. Maybe // `sun.reflect.generics.parser.SignatureParser`? @SuppressWarnings("java:S5998" /* In practice there will be only modest recursion. */) diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/util/MoreJUnitMatchers.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/util/MoreJUnitMatchers.java index 04b230b61e..6e5e546b42 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/util/MoreJUnitMatchers.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/util/MoreJUnitMatchers.java @@ -34,6 +34,7 @@ public final class MoreJUnitMatchers { anyOf( isType("org.junit.jupiter.api.Test"), hasMetaAnnotation("org.junit.jupiter.api.TestTemplate"))); + /** Matches JUnit Jupiter setup and teardown methods. */ public static final MultiMatcher SETUP_OR_TEARDOWN_METHOD = annotations( @@ -43,6 +44,7 @@ public final class MoreJUnitMatchers { isType("org.junit.jupiter.api.AfterEach"), isType("org.junit.jupiter.api.BeforeAll"), isType("org.junit.jupiter.api.BeforeEach"))); + /** * Matches methods that have a {@link org.junit.jupiter.params.provider.MethodSource} annotation. */ diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssortedRules.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssortedRules.java index a76e99c827..4841481ee8 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssortedRules.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/AssortedRules.java @@ -103,8 +103,7 @@ T before(Iterator iterator, T defaultValue) { } @AfterTemplate - @Nullable - T after(Iterator iterator, T defaultValue) { + @Nullable T after(Iterator iterator, T defaultValue) { return Iterators.getNext(iterator, defaultValue); } } diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/MapRules.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/MapRules.java index b9610c255c..4d89016c04 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/MapRules.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/MapRules.java @@ -33,14 +33,12 @@ Map after() { static final class MapGetOrNull { @BeforeTemplate - @Nullable - V before(Map map, T key) { + @Nullable V before(Map map, T key) { return map.getOrDefault(key, null); } @AfterTemplate - @Nullable - V after(Map map, T key) { + @Nullable V after(Map map, T key) { return map.get(key); } } diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/MultimapRules.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/MultimapRules.java index 0e17d57f32..c20184f17b 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/MultimapRules.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refasterrules/MultimapRules.java @@ -50,8 +50,7 @@ int after(Multimap multimap) { */ static final class MultimapGet { @BeforeTemplate - @Nullable - Collection before(Multimap multimap, K key) { + @Nullable Collection before(Multimap multimap, K key) { return Refaster.anyOf(multimap.asMap(), Multimaps.asMap(multimap)).get(key); } diff --git a/pom.xml b/pom.xml index b14a5dcb77..104a838ce3 100644 --- a/pom.xml +++ b/pom.xml @@ -524,7 +524,7 @@ com.spotify.fmt fmt-maven-plugin - 2.20 + 2.21.1 ${basedir}/src/test/resources diff --git a/refaster-support/src/main/java/tech/picnic/errorprone/refaster/annotation/OnlineDocumentation.java b/refaster-support/src/main/java/tech/picnic/errorprone/refaster/annotation/OnlineDocumentation.java index f41a2f1b67..01d0117984 100644 --- a/refaster-support/src/main/java/tech/picnic/errorprone/refaster/annotation/OnlineDocumentation.java +++ b/refaster-support/src/main/java/tech/picnic/errorprone/refaster/annotation/OnlineDocumentation.java @@ -23,6 +23,7 @@ * the annotated Refaster rule is located. */ String TOP_LEVEL_CLASS_URL_PLACEHOLDER = "${topLevelClassName}"; + /** * The URL placeholder value that will be replaced with the name of the nested class in which the * annotated Refaster rule is located, if applicable.