From e00aba12c33751304d07d8c8adc2b63d0fbff7ff Mon Sep 17 00:00:00 2001 From: Rick Ossendrijver Date: Sun, 23 Oct 2022 18:15:38 +0200 Subject: [PATCH] Make the build JDK 18+ compatible (#304) --- .../picnic/errorprone/bugpatterns/AmbiguousJsonCreator.java | 3 +++ .../java/tech/picnic/errorprone/bugpatterns/AssertJIsNull.java | 3 +++ .../picnic/errorprone/bugpatterns/AutowiredConstructor.java | 3 +++ .../errorprone/bugpatterns/CanonicalAnnotationSyntax.java | 3 +++ .../picnic/errorprone/bugpatterns/CollectorMutability.java | 3 +++ .../java/tech/picnic/errorprone/bugpatterns/EmptyMethod.java | 3 +++ .../bugpatterns/ErrorProneTestHelperSourceFormat.java | 3 +++ .../picnic/errorprone/bugpatterns/ExplicitEnumOrdering.java | 3 +++ .../tech/picnic/errorprone/bugpatterns/FluxFlatMapUsage.java | 3 +++ .../errorprone/bugpatterns/FormatStringConcatenation.java | 3 +++ .../tech/picnic/errorprone/bugpatterns/IdentityConversion.java | 3 +++ .../errorprone/bugpatterns/ImmutablesSortedSetComparator.java | 3 +++ .../picnic/errorprone/bugpatterns/JUnitMethodDeclaration.java | 3 +++ .../bugpatterns/LexicographicalAnnotationAttributeListing.java | 2 +- .../bugpatterns/LexicographicalAnnotationListing.java | 3 +++ .../picnic/errorprone/bugpatterns/MethodReferenceUsage.java | 3 +++ .../errorprone/bugpatterns/MissingRefasterAnnotation.java | 3 +++ .../tech/picnic/errorprone/bugpatterns/MockitoStubbing.java | 3 +++ .../tech/picnic/errorprone/bugpatterns/NestedOptionals.java | 3 +++ .../java/tech/picnic/errorprone/bugpatterns/NonEmptyMono.java | 3 +++ .../picnic/errorprone/bugpatterns/PrimitiveComparison.java | 3 +++ .../errorprone/bugpatterns/RedundantStringConversion.java | 2 +- .../tech/picnic/errorprone/bugpatterns/RefasterAnyOfUsage.java | 3 +++ .../picnic/errorprone/bugpatterns/RefasterRuleModifiers.java | 3 +++ .../errorprone/bugpatterns/RequestMappingAnnotation.java | 3 +++ .../tech/picnic/errorprone/bugpatterns/RequestParamType.java | 3 +++ .../errorprone/bugpatterns/ScheduledTransactionTrace.java | 3 +++ .../tech/picnic/errorprone/bugpatterns/Slf4jLogStatement.java | 3 +++ .../picnic/errorprone/bugpatterns/SpringMvcAnnotation.java | 3 +++ .../java/tech/picnic/errorprone/bugpatterns/StaticImport.java | 3 +++ .../java/tech/picnic/errorprone/bugpatterns/StringJoin.java | 3 +++ .../java/tech/picnic/errorprone/bugpatterns/TimeZoneUsage.java | 3 +++ .../errorprone/bugpatterns/util/MethodMatcherFactory.java | 3 +++ .../errorprone/refaster/plugin/RefasterRuleCompiler.java | 3 +++ .../java/tech/picnic/errorprone/refaster/runner/Refaster.java | 3 ++- .../errorprone/refaster/AnnotatedCompositeCodeTransformer.java | 2 ++ .../java/tech/picnic/errorprone/refaster/matchers/IsArray.java | 3 +++ .../tech/picnic/errorprone/refaster/matchers/IsCharacter.java | 3 +++ .../errorprone/refaster/matchers/ThrowsCheckedException.java | 3 +++ 39 files changed, 111 insertions(+), 3 deletions(-) diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AmbiguousJsonCreator.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AmbiguousJsonCreator.java index 2dba16ef47..8eec308ef1 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AmbiguousJsonCreator.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AmbiguousJsonCreator.java @@ -36,6 +36,9 @@ public final class AmbiguousJsonCreator extends BugChecker implements Annotation private static final Matcher IS_JSON_CREATOR_ANNOTATION = isType("com.fasterxml.jackson.annotation.JsonCreator"); + /** Instantiates a new {@link AmbiguousJsonCreator} instance. */ + public AmbiguousJsonCreator() {} + @Override public Description matchAnnotation(AnnotationTree tree, VisitorState state) { if (!IS_JSON_CREATOR_ANNOTATION.matches(tree, state)) { diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AssertJIsNull.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AssertJIsNull.java index bce994e816..b8381aa061 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AssertJIsNull.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AssertJIsNull.java @@ -44,6 +44,9 @@ public final class AssertJIsNull extends BugChecker implements MethodInvocationT argumentCount(1), argument(0, nullLiteral())); + /** Instantiates a new {@link AssertJIsNull} instance. */ + public AssertJIsNull() {} + @Override public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { if (!ASSERT_IS_EQUAL_TO_NULL.matches(tree, state)) { diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AutowiredConstructor.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AutowiredConstructor.java index 836e35be10..4bdc29593a 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AutowiredConstructor.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AutowiredConstructor.java @@ -38,6 +38,9 @@ public final class AutowiredConstructor extends BugChecker implements ClassTreeM private static final MultiMatcher AUTOWIRED_ANNOTATION = annotations(AT_LEAST_ONE, isType("org.springframework.beans.factory.annotation.Autowired")); + /** Instantiates a new {@link AutowiredConstructor} instance. */ + public AutowiredConstructor() {} + @Override public Description matchClass(ClassTree tree, VisitorState state) { List constructors = ASTHelpers.getConstructors(tree); diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/CanonicalAnnotationSyntax.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/CanonicalAnnotationSyntax.java index f41463ba1e..b2073c7167 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/CanonicalAnnotationSyntax.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/CanonicalAnnotationSyntax.java @@ -46,6 +46,9 @@ public final class CanonicalAnnotationSyntax extends BugChecker implements Annot CanonicalAnnotationSyntax::dropRedundantValueAttribute, CanonicalAnnotationSyntax::dropRedundantCurlies); + /** Instantiates a new {@link CanonicalAnnotationSyntax} instance. */ + public CanonicalAnnotationSyntax() {} + @Override public Description matchAnnotation(AnnotationTree tree, VisitorState state) { return FIX_FACTORIES.stream() diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/CollectorMutability.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/CollectorMutability.java index cf5900e888..a715b613a2 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/CollectorMutability.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/CollectorMutability.java @@ -45,6 +45,9 @@ public final class CollectorMutability extends BugChecker implements MethodInvoc private static final Matcher SET_COLLECTOR = staticMethod().anyClass().named("toSet"); + /** Instantiates a new {@link CollectorMutability} instance. */ + public CollectorMutability() {} + @Override public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { if (!COLLECTOR_METHOD.matches(tree, state)) { diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/EmptyMethod.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/EmptyMethod.java index 285c0f4fdf..a6706cd7a8 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/EmptyMethod.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/EmptyMethod.java @@ -38,6 +38,9 @@ public final class EmptyMethod extends BugChecker implements MethodTreeMatcher { AT_LEAST_ONE, anyOf(isType("java.lang.Override"), isType("org.aspectj.lang.annotation.Pointcut"))); + /** Instantiates a new {@link EmptyMethod} instance. */ + public EmptyMethod() {} + @Override public Description matchMethod(MethodTree tree, VisitorState state) { if (tree.getBody() == null diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ErrorProneTestHelperSourceFormat.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ErrorProneTestHelperSourceFormat.java index 80524dcb5f..cec01c623d 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ErrorProneTestHelperSourceFormat.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ErrorProneTestHelperSourceFormat.java @@ -72,6 +72,9 @@ public final class ErrorProneTestHelperSourceFormat extends BugChecker .onDescendantOf("com.google.errorprone.BugCheckerRefactoringTestHelper.ExpectOutput") .named("addOutputLines"); + /** Instantiates a new {@link ErrorProneTestHelperSourceFormat} instance. */ + public ErrorProneTestHelperSourceFormat() {} + @Override public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { boolean isOutputSource = OUTPUT_SOURCE_ACCEPTING_METHOD.matches(tree, state); diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ExplicitEnumOrdering.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ExplicitEnumOrdering.java index a1eacfdc91..b04f78073d 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ExplicitEnumOrdering.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ExplicitEnumOrdering.java @@ -46,6 +46,9 @@ public final class ExplicitEnumOrdering extends BugChecker implements MethodInvo private static final Matcher EXPLICIT_ORDERING = staticMethod().onClass(Ordering.class.getName()).named("explicit"); + /** Instantiates a new {@link ExplicitEnumOrdering} instance. */ + public ExplicitEnumOrdering() {} + @Override public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { if (!EXPLICIT_ORDERING.matches(tree, state)) { diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/FluxFlatMapUsage.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/FluxFlatMapUsage.java index 1107d8bb83..a449084b84 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/FluxFlatMapUsage.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/FluxFlatMapUsage.java @@ -58,6 +58,9 @@ public final class FluxFlatMapUsage extends BugChecker .namedAnyOf("flatMap", "flatMapSequential") .withParameters(Function.class.getName()); + /** Instantiates a new {@link FluxFlatMapUsage} instance. */ + public FluxFlatMapUsage() {} + @Override public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { if (!FLUX_FLATMAP.matches(tree, state)) { 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 edf68aecd8..c0618bcbed 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 @@ -129,6 +129,9 @@ public final class FormatStringConcatenation extends BugChecker .onDescendantOf("org.slf4j.Logger") .namedAnyOf("debug", "error", "info", "trace", "warn"); + /** Instantiates a new {@link FormatStringConcatenation} instance. */ + public FormatStringConcatenation() {} + @Override public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { if (hasNonConstantStringConcatenationArgument(tree, 0, state)) { diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/IdentityConversion.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/IdentityConversion.java index 660d1361a6..00d6d9bdcb 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/IdentityConversion.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/IdentityConversion.java @@ -72,6 +72,9 @@ public final class IdentityConversion extends BugChecker implements MethodInvoca .namedAnyOf("concat", "firstWithSignal", "from", "merge"), staticMethod().onClass("reactor.core.publisher.Mono").namedAnyOf("from", "fromDirect")); + /** Instantiates a new {@link IdentityConversion} instance. */ + public IdentityConversion() {} + @Override public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { List arguments = tree.getArguments(); diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ImmutablesSortedSetComparator.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ImmutablesSortedSetComparator.java index 4ee1f1bc31..468a2dcc82 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ImmutablesSortedSetComparator.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ImmutablesSortedSetComparator.java @@ -67,6 +67,9 @@ public final class ImmutablesSortedSetComparator extends BugChecker implements M hasAnnotation("org.immutables.value.Value.NaturalOrder"), hasAnnotation("org.immutables.value.Value.ReverseOrder")))); + /** Instantiates a new {@link ImmutablesSortedSetComparator} instance. */ + public ImmutablesSortedSetComparator() {} + @Override public Description matchMethod(MethodTree tree, VisitorState state) { if (!METHOD_LACKS_ANNOTATION.matches(tree, state)) { diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/JUnitMethodDeclaration.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/JUnitMethodDeclaration.java index 47be2d4f7d..26373ba53e 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/JUnitMethodDeclaration.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/JUnitMethodDeclaration.java @@ -79,6 +79,9 @@ public final class JUnitMethodDeclaration extends BugChecker implements MethodTr isType("org.junit.jupiter.api.BeforeAll"), isType("org.junit.jupiter.api.BeforeEach"))); + /** Instantiates a new {@link JUnitMethodDeclaration} instance. */ + public JUnitMethodDeclaration() {} + @Override public Description matchMethod(MethodTree tree, VisitorState state) { if (HAS_UNMODIFIABLE_SIGNATURE.matches(tree, state)) { 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 21ded55dfd..2a2bf7357d 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 @@ -82,7 +82,7 @@ public final class LexicographicalAnnotationAttributeListing extends BugChecker private final AnnotationAttributeMatcher matcher; - /** Instantiates the default {@link LexicographicalAnnotationAttributeListing}. */ + /** Instantiates a default {@link LexicographicalAnnotationAttributeListing} instance. */ public LexicographicalAnnotationAttributeListing() { this(ErrorProneFlags.empty()); } 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 f5d23ed18f..660458f29d 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 @@ -40,6 +40,9 @@ public final class LexicographicalAnnotationListing extends BugChecker implements MethodTreeMatcher { private static final long serialVersionUID = 1L; + /** Instantiates a new {@link LexicographicalAnnotationListing} instance. */ + public LexicographicalAnnotationListing() {} + @Override public Description matchMethod(MethodTree tree, VisitorState state) { List originalOrdering = tree.getModifiers().getAnnotations(); diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MethodReferenceUsage.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MethodReferenceUsage.java index ea1f6c9faf..bc3d2afc85 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MethodReferenceUsage.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MethodReferenceUsage.java @@ -60,6 +60,9 @@ public final class MethodReferenceUsage extends BugChecker implements LambdaExpressionTreeMatcher { private static final long serialVersionUID = 1L; + /** Instantiates a new {@link MethodReferenceUsage} instance. */ + public MethodReferenceUsage() {} + @Override public Description matchLambdaExpression(LambdaExpressionTree tree, VisitorState state) { /* diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MissingRefasterAnnotation.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MissingRefasterAnnotation.java index 74e92d95a2..12c71af619 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MissingRefasterAnnotation.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MissingRefasterAnnotation.java @@ -40,6 +40,9 @@ public final class MissingRefasterAnnotation extends BugChecker implements Class isType("com.google.errorprone.refaster.annotation.BeforeTemplate"), isType("com.google.errorprone.refaster.annotation.AfterTemplate"))); + /** Instantiates a new {@link MissingRefasterAnnotation} instance. */ + public MissingRefasterAnnotation() {} + @Override public Description matchClass(ClassTree tree, VisitorState state) { long methodTypes = diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MockitoStubbing.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MockitoStubbing.java index e46070b1b8..396e589158 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MockitoStubbing.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MockitoStubbing.java @@ -36,6 +36,9 @@ public final class MockitoStubbing extends BugChecker implements MethodInvocatio private static final Matcher MOCKITO_EQ_METHOD = staticMethod().onClass("org.mockito.ArgumentMatchers").named("eq"); + /** Instantiates a new {@link MockitoStubbing} instance. */ + public MockitoStubbing() {} + @Override public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { List arguments = tree.getArguments(); diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NestedOptionals.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NestedOptionals.java index df4f994511..1c6228e29e 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NestedOptionals.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NestedOptionals.java @@ -34,6 +34,9 @@ public final class NestedOptionals extends BugChecker implements MethodInvocatio private static final long serialVersionUID = 1L; private static final Supplier OPTIONAL = Suppliers.typeFromClass(Optional.class); + /** Instantiates a new {@link NestedOptionals} instance. */ + public NestedOptionals() {} + @Override public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { return isOptionalOfOptional(tree, state) ? describeMatch(tree) : Description.NO_MATCH; diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NonEmptyMono.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NonEmptyMono.java index e7ed773097..87514bdbc2 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NonEmptyMono.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NonEmptyMono.java @@ -76,6 +76,9 @@ public final class NonEmptyMono extends BugChecker implements MethodInvocationTr .onDescendantOf("reactor.core.publisher.Mono") .namedAnyOf("defaultIfEmpty", "hasElement", "single")); + /** Instantiates a new {@link NonEmptyMono} instance. */ + public NonEmptyMono() {} + @Override public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { if (!MONO_SIZE_CHECK.matches(tree, state)) { diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/PrimitiveComparison.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/PrimitiveComparison.java index d105f07b63..bd26e35d3f 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/PrimitiveComparison.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/PrimitiveComparison.java @@ -70,6 +70,9 @@ public final class PrimitiveComparison extends BugChecker implements MethodInvoc .named("thenComparing") .withParameters(Function.class.getName())); + /** Instantiates a new {@link PrimitiveComparison} instance. */ + public PrimitiveComparison() {} + @Override public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { boolean isStatic = STATIC_COMPARISON_METHOD.matches(tree, state); diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RedundantStringConversion.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RedundantStringConversion.java index e6dd92e66a..fae14e3d36 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RedundantStringConversion.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RedundantStringConversion.java @@ -141,7 +141,7 @@ public final class RedundantStringConversion extends BugChecker private final Matcher conversionMethodMatcher; - /** Instantiates the default {@link RedundantStringConversion}. */ + /** Instantiates a default {@link RedundantStringConversion} instance. */ public RedundantStringConversion() { this(ErrorProneFlags.empty()); } diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RefasterAnyOfUsage.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RefasterAnyOfUsage.java index 0e636b02e5..97e6814644 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RefasterAnyOfUsage.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RefasterAnyOfUsage.java @@ -37,6 +37,9 @@ public final class RefasterAnyOfUsage extends BugChecker implements MethodInvoca private static final Matcher REFASTER_ANY_OF = staticMethod().onClass(Refaster.class.getName()).named("anyOf"); + /** Instantiates a new {@link RefasterAnyOfUsage} instance. */ + public RefasterAnyOfUsage() {} + @Override public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { if (REFASTER_ANY_OF.matches(tree, state)) { diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RefasterRuleModifiers.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RefasterRuleModifiers.java index fd016da91a..5cd6a5db49 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RefasterRuleModifiers.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RefasterRuleModifiers.java @@ -48,6 +48,9 @@ public final class RefasterRuleModifiers extends BugChecker private static final Matcher REFASTER_METHOD = anyOf(BEFORE_TEMPLATE_METHOD, AFTER_TEMPLATE_METHOD, PLACEHOLDER_METHOD); + /** Instantiates a new {@link RefasterRuleModifiers} instance. */ + public RefasterRuleModifiers() {} + @Override public Description matchClass(ClassTree tree, VisitorState state) { if (!hasMatchingMember(tree, BEFORE_TEMPLATE_METHOD, state)) { diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestMappingAnnotation.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestMappingAnnotation.java index b35528c7fa..df0dbe330e 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestMappingAnnotation.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestMappingAnnotation.java @@ -83,6 +83,9 @@ public final class RequestMappingAnnotation extends BugChecker implements Method isSameType("org.springframework.web.util.UriBuilder"), isSameType("org.springframework.web.util.UriComponentsBuilder")))); + /** Instantiates a new {@link RequestMappingAnnotation} instance. */ + public RequestMappingAnnotation() {} + @Override public Description matchMethod(MethodTree tree, VisitorState state) { // XXX: Auto-add `@RequestParam` where applicable. diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestParamType.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestParamType.java index d7a27be037..eb076e3867 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestParamType.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestParamType.java @@ -37,6 +37,9 @@ public final class RequestParamType extends BugChecker implements VariableTreeMa annotations(AT_LEAST_ONE, isType("org.springframework.web.bind.annotation.RequestParam")), anyOf(isSubtypeOf(ImmutableCollection.class), isSubtypeOf(ImmutableMap.class))); + /** Instantiates a new {@link RequestParamType} instance. */ + public RequestParamType() {} + @Override public Description matchVariable(VariableTree tree, VisitorState state) { return HAS_UNSUPPORTED_REQUEST_PARAM.matches(tree, state) diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ScheduledTransactionTrace.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ScheduledTransactionTrace.java index 0c9917444d..a23a6ceeb6 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ScheduledTransactionTrace.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ScheduledTransactionTrace.java @@ -46,6 +46,9 @@ public final class ScheduledTransactionTrace extends BugChecker implements Metho private static final MultiMatcher TRACE_ANNOTATION = annotations(AT_LEAST_ONE, isType(TRACE_ANNOTATION_FQCN)); + /** Instantiates a new {@link ScheduledTransactionTrace} instance. */ + public ScheduledTransactionTrace() {} + @Override public Description matchMethod(MethodTree tree, VisitorState state) { if (!IS_SCHEDULED.matches(tree, state)) { diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/Slf4jLogStatement.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/Slf4jLogStatement.java index 9e908db516..5d628a31d5 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/Slf4jLogStatement.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/Slf4jLogStatement.java @@ -48,6 +48,9 @@ public final class Slf4jLogStatement extends BugChecker implements MethodInvocat .onDescendantOf("org.slf4j.Logger") .namedAnyOf("trace", "debug", "info", "warn", "error"); + /** Instantiates a new {@link Slf4jLogStatement} instance. */ + public Slf4jLogStatement() {} + @Override public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { if (!SLF4J_LOGGER_INVOCATION.matches(tree, state)) { diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/SpringMvcAnnotation.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/SpringMvcAnnotation.java index 4ad8e66e45..97cad60805 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/SpringMvcAnnotation.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/SpringMvcAnnotation.java @@ -57,6 +57,9 @@ public final class SpringMvcAnnotation extends BugChecker implements AnnotationT .put("PUT", "PutMapping") .build(); + /** Instantiates a new {@link SpringMvcAnnotation} instance. */ + public SpringMvcAnnotation() {} + @Override public Description matchAnnotation(AnnotationTree tree, VisitorState state) { // XXX: We could remove the `@RequestMapping` import if not other usages remain. diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StaticImport.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StaticImport.java index da7020307f..d5bc39c5ec 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StaticImport.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StaticImport.java @@ -190,6 +190,9 @@ public final class StaticImport extends BugChecker implements MemberSelectTreeMa "of", "valueOf"); + /** Instantiates a new {@link StaticImport} instance. */ + public StaticImport() {} + @Override public Description matchMemberSelect(MemberSelectTree tree, VisitorState state) { if (!isCandidateContext(state) || !isCandidate(tree)) { diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StringJoin.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StringJoin.java index 1d91f0642b..76359780b4 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StringJoin.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StringJoin.java @@ -52,6 +52,9 @@ public final class StringJoin extends BugChecker implements MethodInvocationTree Suppliers.typeFromClass(CharSequence.class); private static final Supplier FORMATTABLE_TYPE = Suppliers.typeFromClass(Formattable.class); + /** Instantiates a new {@link StringJoin} instance. */ + public StringJoin() {} + @Override public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { if (!STRING_FORMAT_INVOCATION.matches(tree, state)) { diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/TimeZoneUsage.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/TimeZoneUsage.java index a53ffa6bc0..1bda1d207b 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/TimeZoneUsage.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/TimeZoneUsage.java @@ -62,6 +62,9 @@ public final class TimeZoneUsage extends BugChecker implements MethodInvocationT .named("now"), staticMethod().onClassAny(Instant.class.getName()).named("now").withNoParameters()); + /** Instantiates a new {@link TimeZoneUsage} instance. */ + public TimeZoneUsage() {} + @Override public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { return BANNED_TIME_METHOD.matches(tree, state) 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 39ee92e4b0..2a89521483 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 @@ -21,6 +21,9 @@ public final class MethodMatcherFactory { private static final Pattern METHOD_SIGNATURE = Pattern.compile("([^\\s#(,)]+)#([^\\s#(,)]+)\\(((?:[^\\s#(,)]+(?:,[^\\s#(,)]+)*)?)\\)"); + /** Instantiates a new {@link MethodMatcherFactory} instance. */ + public MethodMatcherFactory() {} + /** * Creates a {@link Matcher} of methods with any of the given signatures. * diff --git a/refaster-compiler/src/main/java/tech/picnic/errorprone/refaster/plugin/RefasterRuleCompiler.java b/refaster-compiler/src/main/java/tech/picnic/errorprone/refaster/plugin/RefasterRuleCompiler.java index 47dcdff99d..e7423961df 100644 --- a/refaster-compiler/src/main/java/tech/picnic/errorprone/refaster/plugin/RefasterRuleCompiler.java +++ b/refaster-compiler/src/main/java/tech/picnic/errorprone/refaster/plugin/RefasterRuleCompiler.java @@ -12,6 +12,9 @@ */ @AutoService(Plugin.class) public final class RefasterRuleCompiler implements Plugin { + /** Instantiates a new {@link RefasterRuleCompiler} instance. */ + public RefasterRuleCompiler() {} + @Override public String getName() { return getClass().getSimpleName(); diff --git a/refaster-runner/src/main/java/tech/picnic/errorprone/refaster/runner/Refaster.java b/refaster-runner/src/main/java/tech/picnic/errorprone/refaster/runner/Refaster.java index ef3b70161f..6e4cd38c23 100644 --- a/refaster-runner/src/main/java/tech/picnic/errorprone/refaster/runner/Refaster.java +++ b/refaster-runner/src/main/java/tech/picnic/errorprone/refaster/runner/Refaster.java @@ -61,9 +61,10 @@ public final class Refaster extends BugChecker implements CompilationUnitTreeMat private static final long serialVersionUID = 1L; + @SuppressWarnings("serial" /* Concrete instance will be `Serializable`. */) private final CodeTransformer codeTransformer; - /** Instantiates the default {@link Refaster}. */ + /** Instantiates a default {@link Refaster} instance. */ public Refaster() { this(ErrorProneFlags.empty()); } diff --git a/refaster-support/src/main/java/tech/picnic/errorprone/refaster/AnnotatedCompositeCodeTransformer.java b/refaster-support/src/main/java/tech/picnic/errorprone/refaster/AnnotatedCompositeCodeTransformer.java index e43f0ea4c5..2ee66153ba 100644 --- a/refaster-support/src/main/java/tech/picnic/errorprone/refaster/AnnotatedCompositeCodeTransformer.java +++ b/refaster-support/src/main/java/tech/picnic/errorprone/refaster/AnnotatedCompositeCodeTransformer.java @@ -42,6 +42,8 @@ public abstract class AnnotatedCompositeCodeTransformer implements CodeTransform private static final long serialVersionUID = 1L; private static final Splitter CLASS_NAME_SPLITTER = Splitter.on('.').limit(2); + AnnotatedCompositeCodeTransformer() {} + abstract String packageName(); abstract ImmutableList transformers(); diff --git a/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/IsArray.java b/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/IsArray.java index 18cd53a063..83ecaa9521 100644 --- a/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/IsArray.java +++ b/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/IsArray.java @@ -11,6 +11,9 @@ public final class IsArray implements Matcher { private static final long serialVersionUID = 1L; private static final Matcher DELEGATE = isArrayType(); + /** Instantiates a new {@link IsArray} instance. */ + public IsArray() {} + @Override public boolean matches(ExpressionTree tree, VisitorState state) { return DELEGATE.matches(tree, state); diff --git a/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/IsCharacter.java b/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/IsCharacter.java index 83ab9b5a9c..f5db5d5317 100644 --- a/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/IsCharacter.java +++ b/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/IsCharacter.java @@ -14,6 +14,9 @@ public final class IsCharacter implements Matcher { private static final Matcher DELEGATE = anyOf(isSameType(CHAR_TYPE), isSameType(Character.class)); + /** Instantiates a new {@link IsCharacter} instance. */ + public IsCharacter() {} + @Override public boolean matches(ExpressionTree tree, VisitorState state) { return DELEGATE.matches(tree, state); diff --git a/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/ThrowsCheckedException.java b/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/ThrowsCheckedException.java index 85f0a53a3d..71989ea1e0 100644 --- a/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/ThrowsCheckedException.java +++ b/refaster-support/src/main/java/tech/picnic/errorprone/refaster/matchers/ThrowsCheckedException.java @@ -19,6 +19,9 @@ public final class ThrowsCheckedException implements Matcher { private static final long serialVersionUID = 1L; + /** Instantiates a new {@link ThrowsCheckedException} instance. */ + public ThrowsCheckedException() {} + @Override public boolean matches(ExpressionTree tree, VisitorState state) { return containsCheckedException(getThrownTypes(tree, state), state);