Compare commits

...

38 Commits

Author SHA1 Message Date
Stephan Schroevers
d908824e99 Format 2023-10-07 13:41:58 +02:00
Vincent Koeman
efd3a9a002 suppress warning and fix an occurence 2023-10-06 18:08:58 +02:00
Vincent Koeman
10dfe9d732 extend test 2023-10-06 17:34:46 +02:00
Vincent Koeman
29bdf78481 Introduce JUnitSingleArguments bug checker 2023-10-06 17:07:52 +02:00
Stephan Schroevers
5596b584ac [maven-release-plugin] prepare for next development iteration 2023-10-04 16:40:37 +02:00
Stephan Schroevers
4800522a09 [maven-release-plugin] prepare release v0.14.0 2023-10-04 16:40:37 +02:00
Stephan Schroevers
9a77a3f35f Drop ScheduledTransactionTrace check (#788)
As well as any other references to New Relic.
2023-10-04 15:30:13 +02:00
Picnic-Bot
ef75b80e7b Upgrade Error Prone 2.21.1 -> 2.22.0 (#800)
See:
- https://github.com/google/error-prone/releases/tag/v2.22.0
- https://github.com/google/error-prone/compare/v2.21.1...v2.22.0
- https://github.com/PicnicSupermarket/error-prone/compare/v2.21.1-picnic-1...v2.22.0-picnic-1
2023-10-04 14:43:27 +02:00
Picnic-Bot
7c618f7e2d Upgrade sonar-maven-plugin 3.9.1.2184 -> 3.10.0.2594 (#792)
See:
- https://github.com/SonarSource/sonar-scanner-maven/releases/tag/3.10.0.2594
- https://github.com/SonarSource/sonar-scanner-maven/compare/3.9.1.2184...3.10.0.2594
2023-10-04 13:44:51 +02:00
Stephan Schroevers
c03ead9e5d Upgrade JDKs used by GitHub Actions builds (#780)
Summary of changes:
- Use JDK 11.0.20 instead of 11.0.19.
- Use JDK 17.0.8 instead of 17.0.7.
- Use JDK 20.0.2 instead of 20.0.1.

See:
- https://www.oracle.com/java/technologies/javase/11-0-20-relnotes.html
- https://www.oracle.com/java/technologies/javase/17-0-8-relnotes.html
- https://www.oracle.com/java/technologies/javase/20-0-2-relnotes.html
2023-10-04 11:22:16 +02:00
Picnic-Bot
8fd87a5b6b Upgrade SLF4J 2.0.7 -> 2.0.9 (#778)
See:
- https://www.slf4j.org/news.html
- https://github.com/qos-ch/slf4j/compare/v_2.0.7...v_2.0.9
2023-10-04 10:59:37 +02:00
Picnic-Bot
82025a729f 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
2023-10-04 10:29:27 +02:00
Picnic-Bot
7d912d1b04 Upgrade Swagger 2.2.15 -> 2.2.16 (#795)
See:
- https://github.com/swagger-api/swagger-core/releases/tag/v2.2.16
- https://github.com/swagger-api/swagger-core/compare/v2.2.15...v2.2.16
2023-10-04 08:45:30 +02:00
Picnic-Bot
a726514e98 Upgrade AspectJ 1.9.20 -> 1.9.20.1 (#781)
See:
- https://github.com/eclipse-aspectj/aspectj/releases/tag/V1_9_20_1
- https://github.com/eclipse/org.aspectj/compare/V1_9_20...V1_9_20_1
2023-10-04 08:36:58 +02:00
Picnic-Bot
aa7de5777c Upgrade Spring 5.3.29 -> 5.3.30 (#791)
See:
- https://github.com/spring-projects/spring-framework/releases/tag/v5.3.30
- https://github.com/spring-projects/spring-framework/compare/v5.3.29...v5.3.30
2023-10-04 08:25:50 +02:00
Picnic-Bot
6e6efb3c13 Upgrade Project Reactor 2022.0.10 -> 2022.0.11 (#789)
See:
- https://github.com/reactor/reactor/releases/tag/2022.0.11
- https://github.com/reactor/reactor/compare/2022.0.10...2022.0.11
2023-10-03 16:54:15 +02:00
Picnic-Bot
03fd050eae Upgrade AutoValue 1.10.3 -> 1.10.4 (#784)
See:
- https://github.com/google/auto/releases/tag/auto-value-1.10.4
- https://github.com/google/auto/compare/auto-value-1.10.3...auto-value-1.10.4
2023-10-03 16:42:00 +02:00
Picnic-Bot
d1467e0424 Upgrade actions/upload-artifact v3.1.2 -> v3.1.3 (#782)
See:
- https://github.com/actions/upload-artifact/releases/tag/v3.1.3
2023-10-03 16:08:59 +02:00
Picnic-Bot
a2e32ed147 Upgrade maven-enforcer-plugin 3.4.0 -> 3.4.1 (#787)
See:
- https://github.com/apache/maven-enforcer/releases/tag/enforcer-3.4.1
- https://github.com/apache/maven-enforcer/compare/enforcer-3.4.0...enforcer-3.4.1
2023-10-03 15:58:07 +02:00
Picnic-Bot
258708e6a8 Upgrade New Relic Java Agent 8.5.0 -> 8.6.0 (#785)
See:
- https://github.com/newrelic/newrelic-java-agent/releases/tag/v8.6.0
- https://github.com/newrelic/newrelic-java-agent/compare/v8.5.0...v8.6.0
2023-10-03 13:23:08 +02:00
Picnic-Bot
67106a9725 Upgrade actions/setup-java v3.12.0 -> v3.13.0 (#798)
See:
- https://github.com/actions/setup-java/releases/tag/v3.13.0
2023-10-03 13:14:33 +02:00
Picnic-Bot
f979576ab5 Upgrade maven-javadoc-plugin 3.5.0 -> 3.6.0 (#793)
See:
- https://github.com/apache/maven-javadoc-plugin/releases/tag/maven-javadoc-plugin-3.6.0
- https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.5.0...maven-javadoc-plugin-3.6.0
2023-10-03 12:53:51 +02:00
Picnic-Bot
aa3fd03569 Upgrade dawidd6/action-download-artifact v2.27.0 -> v2.28.0 (#796)
See:
- https://github.com/dawidd6/action-download-artifact/compare/v2.27.0...v2.28.0
2023-10-03 11:59:38 +02:00
Picnic-Bot
5602251667 Upgrade actions/checkout v3.6.0 -> v4.1.0 (#779)
See:
- https://github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v410
- https://github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v400
2023-10-03 11:51:20 +02:00
Picnic-Bot
05cb6387b9 Upgrade Checkstyle 10.12.3 -> 10.12.4 (#807)
See:
- https://checkstyle.sourceforge.io/releasenotes.html
- https://github.com/checkstyle/checkstyle/releases/tag/checkstyle-10.12.4
- https://github.com/checkstyle/checkstyle/compare/checkstyle-10.12.3...checkstyle-10.12.4
2023-10-03 11:38:31 +02:00
Picnic-Bot
4e242a5b11 Upgrade Byte Buddy 1.14.7 -> 1.14.8 (#790)
See:
- https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.14.8
- https://github.com/raphw/byte-buddy/compare/byte-buddy-1.14.7...byte-buddy-1.14.8
2023-10-03 10:31:08 +02:00
Picnic-Bot
87297c9a1d Upgrade versions-maven-plugin 2.16.0 -> 2.16.1 (#797)
See:
- https://github.com/mojohaus/versions/releases/tag/2.16.1
- https://github.com/mojohaus/versions-maven-plugin/compare/2.16.0...2.16.1
2023-10-03 10:17:14 +02:00
Picnic-Bot
15ff85c4ea Upgrade Checker Framework Annotations 3.38.0 -> 3.39.0 (#808)
See:
- https://github.com/typetools/checker-framework/releases/tag/checker-framework-3.39.0
- https://github.com/typetools/checker-framework/compare/checker-framework-3.38.0...checker-framework-3.39.0
2023-10-03 10:00:24 +02:00
Picnic-Bot
2c8469fa93 Upgrade Google Java Format 1.17.0 -> 1.18.0 (#809)
See:
- https://github.com/google/google-java-format/releases/tag/v1.18.0
- https://github.com/google/google-java-format/compare/v1.17.0...v1.18.0
2023-10-03 09:28:21 +02:00
Picnic-Bot
f4e0fd2cc3 Upgrade Modernizer Maven Plugin 2.6.0 -> 2.7.0 (#801)
See:
- https://github.com/gaul/modernizer-maven-plugin/releases/tag/modernizer-maven-plugin-2.7.0
- https://github.com/gaul/modernizer-maven-plugin/compare/modernizer-maven-plugin-2.6.0...modernizer-maven-plugin-2.7.0
2023-10-03 08:55:08 +02:00
Picnic-Bot
34fd692064 Upgrade pitest-maven-plugin 1.14.4 -> 1.15.0 (#803)
See:
- https://github.com/hcoles/pitest/releases/tag/1.15.0
- https://github.com/hcoles/pitest/compare/1.14.4...1.15.0
2023-10-03 08:07:16 +02:00
Stephan Schroevers
26bc7e6e8e Disallow autovalue.shaded.* imports (#774) 2023-10-02 18:00:57 +02:00
Picnic-Bot
56cb86a7e1 Upgrade Checker Framework Annotations 3.37.0 -> 3.38.0 (#773)
See:
- https://github.com/typetools/checker-framework/releases/tag/checker-framework-3.38.0
- https://github.com/typetools/checker-framework/compare/checker-framework-3.37.0...checker-framework-3.38.0
2023-10-02 17:43:17 +02:00
Picnic-Bot
19cd802ec5 Upgrade NullAway 0.10.12 -> 0.10.14 (#776)
See:
- https://github.com/uber/NullAway/blob/master/CHANGELOG.md
- https://github.com/uber/NullAway/releases/tag/v0.10.13
- https://github.com/uber/NullAway/releases/tag/v0.10.14
- https://github.com/uber/NullAway/compare/v0.10.12...v0.10.14
2023-10-02 16:29:33 +02:00
Picnic-Bot
1fabb26ed2 Upgrade Spring Boot 2.7.15 -> 2.7.16 (#799)
See:
- https://github.com/spring-projects/spring-boot/releases/tag/v2.7.16
- https://github.com/spring-projects/spring-boot/compare/v2.7.15...v2.7.16
2023-10-02 16:17:58 +02:00
Picnic-Bot
c1ced1e962 Upgrade CodeQL v2.21.4 -> v2.21.9 (#786)
See:
- https://github.com/github/codeql-action/blob/main/CHANGELOG.md
- https://github.com/github/codeql-action/compare/v2.21.4...v2.21.9
2023-10-02 09:57:34 +02:00
Picnic-Bot
030ed25be8 Upgrade Forbidden APIs plugin 3.5.1 -> 3.6 (#806)
See:
- https://github.com/policeman-tools/forbidden-apis/wiki/Changes
- https://github.com/policeman-tools/forbidden-apis/compare/3.5.1...3.6
2023-10-02 09:20:01 +02:00
Picnic-Bot
ee0c04a44e Upgrade Arcmutate 1.1.3 -> 1.2.0 (#805) 2023-10-02 07:10:41 +02:00
36 changed files with 173 additions and 309 deletions

View File

@@ -42,7 +42,7 @@ Please replace this sentence with log output, if applicable.
<!-- Please complete the following information: -->
- Operating system (e.g. MacOS Monterey).
- Java version (i.e. `java --version`, e.g. `17.0.7`).
- Java version (i.e. `java --version`, e.g. `17.0.8`).
- Error Prone version (e.g. `2.18.0`).
- Error Prone Support version (e.g. `0.9.0`).

View File

@@ -10,16 +10,16 @@ jobs:
strategy:
matrix:
os: [ ubuntu-22.04 ]
jdk: [ 11.0.19, 17.0.7, 20.0.1 ]
jdk: [ 11.0.20, 17.0.8, 20.0.2 ]
distribution: [ temurin ]
experimental: [ false ]
include:
- os: macos-12
jdk: 17.0.7
jdk: 17.0.8
distribution: temurin
experimental: false
- os: windows-2022
jdk: 17.0.7
jdk: 17.0.8
distribution: temurin
experimental: false
runs-on: ${{ matrix.os }}
@@ -31,11 +31,11 @@ jobs:
# additionally enabling all checks defined in this project and any Error
# Prone checks available only from other artifact repositories.
- name: Check out code
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
persist-credentials: false
- name: Set up JDK
uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # v3.12.0
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
with:
java-version: ${{ matrix.jdk }}
distribution: ${{ matrix.distribution }}

View File

@@ -22,23 +22,23 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
persist-credentials: false
- name: Set up JDK
uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # v3.12.0
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
with:
java-version: 17.0.7
java-version: 17.0.8
distribution: temurin
cache: maven
- name: Initialize CodeQL
uses: github/codeql-action/init@a09933a12a80f87b87005513f0abb1494c27a716 # v2.21.4
uses: github/codeql-action/init@ddccb873888234080b77e9bc2d4764d5ccaaccf9 # v2.21.9
with:
languages: ${{ matrix.language }}
- name: Perform minimal build
if: matrix.language == 'java'
run: mvn -T1C clean install -DskipTests -Dverification.skip
- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@a09933a12a80f87b87005513f0abb1494c27a716 # v2.21.4
uses: github/codeql-action/analyze@ddccb873888234080b77e9bc2d4764d5ccaaccf9 # v2.21.9
with:
category: /language:${{ matrix.language }}

View File

@@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
persist-credentials: false
- uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0

View File

@@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
persist-credentials: false
- name: Run OpenSSF Scorecard analysis
@@ -31,6 +31,6 @@ jobs:
results_format: sarif
publish_results: ${{ github.ref == 'refs/heads/master' }}
- name: Update GitHub's code scanning dashboard
uses: github/codeql-action/upload-sarif@a09933a12a80f87b87005513f0abb1494c27a716 # v2.21.4
uses: github/codeql-action/upload-sarif@ddccb873888234080b77e9bc2d4764d5ccaaccf9 # v2.21.9
with:
sarif_file: results.sarif

View File

@@ -12,14 +12,14 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
fetch-depth: 2
persist-credentials: false
- name: Set up JDK
uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # v3.12.0
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
with:
java-version: 17.0.7
java-version: 17.0.8
distribution: temurin
cache: maven
- name: Run Pitest
@@ -32,7 +32,7 @@ jobs:
- name: Aggregate Pitest reports
run: mvn pitest-git:aggregate -DkilledEmoji=":tada:" -DmutantEmoji=":zombie:" -DtrailingText="Mutation testing report by [Pitest](https://pitest.org/). Review any surviving mutants by inspecting the line comments under [_Files changed_](${{ github.event.number }}/files)."
- name: Upload Pitest reports as artifact
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: pitest-reports
path: ./target/pit-reports-ci

View File

@@ -20,17 +20,17 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
persist-credentials: false
- name: Set up JDK
uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # v3.12.0
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
with:
java-version: 17.0.7
java-version: 17.0.8
distribution: temurin
cache: maven
- name: Download Pitest analysis artifact
uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 # v2.27.0
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e # v2.28.0
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: pitest-reports

View File

@@ -16,14 +16,14 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
fetch-depth: 0
persist-credentials: false
- name: Set up JDK
uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # v3.12.0
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
with:
java-version: 17.0.7
java-version: 17.0.8
distribution: temurin
cache: maven
- name: Create missing `test` directory

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>tech.picnic.error-prone-support</groupId>
<artifactId>error-prone-support</artifactId>
<version>0.13.1-SNAPSHOT</version>
<version>0.14.1-SNAPSHOT</version>
</parent>
<artifactId>documentation-support</artifactId>

View File

@@ -125,9 +125,6 @@ The following is a list of checks we'd like to see implemented:
statement. Idem for other exception types.
- A Guava-specific check that replaces simple anonymous `CacheLoader` subclass
declarations with `CacheLoader.from(someLambda)`.
- A Spring-specific check that enforces that methods with the `@Scheduled`
annotation are also annotated with New Relic's `@Trace` annotation. Such
methods should ideally not also represent Spring MVC endpoints.
- A Spring-specific check that enforces that `@RequestMapping` annotations,
when applied to a method, explicitly specify one or more target HTTP methods.
- A Spring-specific check that looks for classes in which all `@RequestMapping`

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>tech.picnic.error-prone-support</groupId>
<artifactId>error-prone-support</artifactId>
<version>0.13.1-SNAPSHOT</version>
<version>0.14.1-SNAPSHOT</version>
</parent>
<artifactId>error-prone-contrib</artifactId>
@@ -81,11 +81,6 @@
<artifactId>guava</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.newrelic.agent.java</groupId>
<artifactId>newrelic-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>

View File

@@ -59,6 +59,7 @@ import tech.picnic.errorprone.bugpatterns.util.SourceCode;
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<ExpressionTree> ASSERTJ_FORMAT_METHOD =
anyOf(

View File

@@ -0,0 +1,50 @@
package tech.picnic.errorprone.bugpatterns;
import static com.google.errorprone.BugPattern.LinkType.CUSTOM;
import static com.google.errorprone.BugPattern.SeverityLevel.SUGGESTION;
import static com.google.errorprone.BugPattern.StandardTags.SIMPLIFICATION;
import static com.google.errorprone.matchers.method.MethodMatchers.staticMethod;
import static tech.picnic.errorprone.bugpatterns.util.Documentation.BUG_PATTERNS_BASE_URL;
import com.google.auto.service.AutoService;
import com.google.errorprone.BugPattern;
import com.google.errorprone.VisitorState;
import com.google.errorprone.bugpatterns.BugChecker;
import com.google.errorprone.bugpatterns.BugChecker.MethodInvocationTreeMatcher;
import com.google.errorprone.matchers.Description;
import com.google.errorprone.matchers.Matcher;
import com.sun.source.tree.ExpressionTree;
import com.sun.source.tree.MethodInvocationTree;
import tech.picnic.errorprone.bugpatterns.util.SourceCode;
/**
* A {@link BugChecker} that flags uses of {@link
* org.junit.jupiter.params.provider.Arguments#arguments(Object...)} with a single (or no) argument;
* in such cases the use of {@link org.junit.jupiter.params.provider.Arguments} is not required as a
* {@link java.util.stream.Stream} of objects can be directly provided to a {@link
* org.junit.jupiter.params.provider.MethodSource}.
*/
@AutoService(BugChecker.class)
@BugPattern(
summary = "JUnit arguments wrapping a single object are redundant",
link = BUG_PATTERNS_BASE_URL + "JUnitSingleArguments",
linkType = CUSTOM,
severity = SUGGESTION,
tags = SIMPLIFICATION)
public final class JUnitSingleArguments extends BugChecker implements MethodInvocationTreeMatcher {
private static final long serialVersionUID = 1L;
private static final Matcher<ExpressionTree> ARGUMENTS_ARGUMENTS =
staticMethod().onClass("org.junit.jupiter.params.provider.Arguments").named("arguments");
/** Instantiates a new {@link JUnitSingleArguments} instance. */
public JUnitSingleArguments() {}
@Override
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) {
if (ARGUMENTS_ARGUMENTS.matches(tree, state) && tree.getArguments().size() <= 1) {
return describeMatch(tree, SourceCode.unwrapMethodInvocation(tree, state));
}
return Description.NO_MATCH;
}
}

View File

@@ -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
@@ -219,7 +220,10 @@ public final class LexicographicalAnnotationAttributeListing extends BugChecker
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<String> excludedAnnotations(ErrorProneFlags flags) {

View File

@@ -46,6 +46,7 @@ import tech.picnic.errorprone.bugpatterns.util.SourceCode;
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.

View File

@@ -1,94 +0,0 @@
package tech.picnic.errorprone.bugpatterns;
import static com.google.errorprone.BugPattern.LinkType.CUSTOM;
import static com.google.errorprone.BugPattern.SeverityLevel.ERROR;
import static com.google.errorprone.BugPattern.StandardTags.LIKELY_ERROR;
import static com.google.errorprone.matchers.ChildMultiMatcher.MatchType.AT_LEAST_ONE;
import static com.google.errorprone.matchers.Matchers.annotations;
import static com.google.errorprone.matchers.Matchers.hasAnnotation;
import static com.google.errorprone.matchers.Matchers.isType;
import static tech.picnic.errorprone.bugpatterns.util.Documentation.BUG_PATTERNS_BASE_URL;
import com.google.auto.common.AnnotationMirrors;
import com.google.auto.service.AutoService;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.errorprone.BugPattern;
import com.google.errorprone.VisitorState;
import com.google.errorprone.bugpatterns.BugChecker;
import com.google.errorprone.bugpatterns.BugChecker.MethodTreeMatcher;
import com.google.errorprone.fixes.SuggestedFix;
import com.google.errorprone.fixes.SuggestedFixes;
import com.google.errorprone.matchers.Description;
import com.google.errorprone.matchers.Matcher;
import com.google.errorprone.matchers.MultiMatcher;
import com.google.errorprone.util.ASTHelpers;
import com.sun.source.tree.AnnotationTree;
import com.sun.source.tree.MethodTree;
import com.sun.source.tree.Tree;
import tech.picnic.errorprone.bugpatterns.util.ThirdPartyLibrary;
/**
* A {@link BugChecker} that flags methods with Spring's {@code @Scheduled} annotation that lack New
* Relic Agent's {@code @Trace(dispatcher = true)}.
*/
@AutoService(BugChecker.class)
@BugPattern(
summary = "Scheduled operation must start a new New Relic transaction",
link = BUG_PATTERNS_BASE_URL + "ScheduledTransactionTrace",
linkType = CUSTOM,
severity = ERROR,
tags = LIKELY_ERROR)
public final class ScheduledTransactionTrace extends BugChecker implements MethodTreeMatcher {
private static final long serialVersionUID = 1L;
private static final String TRACE_ANNOTATION_FQCN = "com.newrelic.api.agent.Trace";
private static final Matcher<Tree> IS_SCHEDULED =
hasAnnotation("org.springframework.scheduling.annotation.Scheduled");
private static final MultiMatcher<Tree, AnnotationTree> 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 (!ThirdPartyLibrary.NEW_RELIC_AGENT_API.isIntroductionAllowed(state)
|| !IS_SCHEDULED.matches(tree, state)) {
return Description.NO_MATCH;
}
ImmutableList<AnnotationTree> traceAnnotations =
TRACE_ANNOTATION.multiMatchResult(tree, state).matchingNodes();
if (traceAnnotations.isEmpty()) {
/* This method completely lacks the `@Trace` annotation; add it. */
return describeMatch(
tree,
SuggestedFix.builder()
.addImport(TRACE_ANNOTATION_FQCN)
.prefixWith(tree, "@Trace(dispatcher = true)")
.build());
}
AnnotationTree traceAnnotation = Iterables.getOnlyElement(traceAnnotations);
if (isCorrectAnnotation(traceAnnotation)) {
return Description.NO_MATCH;
}
/*
* The `@Trace` annotation is present but does not specify `dispatcher = true`. Add or update
* the `dispatcher` annotation element.
*/
return describeMatch(
traceAnnotation,
SuggestedFixes.updateAnnotationArgumentValues(
traceAnnotation, state, "dispatcher", ImmutableList.of("true"))
.build());
}
private static boolean isCorrectAnnotation(AnnotationTree traceAnnotation) {
return Boolean.TRUE.equals(
AnnotationMirrors.getAnnotationValue(
ASTHelpers.getAnnotationMirror(traceAnnotation), "dispatcher")
.getValue());
}
}

View File

@@ -16,10 +16,7 @@ public final class Flags {
* provided, or if the flag's value is the empty string.
*/
public static ImmutableList<String> getList(ErrorProneFlags errorProneFlags, String name) {
return errorProneFlags
.getList(name)
.map(ImmutableList::copyOf)
.filter(flags -> !flags.equals(ImmutableList.of("")))
.orElseGet(ImmutableList::of);
ImmutableList<String> list = errorProneFlags.getListOrEmpty(name);
return list.equals(ImmutableList.of("")) ? ImmutableList.of() : list;
}
}

View File

@@ -17,6 +17,7 @@ public final class JavaKeywords {
*/
private static final ImmutableSet<String> 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<String> ALL_KEYWORDS =
Sets.union(RESERVED_KEYWORDS, CONTEXTUAL_KEYWORDS).immutableCopy();

View File

@@ -18,6 +18,7 @@ import java.util.regex.Pattern;
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. */)

View File

@@ -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<MethodTree, AnnotationTree> 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.
*/

View File

@@ -32,13 +32,6 @@ public enum ThirdPartyLibrary {
* @see <a href="https://github.com/google/guava">Guava on GitHub</a>
*/
GUAVA("com.google.common.collect.ImmutableList"),
/**
* New Relic's Java agent API.
*
* @see <a href="https://github.com/newrelic/newrelic-java-agent/tree/main/newrelic-api">New Relic
* Java agent API on GitHub</a>
*/
NEW_RELIC_AGENT_API("com.newrelic.api.agent.Agent"),
/**
* VMWare's Project Reactor.
*

View File

@@ -103,8 +103,7 @@ final class AssortedRules {
}
@AfterTemplate
@Nullable
T after(Iterator<T> iterator, T defaultValue) {
@Nullable T after(Iterator<T> iterator, T defaultValue) {
return Iterators.getNext(iterator, defaultValue);
}
}

View File

@@ -23,6 +23,7 @@ final class JUnitRules {
}
@AfterTemplate
@SuppressWarnings("JUnitSingleArguments" /* The bugpattern does not understand Repeated. */)
@UseImportPolicy(STATIC_IMPORT_ALWAYS)
Arguments after(@Repeated T objects) {
return arguments(objects);

View File

@@ -33,14 +33,12 @@ final class MapRules {
static final class MapGetOrNull<K, V, T> {
@BeforeTemplate
@Nullable
V before(Map<K, V> map, T key) {
@Nullable V before(Map<K, V> map, T key) {
return map.getOrDefault(key, null);
}
@AfterTemplate
@Nullable
V after(Map<K, V> map, T key) {
@Nullable V after(Map<K, V> map, T key) {
return map.get(key);
}
}

View File

@@ -50,8 +50,7 @@ final class MultimapRules {
*/
static final class MultimapGet<K, V> {
@BeforeTemplate
@Nullable
Collection<V> before(Multimap<K, V> multimap, K key) {
@Nullable Collection<V> before(Multimap<K, V> multimap, K key) {
return Refaster.anyOf(multimap.asMap(), Multimaps.asMap(multimap)).get(key);
}

View File

@@ -0,0 +1,30 @@
package tech.picnic.errorprone.bugpatterns;
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;
final class JUnitSingleArgumentsTest {
@Test
void identification() {
CompilationTestHelper.newInstance(JUnitSingleArguments.class, getClass())
.addSourceLines(
"A.java",
"import static java.util.Objects.requireNonNull;",
"import static java.util.function.Function.identity;",
"import static org.junit.jupiter.params.provider.Arguments.arguments;",
"",
"class A {",
" void m() {",
" // BUG: Diagnostic contains:",
" arguments();",
" // BUG: Diagnostic contains:",
" arguments(1);",
" arguments(1, 2);",
"",
" identity();",
" requireNonNull(null);",
" }",
"}")
.doTest();
}
}

View File

@@ -1,105 +0,0 @@
package tech.picnic.errorprone.bugpatterns;
import com.google.errorprone.BugCheckerRefactoringTestHelper;
import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;
import com.google.errorprone.CompilationTestHelper;
import org.junit.jupiter.api.Test;
import org.springframework.scheduling.annotation.Scheduled;
final class ScheduledTransactionTraceTest {
@Test
void identification() {
CompilationTestHelper.newInstance(ScheduledTransactionTrace.class, getClass())
.addSourceLines(
"A.java",
"import com.newrelic.api.agent.Trace;",
"import org.springframework.scheduling.annotation.Scheduled;",
"",
"class A {",
" void notScheduled() {}",
"",
" @Scheduled(fixedDelay = 1)",
" // BUG: Diagnostic contains:",
" void scheduledButNotTraced() {}",
"",
" @Scheduled(fixedDelay = 1)",
" // BUG: Diagnostic contains:",
" @Trace",
" void scheduledButImproperlyTraced1() {}",
"",
" @Scheduled(fixedDelay = 1)",
" // BUG: Diagnostic contains:",
" @Trace(dispatcher = false)",
" void scheduledButImproperlyTraced2() {}",
"",
" @Scheduled(fixedDelay = 1)",
" @Trace(dispatcher = true)",
" void scheduledAndProperlyTraced() {}",
"}")
.doTest();
}
@Test
void identificationWithoutNewRelicAgentApiOnClasspath() {
CompilationTestHelper.newInstance(ScheduledTransactionTrace.class, getClass())
.withClasspath(Scheduled.class)
.addSourceLines(
"A.java",
"import org.springframework.scheduling.annotation.Scheduled;",
"",
"class A {",
" @Scheduled(fixedDelay = 1)",
" void scheduledButNotTraced() {}",
"}")
.doTest();
}
@Test
void replacement() {
BugCheckerRefactoringTestHelper.newInstance(ScheduledTransactionTrace.class, getClass())
.addInputLines(
"A.java",
"import com.newrelic.api.agent.Trace;",
"import org.springframework.scheduling.annotation.Scheduled;",
"",
"class A {",
" @Scheduled(fixedDelay = 1)",
" void scheduledButNotTraced() {}",
"",
" @Scheduled(fixedDelay = 1)",
" @Trace",
" void scheduledButImproperlyTraced1() {}",
"",
" @Scheduled(fixedDelay = 1)",
" @Trace(dispatcher = false)",
" void scheduledButImproperlyTraced2() {}",
"",
" @Scheduled(fixedDelay = 1)",
" @Trace(leaf = true)",
" void scheduledButImproperlyTraced3() {}",
"}")
.addOutputLines(
"A.java",
"import com.newrelic.api.agent.Trace;",
"import org.springframework.scheduling.annotation.Scheduled;",
"",
"class A {",
" @Trace(dispatcher = true)",
" @Scheduled(fixedDelay = 1)",
" void scheduledButNotTraced() {}",
"",
" @Scheduled(fixedDelay = 1)",
" @Trace(dispatcher = true)",
" void scheduledButImproperlyTraced1() {}",
"",
" @Scheduled(fixedDelay = 1)",
" @Trace(dispatcher = true)",
" void scheduledButImproperlyTraced2() {}",
"",
" @Scheduled(fixedDelay = 1)",
" @Trace(dispatcher = true, leaf = true)",
" void scheduledButImproperlyTraced3() {}",
"}")
.doTest(TestMode.TEXT_MATCH);
}
}

View File

@@ -2,7 +2,6 @@ package tech.picnic.errorprone.bugpatterns.util;
import static com.google.errorprone.BugPattern.SeverityLevel.SUGGESTION;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.params.provider.Arguments.arguments;
import com.google.common.collect.ImmutableList;
import com.google.errorprone.BugPattern;
@@ -17,7 +16,6 @@ import com.sun.source.tree.MethodInvocationTree;
import java.util.stream.Stream;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
final class MethodMatcherFactoryTest {
@@ -29,13 +27,13 @@ final class MethodMatcherFactoryTest {
"com.example.A#m2(java.lang.String)",
"com.example.sub.B#m3(int,int)"));
private static Stream<Arguments> createWithMalformedSignaturesTestCases() {
private static Stream<ImmutableList<String>> createWithMalformedSignaturesTestCases() {
/* { signatures } */
return Stream.of(
arguments(ImmutableList.of("foo.bar")),
arguments(ImmutableList.of("foo.bar#baz")),
arguments(ImmutableList.of("a", "foo.bar#baz()")),
arguments(ImmutableList.of("foo.bar#baz()", "a")));
ImmutableList.of("foo.bar"),
ImmutableList.of("foo.bar#baz"),
ImmutableList.of("a", "foo.bar#baz()"),
ImmutableList.of("foo.bar#baz()", "a"));
}
@MethodSource("createWithMalformedSignaturesTestCases")

View File

@@ -23,7 +23,7 @@ final class ThirdPartyLibraryTest {
CompilationTestHelper.newInstance(TestChecker.class, getClass())
.addSourceLines(
"A.java",
"// BUG: Diagnostic contains: ASSERTJ: true, GUAVA: true, NEW_RELIC_AGENT_API: true, REACTOR: true",
"// BUG: Diagnostic contains: ASSERTJ: true, GUAVA: true, REACTOR: true",
"class A {}")
.doTest();
}
@@ -34,16 +34,14 @@ final class ThirdPartyLibraryTest {
.addSourceLines(
"A.java",
"import com.google.common.collect.ImmutableList;",
"import com.newrelic.api.agent.Agent;",
"import org.assertj.core.api.Assertions;",
"import reactor.core.publisher.Flux;",
"",
"// BUG: Diagnostic contains: ASSERTJ: true, GUAVA: true, NEW_RELIC_AGENT_API: true, REACTOR: true",
"// BUG: Diagnostic contains: ASSERTJ: true, GUAVA: true, REACTOR: true",
"class A {",
" void m(Class<?> clazz) {",
" m(Assertions.class);",
" m(ImmutableList.class);",
" m(Agent.class);",
" m(Flux.class);",
" }",
"}")
@@ -56,7 +54,7 @@ final class ThirdPartyLibraryTest {
.withClasspath(ImmutableList.class, Flux.class)
.addSourceLines(
"A.java",
"// BUG: Diagnostic contains: ASSERTJ: false, GUAVA: true, NEW_RELIC_AGENT_API: false, REACTOR: true",
"// BUG: Diagnostic contains: ASSERTJ: false, GUAVA: true, REACTOR: true",
"class A {}")
.doTest();
}
@@ -67,7 +65,7 @@ final class ThirdPartyLibraryTest {
.withClasspath()
.addSourceLines(
"A.java",
"// BUG: Diagnostic contains: ASSERTJ: false, GUAVA: false, NEW_RELIC_AGENT_API: false, REACTOR:",
"// BUG: Diagnostic contains: ASSERTJ: false, GUAVA: false, REACTOR:",
"// false",
"class A {}")
.doTest();
@@ -82,8 +80,8 @@ final class ThirdPartyLibraryTest {
.addSourceLines(
"A.java",
String.format(
"// BUG: Diagnostic contains: ASSERTJ: %s, GUAVA: true, NEW_RELIC_AGENT_API: %s, REACTOR: true",
ignoreClassPath, ignoreClassPath),
"// BUG: Diagnostic contains: ASSERTJ: %s, GUAVA: true, REACTOR: true",
ignoreClassPath),
"class A {}")
.doTest();
}

61
pom.xml
View File

@@ -4,7 +4,7 @@
<groupId>tech.picnic.error-prone-support</groupId>
<artifactId>error-prone-support</artifactId>
<version>0.13.1-SNAPSHOT</version>
<version>0.14.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Picnic :: Error Prone Support</name>
@@ -141,7 +141,7 @@
<groupId.error-prone>com.google.errorprone</groupId.error-prone>
<!-- The build timestamp is derived from the most recent commit
timestamp in support of reproducible builds. -->
<project.build.outputTimestamp>2023-08-28T16:22:11Z</project.build.outputTimestamp>
<project.build.outputTimestamp>2023-10-04T14:40:37Z</project.build.outputTimestamp>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Glob pattern identifying Refaster rule definition files. These
Java classes don't contain "regular" code, and thus require special
@@ -198,17 +198,17 @@
one place. We use these to keep dependencies in sync. Version numbers
that need to be referenced only once should *not* be listed here. -->
<version.auto-service>1.1.1</version.auto-service>
<version.auto-value>1.10.3</version.auto-value>
<version.auto-value>1.10.4</version.auto-value>
<version.error-prone>${version.error-prone-orig}</version.error-prone>
<version.error-prone-fork>v${version.error-prone-orig}-picnic-1</version.error-prone-fork>
<version.error-prone-orig>2.21.1</version.error-prone-orig>
<version.error-prone-orig>2.22.0</version.error-prone-orig>
<version.error-prone-slf4j>0.1.20</version.error-prone-slf4j>
<version.guava-beta-checker>1.0</version.guava-beta-checker>
<version.jdk>11</version.jdk>
<version.maven>3.8.7</version.maven>
<version.mockito>5.5.0</version.mockito>
<version.nopen-checker>1.0.1</version.nopen-checker>
<version.nullaway>0.10.12</version.nullaway>
<version.nullaway>0.10.14</version.nullaway>
<version.pitest-git>1.1.2</version.pitest-git>
<version.surefire>3.1.2</version.surefire>
</properties>
@@ -295,7 +295,7 @@
<dependency>
<groupId>com.google.googlejavaformat</groupId>
<artifactId>google-java-format</artifactId>
<version>1.17.0</version>
<version>1.18.0</version>
</dependency>
<!-- Specified as a workaround for
https://github.com/mojohaus/versions-maven-plugin/issues/244. -->
@@ -323,11 +323,6 @@
<artifactId>nopen-checker</artifactId>
<version>${version.nopen-checker}</version>
</dependency>
<dependency>
<groupId>com.newrelic.agent.java</groupId>
<artifactId>newrelic-api</artifactId>
<version>8.5.0</version>
</dependency>
<!-- Specified as a workaround for
https://github.com/mojohaus/versions-maven-plugin/issues/244. -->
<dependency>
@@ -338,7 +333,7 @@
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-bom</artifactId>
<version>2022.0.10</version>
<version>2022.0.11</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@@ -355,7 +350,7 @@
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.2.15</version>
<version>2.2.16</version>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
@@ -387,7 +382,7 @@
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.14.7</version>
<version>1.14.8</version>
</dependency>
<!-- Specified so that Renovate will file Maven upgrade PRs, which
subsequently will cause `maven-enforcer-plugin` to require that
@@ -400,7 +395,7 @@
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.9.20</version>
<version>1.9.20.1</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
@@ -412,7 +407,7 @@
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
<version>3.37.0</version>
<version>3.39.0</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
@@ -458,20 +453,22 @@
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.7</version>
<artifactId>slf4j-bom</artifactId>
<version>2.0.9</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>5.3.29</version>
<version>5.3.30</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<version>2.7.15</version>
<version>2.7.16</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
@@ -524,7 +521,7 @@
<plugin>
<groupId>com.spotify.fmt</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>2.20</version>
<version>2.21.1</version>
<configuration>
<additionalSourceDirectories>
<additionalSourceDirectory>${basedir}/src/test/resources</additionalSourceDirectory>
@@ -536,7 +533,7 @@
<plugin>
<groupId>de.thetaphi</groupId>
<artifactId>forbiddenapis</artifactId>
<version>3.5.1</version>
<version>3.6</version>
<configuration>
<bundledSignatures>
<bundledSignature>jdk-internal</bundledSignature>
@@ -719,13 +716,13 @@
<!-- Instead, please use
`org.jspecify.annotations.Nullable`. -->
</property>
<property name="illegalPkgs" value="autovalue.shaded" />
<property name="illegalPkgs" value="com.amazonaws.annotation" />
<property name="illegalPkgs" value="com.beust.jcommander.internal" />
<property name="illegalPkgs" value="com.google.api.client.repackaged" />
<property name="illegalPkgs" value="com.google.common.cache">
<!-- Instead, please use Caffeine. -->
</property>
<property name="illegalPkgs" value="com.newrelic.agent.deps" />
<property name="illegalPkgs" value="com.tngtech.archunit.thirdparty" />
<property name="illegalPkgs" value="jdk" />
<property name="illegalPkgs" value="jersey.repackaged" />
@@ -852,7 +849,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.12.3</version>
<version>10.12.4</version>
</dependency>
<dependency>
<groupId>io.spring.nohttp</groupId>
@@ -976,7 +973,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.4.0</version>
<version>3.4.1</version>
<configuration>
<fail>false</fail>
<rules>
@@ -1115,7 +1112,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.5.0</version>
<version>3.6.0</version>
<configuration>
<additionalJOptions>
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</additionalJOption>
@@ -1309,7 +1306,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.16.0</version>
<version>2.16.1</version>
<configuration>
<updateBuildOutputTimestampPolicy>never</updateBuildOutputTimestampPolicy>
</configuration>
@@ -1317,7 +1314,7 @@
<plugin>
<groupId>org.gaul</groupId>
<artifactId>modernizer-maven-plugin</artifactId>
<version>2.6.0</version>
<version>2.7.0</version>
<configuration>
<exclusionPatterns>
<!-- The plugin suggests replacing usages of
@@ -1360,7 +1357,7 @@
<plugin>
<groupId>org.pitest</groupId>
<artifactId>pitest-maven</artifactId>
<version>1.14.4</version>
<version>1.15.0</version>
<configuration>
<excludedClasses>
<!-- AutoValue generated classes. -->
@@ -1389,7 +1386,7 @@
<dependency>
<groupId>com.groupcdg.arcmutate</groupId>
<artifactId>base</artifactId>
<version>1.1.3</version>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>com.groupcdg.pitest</groupId>
@@ -1414,7 +1411,7 @@
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.9.1.2184</version>
<version>3.10.0.2594</version>
</plugin>
</plugins>
</pluginManagement>
@@ -1736,8 +1733,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

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>tech.picnic.error-prone-support</groupId>
<artifactId>error-prone-support</artifactId>
<version>0.13.1-SNAPSHOT</version>
<version>0.14.1-SNAPSHOT</version>
</parent>
<artifactId>refaster-compiler</artifactId>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>tech.picnic.error-prone-support</groupId>
<artifactId>error-prone-support</artifactId>
<version>0.13.1-SNAPSHOT</version>
<version>0.14.1-SNAPSHOT</version>
</parent>
<artifactId>refaster-runner</artifactId>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>tech.picnic.error-prone-support</groupId>
<artifactId>error-prone-support</artifactId>
<version>0.13.1-SNAPSHOT</version>
<version>0.14.1-SNAPSHOT</version>
</parent>
<artifactId>refaster-support</artifactId>

View File

@@ -23,6 +23,7 @@ public @interface OnlineDocumentation {
* 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.

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>tech.picnic.error-prone-support</groupId>
<artifactId>error-prone-support</artifactId>
<version>0.13.1-SNAPSHOT</version>
<version>0.14.1-SNAPSHOT</version>
</parent>
<artifactId>refaster-test-support</artifactId>

View File

@@ -42,7 +42,6 @@ import java.util.ArrayList;
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 @@ public final class RefasterRuleCollection extends BugChecker implements Compilat
for (Description description : matches) {
String ruleName = extractRefasterRuleName(description);
Set<Replacement> replacements =
ImmutableSet<Replacement> replacements =
Iterables.getOnlyElement(description.fixes).getReplacements(endPositions);
for (Replacement replacement : replacements) {
ruleMatches.put(replacement.range(), ruleName);