mirror of
https://github.com/jlengrand/error-prone-support.git
synced 2026-03-10 08:11:25 +00:00
Compare commits
104 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
411066bedb | ||
|
|
bedf588e2a | ||
|
|
3a629b11ec | ||
|
|
fc2eb57b40 | ||
|
|
1c429f0d1c | ||
|
|
ac6ffc72e9 | ||
|
|
07399bb4ef | ||
|
|
aa988ef2b0 | ||
|
|
b58be2b89b | ||
|
|
8fa90f6121 | ||
|
|
6ba03c6352 | ||
|
|
912e06885d | ||
|
|
e803a5d333 | ||
|
|
4a1ad1b991 | ||
|
|
80d433f051 | ||
|
|
afd9703ce6 | ||
|
|
f9d310bc4b | ||
|
|
a3a9ca0bf0 | ||
|
|
0e609aeb1c | ||
|
|
e9dae1d66c | ||
|
|
f0ad9d21e6 | ||
|
|
7138aa2100 | ||
|
|
de4667628f | ||
|
|
5e958fe20b | ||
|
|
baa921caac | ||
|
|
ba040bd191 | ||
|
|
a3a20b52e5 | ||
|
|
5d8d27176b | ||
|
|
d878a57a8e | ||
|
|
eaec12f460 | ||
|
|
da7dafb6e7 | ||
|
|
5a7aaf12d6 | ||
|
|
92e4d74e4b | ||
|
|
4a0bc0c210 | ||
|
|
53152499d6 | ||
|
|
61d92fb33f | ||
|
|
8690f49c35 | ||
|
|
d808f664ec | ||
|
|
7f5f4820e9 | ||
|
|
f7a4427852 | ||
|
|
0e956bcd44 | ||
|
|
5395fc60e1 | ||
|
|
d8cae04a98 | ||
|
|
7b14711ecf | ||
|
|
c3351b9ee1 | ||
|
|
40b3c87b72 | ||
|
|
726db5ce5b | ||
|
|
99d359c548 | ||
|
|
4744113411 | ||
|
|
ae8f940f55 | ||
|
|
8d7633df2d | ||
|
|
4a351cfbe3 | ||
|
|
bb01447760 | ||
|
|
f12ed17b96 | ||
|
|
854e05f044 | ||
|
|
82c22682c0 | ||
|
|
25b3817876 | ||
|
|
e2a2b086ad | ||
|
|
5f9a0c5e17 | ||
|
|
2a0ae0af13 | ||
|
|
7a051146b6 | ||
|
|
d9398001cb | ||
|
|
0be99cb12a | ||
|
|
70e2d3d43f | ||
|
|
441258f9f2 | ||
|
|
b96efb533c | ||
|
|
5af067cc23 | ||
|
|
0c84665e38 | ||
|
|
9316d81fe3 | ||
|
|
ec96c044d5 | ||
|
|
ae4ed9273f | ||
|
|
0ec882e62e | ||
|
|
fef9ba23f4 | ||
|
|
3bd415b910 | ||
|
|
2128624261 | ||
|
|
c53fcace76 | ||
|
|
ff3759984c | ||
|
|
6358d1e2e1 | ||
|
|
db53631e76 | ||
|
|
86b2d929ab | ||
|
|
0db4462a64 | ||
|
|
f8667fc655 | ||
|
|
d91f94e879 | ||
|
|
ad6c8593f2 | ||
|
|
873ee47e8d | ||
|
|
fed281dc2b | ||
|
|
277d30467d | ||
|
|
064e0bbc8c | ||
|
|
3beadeec50 | ||
|
|
c2a26ed12f | ||
|
|
2419dad433 | ||
|
|
900d6eaf78 | ||
|
|
33d205e11f | ||
|
|
ee0651d9d3 | ||
|
|
fb22039fd3 | ||
|
|
cf294b8964 | ||
|
|
0004c8bc44 | ||
|
|
aedeeb0943 | ||
|
|
a68e5ae150 | ||
|
|
6a6354eb55 | ||
|
|
ab0a844f26 | ||
|
|
5105cb684f | ||
|
|
f128a7975f | ||
|
|
e572a3641d |
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
|||||||
continue-on-error: ${{ matrix.experimental }}
|
continue-on-error: ${{ matrix.experimental }}
|
||||||
steps:
|
steps:
|
||||||
- name: Install Harden-Runner
|
- name: Install Harden-Runner
|
||||||
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
|
uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1
|
||||||
with:
|
with:
|
||||||
disable-sudo: true
|
disable-sudo: true
|
||||||
egress-policy: block
|
egress-policy: block
|
||||||
|
|||||||
6
.github/workflows/codeql.yml
vendored
6
.github/workflows/codeql.yml
vendored
@@ -22,7 +22,7 @@ jobs:
|
|||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Install Harden-Runner
|
- name: Install Harden-Runner
|
||||||
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
|
uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1
|
||||||
with:
|
with:
|
||||||
disable-sudo: true
|
disable-sudo: true
|
||||||
egress-policy: block
|
egress-policy: block
|
||||||
@@ -40,13 +40,13 @@ jobs:
|
|||||||
java-distribution: temurin
|
java-distribution: temurin
|
||||||
maven-version: 3.9.9
|
maven-version: 3.9.9
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # v3.28.5
|
uses: github/codeql-action/init@5f8171a638ada777af81d42b55959a643bb29017 # v3.28.12
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
- name: Perform minimal build
|
- name: Perform minimal build
|
||||||
if: matrix.language == 'java'
|
if: matrix.language == 'java'
|
||||||
run: mvn -T1C clean package -DskipTests -Dverification.skip
|
run: mvn -T1C clean package -DskipTests -Dverification.skip
|
||||||
- name: Perform CodeQL analysis
|
- name: Perform CodeQL analysis
|
||||||
uses: github/codeql-action/analyze@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # v3.28.5
|
uses: github/codeql-action/analyze@5f8171a638ada777af81d42b55959a643bb29017 # v3.28.12
|
||||||
with:
|
with:
|
||||||
category: /language:${{ matrix.language }}
|
category: /language:${{ matrix.language }}
|
||||||
|
|||||||
6
.github/workflows/deploy-website.yml
vendored
6
.github/workflows/deploy-website.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
|||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Install Harden-Runner
|
- name: Install Harden-Runner
|
||||||
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
|
uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1
|
||||||
with:
|
with:
|
||||||
disable-sudo: true
|
disable-sudo: true
|
||||||
egress-policy: block
|
egress-policy: block
|
||||||
@@ -43,7 +43,7 @@ jobs:
|
|||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- uses: ruby/setup-ruby@28c4deda893d5a96a6b2d958c5b47fc18d65c9d3 # v1.213.0
|
- uses: ruby/setup-ruby@1a615958ad9d422dd932dc1d5823942ee002799f # v1.227.0
|
||||||
with:
|
with:
|
||||||
working-directory: ./website
|
working-directory: ./website
|
||||||
bundler-cache: true
|
bundler-cache: true
|
||||||
@@ -75,7 +75,7 @@ jobs:
|
|||||||
url: ${{ steps.deployment.outputs.page_url }}
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
steps:
|
steps:
|
||||||
- name: Install Harden-Runner
|
- name: Install Harden-Runner
|
||||||
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
|
uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1
|
||||||
with:
|
with:
|
||||||
disable-sudo: true
|
disable-sudo: true
|
||||||
egress-policy: block
|
egress-policy: block
|
||||||
|
|||||||
6
.github/workflows/openssf-scorecard.yml
vendored
6
.github/workflows/openssf-scorecard.yml
vendored
@@ -21,7 +21,7 @@ jobs:
|
|||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Install Harden-Runner
|
- name: Install Harden-Runner
|
||||||
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
|
uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1
|
||||||
with:
|
with:
|
||||||
disable-sudo: true
|
disable-sudo: true
|
||||||
egress-policy: block
|
egress-policy: block
|
||||||
@@ -42,12 +42,12 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- name: Run OpenSSF Scorecard analysis
|
- name: Run OpenSSF Scorecard analysis
|
||||||
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
|
uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
|
||||||
with:
|
with:
|
||||||
results_file: results.sarif
|
results_file: results.sarif
|
||||||
results_format: sarif
|
results_format: sarif
|
||||||
publish_results: ${{ github.ref == 'refs/heads/master' }}
|
publish_results: ${{ github.ref == 'refs/heads/master' }}
|
||||||
- name: Update GitHub's code scanning dashboard
|
- name: Update GitHub's code scanning dashboard
|
||||||
uses: github/codeql-action/upload-sarif@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # v3.28.5
|
uses: github/codeql-action/upload-sarif@5f8171a638ada777af81d42b55959a643bb29017 # v3.28.12
|
||||||
with:
|
with:
|
||||||
sarif_file: results.sarif
|
sarif_file: results.sarif
|
||||||
|
|||||||
4
.github/workflows/pitest-analyze-pr.yml
vendored
4
.github/workflows/pitest-analyze-pr.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
|||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Install Harden-Runner
|
- name: Install Harden-Runner
|
||||||
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
|
uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1
|
||||||
with:
|
with:
|
||||||
disable-sudo: true
|
disable-sudo: true
|
||||||
egress-policy: block
|
egress-policy: block
|
||||||
@@ -38,7 +38,7 @@ jobs:
|
|||||||
- name: Aggregate Pitest reports
|
- 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)."
|
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
|
- name: Upload Pitest reports as artifact
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||||
with:
|
with:
|
||||||
name: pitest-reports
|
name: pitest-reports
|
||||||
path: ./target/pit-reports-ci
|
path: ./target/pit-reports-ci
|
||||||
|
|||||||
2
.github/workflows/pitest-update-pr.yml
vendored
2
.github/workflows/pitest-update-pr.yml
vendored
@@ -20,7 +20,7 @@ jobs:
|
|||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Install Harden-Runner
|
- name: Install Harden-Runner
|
||||||
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
|
uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1
|
||||||
with:
|
with:
|
||||||
disable-sudo: true
|
disable-sudo: true
|
||||||
egress-policy: block
|
egress-policy: block
|
||||||
|
|||||||
10
.github/workflows/run-integration-tests.yml
vendored
10
.github/workflows/run-integration-tests.yml
vendored
@@ -22,14 +22,14 @@ jobs:
|
|||||||
integration-test: [ "checkstyle", "metrics", "prometheus-java-client" ]
|
integration-test: [ "checkstyle", "metrics", "prometheus-java-client" ]
|
||||||
steps:
|
steps:
|
||||||
- name: Install Harden-Runner
|
- name: Install Harden-Runner
|
||||||
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
|
uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1
|
||||||
with:
|
with:
|
||||||
disable-sudo: true
|
disable-sudo: true
|
||||||
egress-policy: block
|
egress-policy: block
|
||||||
|
# XXX: After updating the validation build flags in
|
||||||
|
# `integration-tests/prometheus-java-client.sh`, review whether the
|
||||||
|
# Docker domains specified here can be dropped.
|
||||||
allowed-endpoints: >
|
allowed-endpoints: >
|
||||||
# XXX: After updating the validation build flags in
|
|
||||||
# `integration-tests/prometheus-java-client.sh`, review whether the
|
|
||||||
# Docker domains specified here can be dropped.
|
|
||||||
api.adoptium.net:443
|
api.adoptium.net:443
|
||||||
auth.docker.io:443
|
auth.docker.io:443
|
||||||
checkstyle.org:443
|
checkstyle.org:443
|
||||||
@@ -55,7 +55,7 @@ jobs:
|
|||||||
run: xvfb-run "./integration-tests/${{ matrix.integration-test }}.sh" "${{ runner.temp }}/artifacts"
|
run: xvfb-run "./integration-tests/${{ matrix.integration-test }}.sh" "${{ runner.temp }}/artifacts"
|
||||||
- name: Upload artifacts on failure
|
- name: Upload artifacts on failure
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||||
with:
|
with:
|
||||||
name: "integration-test-${{ matrix.integration-test }}"
|
name: "integration-test-${{ matrix.integration-test }}"
|
||||||
path: "${{ runner.temp }}/artifacts"
|
path: "${{ runner.temp }}/artifacts"
|
||||||
|
|||||||
2
.github/workflows/sonarcloud.yml
vendored
2
.github/workflows/sonarcloud.yml
vendored
@@ -19,7 +19,7 @@ jobs:
|
|||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Install Harden-Runner
|
- name: Install Harden-Runner
|
||||||
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
|
uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1
|
||||||
with:
|
with:
|
||||||
disable-sudo: true
|
disable-sudo: true
|
||||||
egress-policy: block
|
egress-policy: block
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>tech.picnic.error-prone-support</groupId>
|
<groupId>tech.picnic.error-prone-support</groupId>
|
||||||
<artifactId>error-prone-support</artifactId>
|
<artifactId>error-prone-support</artifactId>
|
||||||
<version>0.20.0</version>
|
<version>0.22.1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>documentation-support</artifactId>
|
<artifactId>documentation-support</artifactId>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package tech.picnic.errorprone.documentation;
|
|||||||
|
|
||||||
import static com.google.errorprone.matchers.Matchers.instanceMethod;
|
import static com.google.errorprone.matchers.Matchers.instanceMethod;
|
||||||
import static com.google.errorprone.matchers.method.MethodMatchers.staticMethod;
|
import static com.google.errorprone.matchers.method.MethodMatchers.staticMethod;
|
||||||
|
import static java.util.Objects.requireNonNull;
|
||||||
import static java.util.function.Predicate.not;
|
import static java.util.function.Predicate.not;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
@@ -167,7 +168,10 @@ public final class BugPatternTestExtractor implements Extractor<BugPatternTestCa
|
|||||||
* is safe, because this code is guarded by an earlier call to `#getClassUnderTest(..)`,
|
* is safe, because this code is guarded by an earlier call to `#getClassUnderTest(..)`,
|
||||||
* which ensures that `tree` is part of a longer method invocation chain.
|
* which ensures that `tree` is part of a longer method invocation chain.
|
||||||
*/
|
*/
|
||||||
MethodInvocationTree inputTree = (MethodInvocationTree) ASTHelpers.getReceiver(tree);
|
MethodInvocationTree inputTree =
|
||||||
|
(MethodInvocationTree)
|
||||||
|
requireNonNull(
|
||||||
|
ASTHelpers.getReceiver(tree), "Instance method invocation must have receiver");
|
||||||
|
|
||||||
String path = ASTHelpers.constValue(inputTree.getArguments().get(0), String.class);
|
String path = ASTHelpers.constValue(inputTree.getArguments().get(0), String.class);
|
||||||
Optional<String> inputCode = getSourceCode(inputTree);
|
Optional<String> inputCode = getSourceCode(inputTree);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>tech.picnic.error-prone-support</groupId>
|
<groupId>tech.picnic.error-prone-support</groupId>
|
||||||
<artifactId>error-prone-support</artifactId>
|
<artifactId>error-prone-support</artifactId>
|
||||||
<version>0.20.0</version>
|
<version>0.22.1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>error-prone-contrib</artifactId>
|
<artifactId>error-prone-contrib</artifactId>
|
||||||
@@ -62,6 +62,16 @@
|
|||||||
<artifactId>auto-value-annotations</artifactId>
|
<artifactId>auto-value-annotations</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- XXX: JSR-305 (meta-)annotation usage by some dependencies triggers
|
||||||
|
NullAway to attempt to load said annotations. As such some modules
|
||||||
|
require these annotations to be on the classpath. Periodically review
|
||||||
|
whether we can drop this dependeny declaration. See
|
||||||
|
https://github.com/uber/NullAway/issues/1171. -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.code.findbugs</groupId>
|
||||||
|
<artifactId>jsr305</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.errorprone</groupId>
|
<groupId>com.google.errorprone</groupId>
|
||||||
<artifactId>error_prone_annotation</artifactId>
|
<artifactId>error_prone_annotation</artifactId>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import static com.google.errorprone.matchers.Matchers.not;
|
|||||||
import static com.google.errorprone.matchers.Matchers.returnStatement;
|
import static com.google.errorprone.matchers.Matchers.returnStatement;
|
||||||
import static com.google.errorprone.matchers.Matchers.staticMethod;
|
import static com.google.errorprone.matchers.Matchers.staticMethod;
|
||||||
import static com.google.errorprone.matchers.Matchers.toType;
|
import static com.google.errorprone.matchers.Matchers.toType;
|
||||||
|
import static java.util.Objects.requireNonNull;
|
||||||
import static tech.picnic.errorprone.utils.Documentation.BUG_PATTERNS_BASE_URL;
|
import static tech.picnic.errorprone.utils.Documentation.BUG_PATTERNS_BASE_URL;
|
||||||
|
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
@@ -79,7 +80,10 @@ public final class DirectReturn extends BugChecker implements BlockTreeMatcher {
|
|||||||
return Description.NO_MATCH;
|
return Description.NO_MATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
Symbol variableSymbol = ASTHelpers.getSymbol(((ReturnTree) finalStatement).getExpression());
|
Symbol variableSymbol =
|
||||||
|
requireNonNull(
|
||||||
|
ASTHelpers.getSymbol(((ReturnTree) finalStatement).getExpression()),
|
||||||
|
"Missing symbol for returned variable");
|
||||||
StatementTree precedingStatement = statements.get(statements.size() - 2);
|
StatementTree precedingStatement = statements.get(statements.size() - 2);
|
||||||
|
|
||||||
return tryMatchAssignment(variableSymbol, precedingStatement)
|
return tryMatchAssignment(variableSymbol, precedingStatement)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import com.google.common.collect.ImmutableList;
|
|||||||
import com.google.common.collect.ImmutableMultiset;
|
import com.google.common.collect.ImmutableMultiset;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.ImmutableTable;
|
import com.google.common.collect.ImmutableTable;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.errorprone.BugPattern;
|
import com.google.errorprone.BugPattern;
|
||||||
import com.google.errorprone.VisitorState;
|
import com.google.errorprone.VisitorState;
|
||||||
import com.google.errorprone.bugpatterns.BugChecker;
|
import com.google.errorprone.bugpatterns.BugChecker;
|
||||||
@@ -33,6 +34,8 @@ import com.sun.source.tree.MethodInvocationTree;
|
|||||||
import com.sun.source.tree.MethodTree;
|
import com.sun.source.tree.MethodTree;
|
||||||
import com.sun.tools.javac.code.Symbol.MethodSymbol;
|
import com.sun.tools.javac.code.Symbol.MethodSymbol;
|
||||||
import com.sun.tools.javac.code.Symbol.VarSymbol;
|
import com.sun.tools.javac.code.Symbol.VarSymbol;
|
||||||
|
import com.sun.tools.javac.code.Type;
|
||||||
|
import com.sun.tools.javac.code.Types;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -178,30 +181,45 @@ public final class ExplicitArgumentEnumeration extends BugChecker
|
|||||||
state.getTypes())
|
state.getTypes())
|
||||||
.collect(toImmutableList());
|
.collect(toImmutableList());
|
||||||
|
|
||||||
/*
|
return hasLikelySuitableVarargsOverload(method, overloads, state)
|
||||||
* If all overloads have a single parameter, and at least one of them is a varargs method, then
|
|
||||||
* we assume that unwrapping the iterable argument will cause a suitable overload to be invoked.
|
|
||||||
* (Note that there may be multiple varargs overloads, either with different parameter types, or
|
|
||||||
* due to method overriding; this check does not attempt to determine which exact method or
|
|
||||||
* overload will be invoked as a result of the suggested simplification.)
|
|
||||||
*
|
|
||||||
* Note that this is a (highly!) imperfect heuristic, but it is sufficient to prevent e.g.
|
|
||||||
* unwrapping of arguments to `org.jooq.impl.DSL#row`, which can cause the expression's return
|
|
||||||
* type to change from `RowN` to (e.g.) `Row2`.
|
|
||||||
*/
|
|
||||||
// XXX: There are certainly cases where it _would_ be nice to unwrap the arguments to
|
|
||||||
// `org.jooq.impl.DSL#row(Collection<?>)`. Look into this.
|
|
||||||
// XXX: Ideally we do check that one of the overloads accepts the unwrapped arguments.
|
|
||||||
// XXX: Ideally we validate that eligible overloads have compatible return types.
|
|
||||||
boolean hasLikelySuitableVarargsOverload =
|
|
||||||
overloads.stream().allMatch(m -> m.params().size() == 1)
|
|
||||||
&& overloads.stream().anyMatch(MethodSymbol::isVarArgs);
|
|
||||||
|
|
||||||
return hasLikelySuitableVarargsOverload
|
|
||||||
? Optional.of(SourceCode.unwrapMethodInvocation(argument, state))
|
? Optional.of(SourceCode.unwrapMethodInvocation(argument, state))
|
||||||
: Optional.empty();
|
: Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tells whether it is likely that, if the argument to the given method is unwrapped, a suitable
|
||||||
|
* varargs overload will be invoked instead.
|
||||||
|
*
|
||||||
|
* <p>If all overloads have a single parameter, and at least one of them is a suitably-typed
|
||||||
|
* varargs method, then we assume that unwrapping the iterable argument will cause a suitable
|
||||||
|
* overload to be invoked. (Note that there may be multiple varargs overloads due to method
|
||||||
|
* overriding; this check does not attempt to determine which exact method or overload will be
|
||||||
|
* invoked as a result of the suggested simplification.)
|
||||||
|
*
|
||||||
|
* <p>Note that this is a (highly!) imperfect heuristic, but it is sufficient to prevent e.g.
|
||||||
|
* unwrapping of arguments to `org.jooq.impl.DSL#row`, which can cause the expression's return
|
||||||
|
* type to change from `RowN` to (e.g.) `Row2`.
|
||||||
|
*/
|
||||||
|
// XXX: There are certainly cases where it _would_ be nice to unwrap the arguments to
|
||||||
|
// `org.jooq.impl.DSL#row(Collection<?>)`. Look into this.
|
||||||
|
// XXX: Ideally we validate that eligible overloads have compatible return types.
|
||||||
|
private static boolean hasLikelySuitableVarargsOverload(
|
||||||
|
MethodSymbol method, ImmutableList<MethodSymbol> overloads, VisitorState state) {
|
||||||
|
Types types = state.getTypes();
|
||||||
|
// XXX: This logic is fragile, as it assumes that the method parameter's type is of the form
|
||||||
|
// `X<T>`, where `T` is the type of the explicitly enumerated values passed to the expression to
|
||||||
|
// be unwrapped. This should generally hold, given the types returned by the
|
||||||
|
// `EXPLICIT_ITERABLE_CREATOR` expressions: `Iterable<T>`, `List<T>`, `Set<T>`, etc.
|
||||||
|
Type parameterType =
|
||||||
|
Iterables.getOnlyElement(
|
||||||
|
Iterables.getOnlyElement(method.getParameters()).type.getTypeArguments());
|
||||||
|
return overloads.stream().allMatch(m -> m.params().size() == 1)
|
||||||
|
&& overloads.stream()
|
||||||
|
.filter(MethodSymbol::isVarArgs)
|
||||||
|
.map(m -> types.elemtype(Iterables.getOnlyElement(m.getParameters()).type))
|
||||||
|
.anyMatch(varArgsType -> types.containsType(parameterType, varArgsType));
|
||||||
|
}
|
||||||
|
|
||||||
private static Optional<SuggestedFix> trySuggestCallingCustomAlternative(
|
private static Optional<SuggestedFix> trySuggestCallingCustomAlternative(
|
||||||
MethodInvocationTree tree, MethodInvocationTree argument, VisitorState state) {
|
MethodInvocationTree tree, MethodInvocationTree argument, VisitorState state) {
|
||||||
return ALTERNATIVE_METHODS.rowMap().entrySet().stream()
|
return ALTERNATIVE_METHODS.rowMap().entrySet().stream()
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import static com.google.errorprone.matchers.Matchers.isSameType;
|
|||||||
import static com.google.errorprone.matchers.Matchers.methodHasParameters;
|
import static com.google.errorprone.matchers.Matchers.methodHasParameters;
|
||||||
import static com.google.errorprone.matchers.Matchers.staticMethod;
|
import static com.google.errorprone.matchers.Matchers.staticMethod;
|
||||||
import static com.google.errorprone.matchers.Matchers.toType;
|
import static com.google.errorprone.matchers.Matchers.toType;
|
||||||
|
import static java.util.Objects.requireNonNull;
|
||||||
import static java.util.function.Predicate.not;
|
import static java.util.function.Predicate.not;
|
||||||
import static java.util.stream.Collectors.joining;
|
import static java.util.stream.Collectors.joining;
|
||||||
import static tech.picnic.errorprone.utils.Documentation.BUG_PATTERNS_BASE_URL;
|
import static tech.picnic.errorprone.utils.Documentation.BUG_PATTERNS_BASE_URL;
|
||||||
@@ -129,7 +130,10 @@ public final class JUnitValueSource extends BugChecker implements MethodTreeMatc
|
|||||||
return Description.NO_MATCH;
|
return Description.NO_MATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
Type parameterType = ASTHelpers.getType(Iterables.getOnlyElement(tree.getParameters()));
|
Type parameterType =
|
||||||
|
requireNonNull(
|
||||||
|
ASTHelpers.getType(Iterables.getOnlyElement(tree.getParameters())),
|
||||||
|
"Missing type for method parameter");
|
||||||
|
|
||||||
return findMethodSourceAnnotation(tree, state)
|
return findMethodSourceAnnotation(tree, state)
|
||||||
.flatMap(
|
.flatMap(
|
||||||
@@ -173,7 +177,9 @@ public final class JUnitValueSource extends BugChecker implements MethodTreeMatc
|
|||||||
|
|
||||||
private static Optional<MethodTree> findMatchingSibling(
|
private static Optional<MethodTree> findMatchingSibling(
|
||||||
MethodTree tree, Predicate<? super MethodTree> predicate, VisitorState state) {
|
MethodTree tree, Predicate<? super MethodTree> predicate, VisitorState state) {
|
||||||
return state.findEnclosing(ClassTree.class).getMembers().stream()
|
return requireNonNull(state.findEnclosing(ClassTree.class), "No class enclosing method")
|
||||||
|
.getMembers()
|
||||||
|
.stream()
|
||||||
.filter(MethodTree.class::isInstance)
|
.filter(MethodTree.class::isInstance)
|
||||||
.map(MethodTree.class::cast)
|
.map(MethodTree.class::cast)
|
||||||
.filter(not(tree::equals))
|
.filter(not(tree::equals))
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import static com.google.errorprone.BugPattern.SeverityLevel.WARNING;
|
|||||||
import static com.google.errorprone.BugPattern.StandardTags.SIMPLIFICATION;
|
import static com.google.errorprone.BugPattern.StandardTags.SIMPLIFICATION;
|
||||||
import static com.google.errorprone.matchers.Matchers.anyOf;
|
import static com.google.errorprone.matchers.Matchers.anyOf;
|
||||||
import static com.google.errorprone.matchers.Matchers.instanceMethod;
|
import static com.google.errorprone.matchers.Matchers.instanceMethod;
|
||||||
|
import static java.util.Objects.requireNonNull;
|
||||||
import static tech.picnic.errorprone.utils.Documentation.BUG_PATTERNS_BASE_URL;
|
import static tech.picnic.errorprone.utils.Documentation.BUG_PATTERNS_BASE_URL;
|
||||||
|
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
@@ -86,7 +87,9 @@ public final class NonEmptyMono extends BugChecker implements MethodInvocationTr
|
|||||||
return Description.NO_MATCH;
|
return Description.NO_MATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExpressionTree receiver = ASTHelpers.getReceiver(tree);
|
ExpressionTree receiver =
|
||||||
|
requireNonNull(
|
||||||
|
ASTHelpers.getReceiver(tree), "Instance method invocation must have receiver");
|
||||||
if (!NON_EMPTY_MONO.matches(receiver, state)) {
|
if (!NON_EMPTY_MONO.matches(receiver, state)) {
|
||||||
return Description.NO_MATCH;
|
return Description.NO_MATCH;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -204,6 +204,11 @@ final class AssertJEnumerableRules {
|
|||||||
return enumAssert.hasSize(iterable.length);
|
return enumAssert.hasSize(iterable.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@BeforeTemplate
|
||||||
|
EnumerableAssert<?, S> before(EnumerableAssert<?, S> enumAssert, CharSequence iterable) {
|
||||||
|
return enumAssert.hasSize(iterable.length());
|
||||||
|
}
|
||||||
|
|
||||||
@AfterTemplate
|
@AfterTemplate
|
||||||
EnumerableAssert<?, S> after(EnumerableAssert<?, S> enumAssert, Iterable<E> iterable) {
|
EnumerableAssert<?, S> after(EnumerableAssert<?, S> enumAssert, Iterable<E> iterable) {
|
||||||
return enumAssert.hasSameSizeAs(iterable);
|
return enumAssert.hasSameSizeAs(iterable);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
|
|||||||
|
|
||||||
import com.google.errorprone.refaster.Refaster;
|
import com.google.errorprone.refaster.Refaster;
|
||||||
import com.google.errorprone.refaster.annotation.AfterTemplate;
|
import com.google.errorprone.refaster.annotation.AfterTemplate;
|
||||||
|
import com.google.errorprone.refaster.annotation.AlsoNegation;
|
||||||
import com.google.errorprone.refaster.annotation.BeforeTemplate;
|
import com.google.errorprone.refaster.annotation.BeforeTemplate;
|
||||||
import com.google.errorprone.refaster.annotation.Repeated;
|
import com.google.errorprone.refaster.annotation.Repeated;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -11,6 +12,7 @@ import java.io.IOException;
|
|||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.LinkOption;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.nio.file.attribute.FileAttribute;
|
import java.nio.file.attribute.FileAttribute;
|
||||||
@@ -141,4 +143,35 @@ final class FileRules {
|
|||||||
return Files.createTempFile(directory.toPath(), prefix, suffix).toFile();
|
return Files.createTempFile(directory.toPath(), prefix, suffix).toFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoke {@link File#mkdirs()} before {@link Files#exists(Path, LinkOption...)} to avoid
|
||||||
|
* concurrency issues.
|
||||||
|
*/
|
||||||
|
static final class PathToFileMkDirsFilesExists {
|
||||||
|
@BeforeTemplate
|
||||||
|
boolean before(Path path) {
|
||||||
|
return Files.exists(path) || path.toFile().mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterTemplate
|
||||||
|
@AlsoNegation
|
||||||
|
boolean after(Path path) {
|
||||||
|
return path.toFile().mkdirs() || Files.exists(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Invoke {@link File#mkdirs()} before {@link File#exists()} to avoid concurrency issues. */
|
||||||
|
static final class FileMkDirsFileExists {
|
||||||
|
@BeforeTemplate
|
||||||
|
boolean before(File file) {
|
||||||
|
return file.exists() || file.mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterTemplate
|
||||||
|
@AlsoNegation
|
||||||
|
boolean after(File file) {
|
||||||
|
return file.mkdirs() || file.exists();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -282,6 +282,8 @@ final class OptionalRules {
|
|||||||
// XXX: The rewritten `filter`/`map` expression may be more performant than its replacement. See
|
// XXX: The rewritten `filter`/`map` expression may be more performant than its replacement. See
|
||||||
// https://github.com/palantir/gradle-baseline/pull/2946. (There are plans to pair Refaster rules
|
// https://github.com/palantir/gradle-baseline/pull/2946. (There are plans to pair Refaster rules
|
||||||
// with JMH benchmarks; this would be a great use case.)
|
// with JMH benchmarks; this would be a great use case.)
|
||||||
|
// XXX: Perhaps `stream.mapMulti(Optional::ifPresent)` is what we should use. See
|
||||||
|
// https://github.com/palantir/gradle-baseline/pull/2996.
|
||||||
static final class StreamFlatMapOptional<T> {
|
static final class StreamFlatMapOptional<T> {
|
||||||
@BeforeTemplate
|
@BeforeTemplate
|
||||||
Stream<T> before(Stream<Optional<T>> stream) {
|
Stream<T> before(Stream<Optional<T>> stream) {
|
||||||
|
|||||||
@@ -8,12 +8,15 @@ import com.google.common.primitives.Floats;
|
|||||||
import com.google.common.primitives.Ints;
|
import com.google.common.primitives.Ints;
|
||||||
import com.google.common.primitives.Longs;
|
import com.google.common.primitives.Longs;
|
||||||
import com.google.common.primitives.Shorts;
|
import com.google.common.primitives.Shorts;
|
||||||
|
import com.google.common.primitives.UnsignedBytes;
|
||||||
import com.google.common.primitives.UnsignedInts;
|
import com.google.common.primitives.UnsignedInts;
|
||||||
import com.google.common.primitives.UnsignedLongs;
|
import com.google.common.primitives.UnsignedLongs;
|
||||||
import com.google.errorprone.refaster.Refaster;
|
import com.google.errorprone.refaster.Refaster;
|
||||||
import com.google.errorprone.refaster.annotation.AfterTemplate;
|
import com.google.errorprone.refaster.annotation.AfterTemplate;
|
||||||
import com.google.errorprone.refaster.annotation.AlsoNegation;
|
import com.google.errorprone.refaster.annotation.AlsoNegation;
|
||||||
import com.google.errorprone.refaster.annotation.BeforeTemplate;
|
import com.google.errorprone.refaster.annotation.BeforeTemplate;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
import tech.picnic.errorprone.refaster.annotation.OnlineDocumentation;
|
import tech.picnic.errorprone.refaster.annotation.OnlineDocumentation;
|
||||||
|
|
||||||
/** Refaster rules related to expressions dealing with primitives. */
|
/** Refaster rules related to expressions dealing with primitives. */
|
||||||
@@ -525,10 +528,7 @@ final class PrimitiveRules {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Prefer JDK's {@link Integer#toUnsignedString(int,int)} over third-party alternatives. */
|
||||||
* Prefer JDK's {@link Integer#toUnsignedString(int,int)} over third-party or more verbose
|
|
||||||
* alternatives.
|
|
||||||
*/
|
|
||||||
static final class IntegerToUnsignedStringWithRadix {
|
static final class IntegerToUnsignedStringWithRadix {
|
||||||
@BeforeTemplate
|
@BeforeTemplate
|
||||||
String before(int i, int radix) {
|
String before(int i, int radix) {
|
||||||
@@ -541,10 +541,7 @@ final class PrimitiveRules {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Prefer JDK's {@link Long#toUnsignedString(long,int)} over third-party alternatives. */
|
||||||
* Prefer JDK's {@link Long#toUnsignedString(long,int)} over third-party or more verbose
|
|
||||||
* alternatives.
|
|
||||||
*/
|
|
||||||
static final class LongToUnsignedStringWithRadix {
|
static final class LongToUnsignedStringWithRadix {
|
||||||
@BeforeTemplate
|
@BeforeTemplate
|
||||||
String before(long i, int radix) {
|
String before(long i, int radix) {
|
||||||
@@ -556,4 +553,49 @@ final class PrimitiveRules {
|
|||||||
return Long.toUnsignedString(i, radix);
|
return Long.toUnsignedString(i, radix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Prefer JDK's {@link Arrays#compareUnsigned(byte[], byte[])} over third-party alternatives. */
|
||||||
|
// XXX: This rule will yield non-compilable code if the result of the replaced expression is
|
||||||
|
// dereferenced. Investigate how to make this safe.
|
||||||
|
static final class ArraysCompareUnsignedBytes {
|
||||||
|
@BeforeTemplate
|
||||||
|
Comparator<byte[]> before() {
|
||||||
|
return UnsignedBytes.lexicographicalComparator();
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterTemplate
|
||||||
|
Comparator<byte[]> after() {
|
||||||
|
return Arrays::compareUnsigned;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Prefer JDK's {@link Arrays#compareUnsigned(int[], int[])} over third-party alternatives. */
|
||||||
|
// XXX: This rule will yield non-compilable code if the result of the replaced expression is
|
||||||
|
// dereferenced. Investigate how to make this safe.
|
||||||
|
static final class ArraysCompareUnsignedInts {
|
||||||
|
@BeforeTemplate
|
||||||
|
Comparator<int[]> before() {
|
||||||
|
return UnsignedInts.lexicographicalComparator();
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterTemplate
|
||||||
|
Comparator<int[]> after() {
|
||||||
|
return Arrays::compareUnsigned;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Prefer JDK's {@link Arrays#compareUnsigned(long[], long[])} over third-party alternatives. */
|
||||||
|
// XXX: This rule will yield non-compilable code if the result of the replaced expression is
|
||||||
|
// dereferenced. Investigate how to make this safe.
|
||||||
|
static final class ArraysCompareUnsignedLongs {
|
||||||
|
@BeforeTemplate
|
||||||
|
Comparator<long[]> before() {
|
||||||
|
return UnsignedLongs.lexicographicalComparator();
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterTemplate
|
||||||
|
Comparator<long[]> after() {
|
||||||
|
return Arrays::compareUnsigned;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -489,9 +489,16 @@ final class ReactorRules {
|
|||||||
return Flux.range(value, 1);
|
return Flux.range(value, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XXX: Consider generalizing part of this template using an Error Prone check that covers any
|
||||||
|
// sequence of explicitly enumerated values passed to an iteration order-preserving collection
|
||||||
|
// factory method.
|
||||||
@BeforeTemplate
|
@BeforeTemplate
|
||||||
Flux<T> before(T value) {
|
Flux<T> before(T value) {
|
||||||
return Mono.just(value).repeat().take(1);
|
return Refaster.anyOf(
|
||||||
|
Mono.just(value).flux(),
|
||||||
|
Mono.just(value).repeat().take(1),
|
||||||
|
Flux.fromIterable(ImmutableList.of(value)),
|
||||||
|
Flux.fromIterable(ImmutableSet.of(value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterTemplate
|
@AfterTemplate
|
||||||
@@ -508,8 +515,14 @@ final class ReactorRules {
|
|||||||
mono.switchIfEmpty(Mono.empty()), mono.flux().next(), mono.flux().singleOrEmpty());
|
mono.switchIfEmpty(Mono.empty()), mono.flux().next(), mono.flux().singleOrEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XXX: Consider filing a SonarCloud issue for the S2637 false positive.
|
||||||
@BeforeTemplate
|
@BeforeTemplate
|
||||||
Mono<@Nullable Void> before2(Mono<@Nullable Void> mono) {
|
@SuppressWarnings({
|
||||||
|
"java:S2637" /* False positive: result is never `null`. */,
|
||||||
|
"java:S4968" /* Result may be `Mono<Void>`. */,
|
||||||
|
"key-to-resolve-AnnotationUseStyle-and-TrailingComment-check-conflict"
|
||||||
|
})
|
||||||
|
Mono<? extends @Nullable Void> before2(Mono<@Nullable Void> mono) {
|
||||||
return Refaster.anyOf(mono.ignoreElement(), mono.then());
|
return Refaster.anyOf(mono.ignoreElement(), mono.then());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -938,12 +951,18 @@ final class ReactorRules {
|
|||||||
/** Prefer direct invocation of {@link Mono#then()}} over more contrived alternatives. */
|
/** Prefer direct invocation of {@link Mono#then()}} over more contrived alternatives. */
|
||||||
static final class MonoThen<T> {
|
static final class MonoThen<T> {
|
||||||
@BeforeTemplate
|
@BeforeTemplate
|
||||||
Mono<@Nullable Void> before(Mono<T> mono) {
|
@SuppressWarnings("java:S4968" /* Result may be `Mono<Void>`. */)
|
||||||
return Refaster.anyOf(mono.ignoreElement().then(), mono.flux().then());
|
Mono<? extends @Nullable Void> before(Mono<T> mono) {
|
||||||
|
return Refaster.anyOf(
|
||||||
|
mono.ignoreElement().then(),
|
||||||
|
mono.flux().then(),
|
||||||
|
Mono.when(mono),
|
||||||
|
Mono.whenDelayError(mono));
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterTemplate
|
@AfterTemplate
|
||||||
Mono<@Nullable Void> after(Mono<T> mono) {
|
@SuppressWarnings("java:S4968" /* Result may be `Mono<Void>`. */)
|
||||||
|
Mono<? extends @Nullable Void> after(Mono<T> mono) {
|
||||||
return mono.then();
|
return mono.then();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -951,17 +970,25 @@ final class ReactorRules {
|
|||||||
/** Avoid vacuous invocations of {@link Flux#ignoreElements()}. */
|
/** Avoid vacuous invocations of {@link Flux#ignoreElements()}. */
|
||||||
static final class FluxThen<T> {
|
static final class FluxThen<T> {
|
||||||
@BeforeTemplate
|
@BeforeTemplate
|
||||||
Mono<@Nullable Void> before(Flux<T> flux) {
|
@SuppressWarnings("java:S4968" /* Result may be `Mono<Void>`. */)
|
||||||
|
Mono<? extends @Nullable Void> before(Flux<T> flux) {
|
||||||
return flux.ignoreElements().then();
|
return flux.ignoreElements().then();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XXX: Consider filing a SonarCloud issue for the S2637 false positive.
|
||||||
@BeforeTemplate
|
@BeforeTemplate
|
||||||
Mono<@Nullable Void> before2(Flux<@Nullable Void> flux) {
|
@SuppressWarnings({
|
||||||
|
"java:S2637" /* False positive: result is never `null`. */,
|
||||||
|
"java:S4968" /* Result may be `Mono<Void>`. */,
|
||||||
|
"key-to-resolve-AnnotationUseStyle-and-TrailingComment-check-conflict"
|
||||||
|
})
|
||||||
|
Mono<? extends @Nullable Void> before2(Flux<@Nullable Void> flux) {
|
||||||
return flux.ignoreElements();
|
return flux.ignoreElements();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterTemplate
|
@AfterTemplate
|
||||||
Mono<@Nullable Void> after(Flux<T> flux) {
|
@SuppressWarnings("java:S4968" /* Result may be `Mono<Void>`. */)
|
||||||
|
Mono<? extends @Nullable Void> after(Flux<T> flux) {
|
||||||
return flux.then();
|
return flux.then();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -969,12 +996,14 @@ final class ReactorRules {
|
|||||||
/** Avoid vacuous invocations of {@link Mono#ignoreElement()}. */
|
/** Avoid vacuous invocations of {@link Mono#ignoreElement()}. */
|
||||||
static final class MonoThenEmpty<T> {
|
static final class MonoThenEmpty<T> {
|
||||||
@BeforeTemplate
|
@BeforeTemplate
|
||||||
Mono<@Nullable Void> before(Mono<T> mono, Publisher<@Nullable Void> publisher) {
|
@SuppressWarnings("java:S4968" /* Result may be `Mono<Void>`. */)
|
||||||
|
Mono<? extends @Nullable Void> before(Mono<T> mono, Publisher<@Nullable Void> publisher) {
|
||||||
return mono.ignoreElement().thenEmpty(publisher);
|
return mono.ignoreElement().thenEmpty(publisher);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterTemplate
|
@AfterTemplate
|
||||||
Mono<@Nullable Void> after(Mono<T> mono, Publisher<@Nullable Void> publisher) {
|
@SuppressWarnings("java:S4968" /* Result may be `Mono<Void>`. */)
|
||||||
|
Mono<? extends @Nullable Void> after(Mono<T> mono, Publisher<@Nullable Void> publisher) {
|
||||||
return mono.thenEmpty(publisher);
|
return mono.thenEmpty(publisher);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -982,12 +1011,14 @@ final class ReactorRules {
|
|||||||
/** Avoid vacuous invocations of {@link Flux#ignoreElements()}. */
|
/** Avoid vacuous invocations of {@link Flux#ignoreElements()}. */
|
||||||
static final class FluxThenEmpty<T> {
|
static final class FluxThenEmpty<T> {
|
||||||
@BeforeTemplate
|
@BeforeTemplate
|
||||||
Mono<@Nullable Void> before(Flux<T> flux, Publisher<@Nullable Void> publisher) {
|
@SuppressWarnings("java:S4968" /* Result may be `Mono<Void>`. */)
|
||||||
|
Mono<? extends @Nullable Void> before(Flux<T> flux, Publisher<@Nullable Void> publisher) {
|
||||||
return flux.ignoreElements().thenEmpty(publisher);
|
return flux.ignoreElements().thenEmpty(publisher);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterTemplate
|
@AfterTemplate
|
||||||
Mono<@Nullable Void> after(Flux<T> flux, Publisher<@Nullable Void> publisher) {
|
@SuppressWarnings("java:S4968" /* Result may be `Mono<Void>`. */)
|
||||||
|
Mono<? extends @Nullable Void> after(Flux<T> flux, Publisher<@Nullable Void> publisher) {
|
||||||
return flux.thenEmpty(publisher);
|
return flux.thenEmpty(publisher);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1043,7 +1074,8 @@ final class ReactorRules {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@BeforeTemplate
|
@BeforeTemplate
|
||||||
Mono<@Nullable Void> before2(Mono<T> mono1, Mono<@Nullable Void> mono2) {
|
@SuppressWarnings("java:S4968" /* Result may be `Mono<Void>`. */)
|
||||||
|
Mono<? extends @Nullable Void> before2(Mono<T> mono1, Mono<@Nullable Void> mono2) {
|
||||||
return mono1.thenEmpty(mono2);
|
return mono1.thenEmpty(mono2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1061,7 +1093,8 @@ final class ReactorRules {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@BeforeTemplate
|
@BeforeTemplate
|
||||||
Mono<@Nullable Void> before2(Flux<T> flux, Mono<@Nullable Void> mono) {
|
@SuppressWarnings("java:S4968" /* Result may be `Mono<Void>`. */)
|
||||||
|
Mono<? extends @Nullable Void> before2(Flux<T> flux, Mono<@Nullable Void> mono) {
|
||||||
return flux.thenEmpty(mono);
|
return flux.thenEmpty(mono);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1078,10 +1111,12 @@ final class ReactorRules {
|
|||||||
// rule. Consider introducing an Error Prone check for this.
|
// rule. Consider introducing an Error Prone check for this.
|
||||||
static final class MonoSingleOptional<T> {
|
static final class MonoSingleOptional<T> {
|
||||||
@BeforeTemplate
|
@BeforeTemplate
|
||||||
Mono<Optional<T>> before(Mono<T> mono) {
|
Mono<Optional<T>> before(Mono<T> mono, Optional<T> optional, Mono<Optional<T>> alternate) {
|
||||||
return Refaster.anyOf(
|
return Refaster.anyOf(
|
||||||
mono.flux().collect(toOptional()),
|
mono.flux().collect(toOptional()),
|
||||||
mono.map(Optional::of).defaultIfEmpty(Optional.empty()),
|
mono.map(Optional::of),
|
||||||
|
mono.singleOptional().defaultIfEmpty(optional),
|
||||||
|
mono.singleOptional().switchIfEmpty(alternate),
|
||||||
mono.transform(Mono::singleOptional));
|
mono.transform(Mono::singleOptional));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2174,6 +2209,22 @@ final class ReactorRules {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Don't propagate {@link Mono} cancellations to upstream cache value computations, as completion
|
||||||
|
* of such computations may benefit concurrent or subsequent cache usages.
|
||||||
|
*/
|
||||||
|
static final class MonoFromFutureAsyncLoadingCacheGetAll<K1, K2 extends K1, V> {
|
||||||
|
@BeforeTemplate
|
||||||
|
Mono<Map<K1, V>> before(AsyncLoadingCache<K1, V> cache, Iterable<K2> keys) {
|
||||||
|
return Mono.fromFuture(() -> cache.getAll(keys));
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterTemplate
|
||||||
|
Mono<Map<K1, V>> after(AsyncLoadingCache<K1, V> cache, Iterable<K2> keys) {
|
||||||
|
return Mono.fromFuture(() -> cache.getAll(keys), /* suppressCancel= */ true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prefer {@link Flux#fromStream(Supplier)} over {@link Flux#fromStream(Stream)}, as the former
|
* Prefer {@link Flux#fromStream(Supplier)} over {@link Flux#fromStream(Stream)}, as the former
|
||||||
* yields a {@link Flux} that is more likely to behave as expected when subscribed to more than
|
* yields a {@link Flux} that is more likely to behave as expected when subscribed to more than
|
||||||
|
|||||||
@@ -23,14 +23,16 @@ final class RxJava2AdapterRules {
|
|||||||
/** Use the fluent API style when using {@link RxJava2Adapter#completableToMono}. */
|
/** Use the fluent API style when using {@link RxJava2Adapter#completableToMono}. */
|
||||||
static final class CompletableToMono {
|
static final class CompletableToMono {
|
||||||
@BeforeTemplate
|
@BeforeTemplate
|
||||||
Mono<@Nullable Void> before(Completable completable) {
|
@SuppressWarnings("java:S4968" /* Result may be `Mono<Void>`. */)
|
||||||
|
Mono<? extends @Nullable Void> before(Completable completable) {
|
||||||
return Refaster.anyOf(
|
return Refaster.anyOf(
|
||||||
RxJava2Adapter.completableToMono(completable),
|
RxJava2Adapter.completableToMono(completable),
|
||||||
completable.to(RxJava2Adapter::completableToMono));
|
completable.to(RxJava2Adapter::completableToMono));
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterTemplate
|
@AfterTemplate
|
||||||
Mono<@Nullable Void> after(Completable completable) {
|
@SuppressWarnings("java:S4968" /* Result may be `Mono<Void>`. */)
|
||||||
|
Mono<? extends @Nullable Void> after(Completable completable) {
|
||||||
return completable.as(RxJava2Adapter::completableToMono);
|
return completable.as(RxJava2Adapter::completableToMono);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package tech.picnic.errorprone.refasterrules;
|
package tech.picnic.errorprone.refasterrules;
|
||||||
|
|
||||||
|
import com.google.errorprone.VisitorState;
|
||||||
import com.google.errorprone.fixes.SuggestedFix;
|
import com.google.errorprone.fixes.SuggestedFix;
|
||||||
import com.google.errorprone.refaster.annotation.AfterTemplate;
|
import com.google.errorprone.refaster.annotation.AfterTemplate;
|
||||||
import com.google.errorprone.refaster.annotation.BeforeTemplate;
|
import com.google.errorprone.refaster.annotation.BeforeTemplate;
|
||||||
@@ -65,16 +66,18 @@ final class SuggestedFixRules {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Prefer {@link SuggestedFix#swap(Tree, Tree)} over more contrived alternatives. */
|
/**
|
||||||
|
* Prefer {@link SuggestedFix#swap(Tree, Tree, VisitorState)} over more contrived alternatives.
|
||||||
|
*/
|
||||||
static final class SuggestedFixSwap {
|
static final class SuggestedFixSwap {
|
||||||
@BeforeTemplate
|
@BeforeTemplate
|
||||||
SuggestedFix before(Tree tree1, Tree tree2) {
|
SuggestedFix before(Tree tree1, Tree tree2, VisitorState state) {
|
||||||
return SuggestedFix.builder().swap(tree1, tree2).build();
|
return SuggestedFix.builder().swap(tree1, tree2, state).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterTemplate
|
@AfterTemplate
|
||||||
SuggestedFix after(Tree tree1, Tree tree2) {
|
SuggestedFix after(Tree tree1, Tree tree2, VisitorState state) {
|
||||||
return SuggestedFix.swap(tree1, tree2);
|
return SuggestedFix.swap(tree1, tree2, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ import tech.picnic.errorprone.refaster.annotation.TypeMigration;
|
|||||||
*/
|
*/
|
||||||
"assertEqualsDeep(Map<?, ?>, Map<?, ?>)",
|
"assertEqualsDeep(Map<?, ?>, Map<?, ?>)",
|
||||||
"assertEqualsDeep(Map<?, ?>, Map<?, ?>, String)",
|
"assertEqualsDeep(Map<?, ?>, Map<?, ?>, String)",
|
||||||
|
"assertEqualsDeep(Set<?>, Set<?>)",
|
||||||
"assertEqualsDeep(Set<?>, Set<?>, String)",
|
"assertEqualsDeep(Set<?>, Set<?>, String)",
|
||||||
// XXX: Add migrations for the methods below.
|
// XXX: Add migrations for the methods below.
|
||||||
"assertEqualsNoOrder(Collection<?>, Collection<?>)",
|
"assertEqualsNoOrder(Collection<?>, Collection<?>)",
|
||||||
@@ -299,6 +300,7 @@ final class TestNGToAssertJRules {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("java:S1448" /* Each variant requires a separate `@BeforeTemplate` method. */)
|
||||||
static final class AssertEqual {
|
static final class AssertEqual {
|
||||||
@BeforeTemplate
|
@BeforeTemplate
|
||||||
void before(boolean actual, boolean expected) {
|
void before(boolean actual, boolean expected) {
|
||||||
@@ -482,6 +484,7 @@ final class TestNGToAssertJRules {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("java:S1448" /* Each variant requires a separate `@BeforeTemplate` method. */)
|
||||||
static final class AssertEqualWithMessage {
|
static final class AssertEqualWithMessage {
|
||||||
@BeforeTemplate
|
@BeforeTemplate
|
||||||
void before(boolean actual, String message, boolean expected) {
|
void before(boolean actual, String message, boolean expected) {
|
||||||
@@ -588,6 +591,11 @@ final class TestNGToAssertJRules {
|
|||||||
assertEquals(actual, expected, message);
|
assertEquals(actual, expected, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@BeforeTemplate
|
||||||
|
void before(long actual, String message, Long expected) {
|
||||||
|
assertEquals(actual, expected, message);
|
||||||
|
}
|
||||||
|
|
||||||
@BeforeTemplate
|
@BeforeTemplate
|
||||||
void before(Long actual, String message, long expected) {
|
void before(Long actual, String message, long expected) {
|
||||||
assertEquals(actual, expected, message);
|
assertEquals(actual, expected, message);
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ final class ExplicitArgumentEnumerationTest {
|
|||||||
"import com.google.common.collect.ImmutableList;",
|
"import com.google.common.collect.ImmutableList;",
|
||||||
"import com.google.errorprone.CompilationTestHelper;",
|
"import com.google.errorprone.CompilationTestHelper;",
|
||||||
"import com.google.errorprone.bugpatterns.BugChecker;",
|
"import com.google.errorprone.bugpatterns.BugChecker;",
|
||||||
|
"import io.micrometer.core.instrument.Counter;",
|
||||||
|
"import io.micrometer.core.instrument.Tag;",
|
||||||
"import org.jooq.impl.DSL;",
|
"import org.jooq.impl.DSL;",
|
||||||
"import reactor.core.publisher.Flux;",
|
"import reactor.core.publisher.Flux;",
|
||||||
"import reactor.test.StepVerifier;",
|
"import reactor.test.StepVerifier;",
|
||||||
@@ -32,6 +34,8 @@ final class ExplicitArgumentEnumerationTest {
|
|||||||
"",
|
"",
|
||||||
" DSL.row(ImmutableList.of(1, 2));",
|
" DSL.row(ImmutableList.of(1, 2));",
|
||||||
"",
|
"",
|
||||||
|
" Counter.builder(\"foo\").tags(ImmutableList.of(Tag.of(\"bar\", \"baz\")));",
|
||||||
|
"",
|
||||||
" // BUG: Diagnostic contains:",
|
" // BUG: Diagnostic contains:",
|
||||||
" unaryMethod(ImmutableList.of(1, 2));",
|
" unaryMethod(ImmutableList.of(1, 2));",
|
||||||
" unaryMethodWithLessVisibleOverload(ImmutableList.of(1, 2));",
|
" unaryMethodWithLessVisibleOverload(ImmutableList.of(1, 2));",
|
||||||
|
|||||||
@@ -67,10 +67,11 @@ final class AssertJEnumerableRulesTest implements RefasterRuleCollectionTestCase
|
|||||||
assertThat(ImmutableSet.of(4)).size().isBetween(5, 6));
|
assertThat(ImmutableSet.of(4)).size().isBetween(5, 6));
|
||||||
}
|
}
|
||||||
|
|
||||||
ImmutableSet<EnumerableAssert<?, Integer>> testEnumerableAssertHasSameSizeAs() {
|
ImmutableSet<EnumerableAssert<?, Character>> testEnumerableAssertHasSameSizeAs() {
|
||||||
return ImmutableSet.of(
|
return ImmutableSet.of(
|
||||||
assertThat(ImmutableSet.of(1)).hasSize(Iterables.size(ImmutableSet.of(2))),
|
assertThat("foo").hasSize(Iterables.size(ImmutableSet.of(1))),
|
||||||
assertThat(ImmutableSet.of(3)).hasSize(ImmutableSet.of(4).size()),
|
assertThat("bar").hasSize(ImmutableSet.of(2).size()),
|
||||||
assertThat(ImmutableSet.of(5)).hasSize(new Integer[0].length));
|
assertThat("baz").hasSize(new Integer[0].length),
|
||||||
|
assertThat("qux").hasSize("quux".length()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,10 +66,11 @@ final class AssertJEnumerableRulesTest implements RefasterRuleCollectionTestCase
|
|||||||
assertThat(ImmutableSet.of(4)).hasSizeBetween(5, 6));
|
assertThat(ImmutableSet.of(4)).hasSizeBetween(5, 6));
|
||||||
}
|
}
|
||||||
|
|
||||||
ImmutableSet<EnumerableAssert<?, Integer>> testEnumerableAssertHasSameSizeAs() {
|
ImmutableSet<EnumerableAssert<?, Character>> testEnumerableAssertHasSameSizeAs() {
|
||||||
return ImmutableSet.of(
|
return ImmutableSet.of(
|
||||||
assertThat(ImmutableSet.of(1)).hasSameSizeAs(ImmutableSet.of(2)),
|
assertThat("foo").hasSameSizeAs(ImmutableSet.of(1)),
|
||||||
assertThat(ImmutableSet.of(3)).hasSameSizeAs(ImmutableSet.of(4)),
|
assertThat("bar").hasSameSizeAs(ImmutableSet.of(2)),
|
||||||
assertThat(ImmutableSet.of(5)).hasSameSizeAs(new Integer[0]));
|
assertThat("baz").hasSameSizeAs(new Integer[0]),
|
||||||
|
assertThat("qux").hasSameSizeAs("quux"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,4 +39,16 @@ final class FileRulesTest implements RefasterRuleCollectionTestCase {
|
|||||||
File testFilesCreateTempFileInCustomDirectoryToFile() throws IOException {
|
File testFilesCreateTempFileInCustomDirectoryToFile() throws IOException {
|
||||||
return File.createTempFile("foo", "bar", new File("baz"));
|
return File.createTempFile("foo", "bar", new File("baz"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImmutableSet<Boolean> testPathToFileMkDirsFilesExists() {
|
||||||
|
return ImmutableSet.of(
|
||||||
|
Files.exists(Path.of("foo")) || Path.of("foo").toFile().mkdirs(),
|
||||||
|
!Files.exists(Path.of("bar")) && !Path.of("bar").toFile().mkdirs());
|
||||||
|
}
|
||||||
|
|
||||||
|
ImmutableSet<Boolean> testFileMkDirsFileExists() {
|
||||||
|
return ImmutableSet.of(
|
||||||
|
new File("foo").exists() || new File("foo").mkdirs(),
|
||||||
|
!new File("bar").exists() && !new File("bar").mkdirs());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,4 +39,16 @@ final class FileRulesTest implements RefasterRuleCollectionTestCase {
|
|||||||
File testFilesCreateTempFileInCustomDirectoryToFile() throws IOException {
|
File testFilesCreateTempFileInCustomDirectoryToFile() throws IOException {
|
||||||
return Files.createTempFile(new File("baz").toPath(), "foo", "bar").toFile();
|
return Files.createTempFile(new File("baz").toPath(), "foo", "bar").toFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImmutableSet<Boolean> testPathToFileMkDirsFilesExists() {
|
||||||
|
return ImmutableSet.of(
|
||||||
|
Path.of("foo").toFile().mkdirs() || Files.exists(Path.of("foo")),
|
||||||
|
!Path.of("bar").toFile().mkdirs() && !Files.exists(Path.of("bar")));
|
||||||
|
}
|
||||||
|
|
||||||
|
ImmutableSet<Boolean> testFileMkDirsFileExists() {
|
||||||
|
return ImmutableSet.of(
|
||||||
|
new File("foo").mkdirs() || new File("foo").exists(),
|
||||||
|
!new File("bar").mkdirs() && !new File("bar").exists());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,10 @@ import com.google.common.primitives.Floats;
|
|||||||
import com.google.common.primitives.Ints;
|
import com.google.common.primitives.Ints;
|
||||||
import com.google.common.primitives.Longs;
|
import com.google.common.primitives.Longs;
|
||||||
import com.google.common.primitives.Shorts;
|
import com.google.common.primitives.Shorts;
|
||||||
|
import com.google.common.primitives.UnsignedBytes;
|
||||||
import com.google.common.primitives.UnsignedInts;
|
import com.google.common.primitives.UnsignedInts;
|
||||||
import com.google.common.primitives.UnsignedLongs;
|
import com.google.common.primitives.UnsignedLongs;
|
||||||
|
import java.util.Comparator;
|
||||||
import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
|
import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
|
||||||
|
|
||||||
final class PrimitiveRulesTest implements RefasterRuleCollectionTestCase {
|
final class PrimitiveRulesTest implements RefasterRuleCollectionTestCase {
|
||||||
@@ -25,6 +27,7 @@ final class PrimitiveRulesTest implements RefasterRuleCollectionTestCase {
|
|||||||
Ints.class,
|
Ints.class,
|
||||||
Longs.class,
|
Longs.class,
|
||||||
Shorts.class,
|
Shorts.class,
|
||||||
|
UnsignedBytes.class,
|
||||||
UnsignedInts.class,
|
UnsignedInts.class,
|
||||||
UnsignedLongs.class);
|
UnsignedLongs.class);
|
||||||
}
|
}
|
||||||
@@ -222,4 +225,16 @@ final class PrimitiveRulesTest implements RefasterRuleCollectionTestCase {
|
|||||||
String testLongToUnsignedStringWithRadix() {
|
String testLongToUnsignedStringWithRadix() {
|
||||||
return UnsignedLongs.toString(1, 2);
|
return UnsignedLongs.toString(1, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Comparator<byte[]> testArraysCompareUnsignedBytes() {
|
||||||
|
return UnsignedBytes.lexicographicalComparator();
|
||||||
|
}
|
||||||
|
|
||||||
|
Comparator<int[]> testArraysCompareUnsignedInts() {
|
||||||
|
return UnsignedInts.lexicographicalComparator();
|
||||||
|
}
|
||||||
|
|
||||||
|
Comparator<long[]> testArraysCompareUnsignedLongs() {
|
||||||
|
return UnsignedLongs.lexicographicalComparator();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,11 @@ import com.google.common.primitives.Floats;
|
|||||||
import com.google.common.primitives.Ints;
|
import com.google.common.primitives.Ints;
|
||||||
import com.google.common.primitives.Longs;
|
import com.google.common.primitives.Longs;
|
||||||
import com.google.common.primitives.Shorts;
|
import com.google.common.primitives.Shorts;
|
||||||
|
import com.google.common.primitives.UnsignedBytes;
|
||||||
import com.google.common.primitives.UnsignedInts;
|
import com.google.common.primitives.UnsignedInts;
|
||||||
import com.google.common.primitives.UnsignedLongs;
|
import com.google.common.primitives.UnsignedLongs;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
|
import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
|
||||||
|
|
||||||
final class PrimitiveRulesTest implements RefasterRuleCollectionTestCase {
|
final class PrimitiveRulesTest implements RefasterRuleCollectionTestCase {
|
||||||
@@ -25,6 +28,7 @@ final class PrimitiveRulesTest implements RefasterRuleCollectionTestCase {
|
|||||||
Ints.class,
|
Ints.class,
|
||||||
Longs.class,
|
Longs.class,
|
||||||
Shorts.class,
|
Shorts.class,
|
||||||
|
UnsignedBytes.class,
|
||||||
UnsignedInts.class,
|
UnsignedInts.class,
|
||||||
UnsignedLongs.class);
|
UnsignedLongs.class);
|
||||||
}
|
}
|
||||||
@@ -222,4 +226,16 @@ final class PrimitiveRulesTest implements RefasterRuleCollectionTestCase {
|
|||||||
String testLongToUnsignedStringWithRadix() {
|
String testLongToUnsignedStringWithRadix() {
|
||||||
return Long.toUnsignedString(1, 2);
|
return Long.toUnsignedString(1, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Comparator<byte[]> testArraysCompareUnsignedBytes() {
|
||||||
|
return Arrays::compareUnsigned;
|
||||||
|
}
|
||||||
|
|
||||||
|
Comparator<int[]> testArraysCompareUnsignedInts() {
|
||||||
|
return Arrays::compareUnsigned;
|
||||||
|
}
|
||||||
|
|
||||||
|
Comparator<long[]> testArraysCompareUnsignedLongs() {
|
||||||
|
return Arrays::compareUnsigned;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
@@ -187,7 +188,12 @@ final class ReactorRulesTest implements RefasterRuleCollectionTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImmutableSet<Flux<Integer>> testFluxJust() {
|
ImmutableSet<Flux<Integer>> testFluxJust() {
|
||||||
return ImmutableSet.of(Flux.range(0, 1), Mono.just(2).repeat().take(1));
|
return ImmutableSet.of(
|
||||||
|
Flux.range(0, 1),
|
||||||
|
Mono.just(2).flux(),
|
||||||
|
Mono.just(3).repeat().take(1),
|
||||||
|
Flux.fromIterable(ImmutableList.of(4)),
|
||||||
|
Flux.fromIterable(ImmutableSet.of(5)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ImmutableSet<Mono<?>> testMonoIdentity() {
|
ImmutableSet<Mono<?>> testMonoIdentity() {
|
||||||
@@ -341,7 +347,11 @@ final class ReactorRulesTest implements RefasterRuleCollectionTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImmutableSet<Mono<Void>> testMonoThen() {
|
ImmutableSet<Mono<Void>> testMonoThen() {
|
||||||
return ImmutableSet.of(Mono.just("foo").ignoreElement().then(), Mono.just("bar").flux().then());
|
return ImmutableSet.of(
|
||||||
|
Mono.just("foo").ignoreElement().then(),
|
||||||
|
Mono.just("bar").flux().then(),
|
||||||
|
Mono.when(Mono.just("baz")),
|
||||||
|
Mono.whenDelayError(Mono.just("qux")));
|
||||||
}
|
}
|
||||||
|
|
||||||
ImmutableSet<Mono<Void>> testFluxThen() {
|
ImmutableSet<Mono<Void>> testFluxThen() {
|
||||||
@@ -387,8 +397,10 @@ final class ReactorRulesTest implements RefasterRuleCollectionTestCase {
|
|||||||
ImmutableSet<Mono<Optional<String>>> testMonoSingleOptional() {
|
ImmutableSet<Mono<Optional<String>>> testMonoSingleOptional() {
|
||||||
return ImmutableSet.of(
|
return ImmutableSet.of(
|
||||||
Mono.just("foo").flux().collect(toOptional()),
|
Mono.just("foo").flux().collect(toOptional()),
|
||||||
Mono.just("bar").map(Optional::of).defaultIfEmpty(Optional.empty()),
|
Mono.just("bar").map(Optional::of),
|
||||||
Mono.just("baz").transform(Mono::singleOptional));
|
Mono.just("baz").singleOptional().defaultIfEmpty(Optional.empty()),
|
||||||
|
Mono.just("quux").singleOptional().switchIfEmpty(Mono.just(Optional.empty())),
|
||||||
|
Mono.just("quuz").transform(Mono::singleOptional));
|
||||||
}
|
}
|
||||||
|
|
||||||
Mono<Number> testMonoCast() {
|
Mono<Number> testMonoCast() {
|
||||||
@@ -745,6 +757,11 @@ final class ReactorRulesTest implements RefasterRuleCollectionTestCase {
|
|||||||
return Mono.fromFuture(() -> ((AsyncLoadingCache<Integer, String>) null).get(0));
|
return Mono.fromFuture(() -> ((AsyncLoadingCache<Integer, String>) null).get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Mono<Map<Integer, String>> testMonoFromFutureAsyncLoadingCacheGetAll() {
|
||||||
|
return Mono.fromFuture(
|
||||||
|
() -> ((AsyncLoadingCache<Integer, String>) null).getAll(ImmutableSet.of()));
|
||||||
|
}
|
||||||
|
|
||||||
Flux<Integer> testFluxFromStreamSupplier() {
|
Flux<Integer> testFluxFromStreamSupplier() {
|
||||||
return Flux.fromStream(Stream.of(1));
|
return Flux.fromStream(Stream.of(1));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
@@ -191,7 +192,7 @@ final class ReactorRulesTest implements RefasterRuleCollectionTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImmutableSet<Flux<Integer>> testFluxJust() {
|
ImmutableSet<Flux<Integer>> testFluxJust() {
|
||||||
return ImmutableSet.of(Flux.just(0), Flux.just(2));
|
return ImmutableSet.of(Flux.just(0), Flux.just(2), Flux.just(3), Flux.just(4), Flux.just(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
ImmutableSet<Mono<?>> testMonoIdentity() {
|
ImmutableSet<Mono<?>> testMonoIdentity() {
|
||||||
@@ -339,7 +340,11 @@ final class ReactorRulesTest implements RefasterRuleCollectionTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImmutableSet<Mono<Void>> testMonoThen() {
|
ImmutableSet<Mono<Void>> testMonoThen() {
|
||||||
return ImmutableSet.of(Mono.just("foo").then(), Mono.just("bar").then());
|
return ImmutableSet.of(
|
||||||
|
Mono.just("foo").then(),
|
||||||
|
Mono.just("bar").then(),
|
||||||
|
Mono.just("baz").then(),
|
||||||
|
Mono.just("qux").then());
|
||||||
}
|
}
|
||||||
|
|
||||||
ImmutableSet<Mono<Void>> testFluxThen() {
|
ImmutableSet<Mono<Void>> testFluxThen() {
|
||||||
@@ -383,7 +388,9 @@ final class ReactorRulesTest implements RefasterRuleCollectionTestCase {
|
|||||||
return ImmutableSet.of(
|
return ImmutableSet.of(
|
||||||
Mono.just("foo").singleOptional(),
|
Mono.just("foo").singleOptional(),
|
||||||
Mono.just("bar").singleOptional(),
|
Mono.just("bar").singleOptional(),
|
||||||
Mono.just("baz").singleOptional());
|
Mono.just("baz").singleOptional(),
|
||||||
|
Mono.just("quux").singleOptional(),
|
||||||
|
Mono.just("quuz").singleOptional());
|
||||||
}
|
}
|
||||||
|
|
||||||
Mono<Number> testMonoCast() {
|
Mono<Number> testMonoCast() {
|
||||||
@@ -719,6 +726,11 @@ final class ReactorRulesTest implements RefasterRuleCollectionTestCase {
|
|||||||
return Mono.fromFuture(() -> ((AsyncLoadingCache<Integer, String>) null).get(0), true);
|
return Mono.fromFuture(() -> ((AsyncLoadingCache<Integer, String>) null).get(0), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Mono<Map<Integer, String>> testMonoFromFutureAsyncLoadingCacheGetAll() {
|
||||||
|
return Mono.fromFuture(
|
||||||
|
() -> ((AsyncLoadingCache<Integer, String>) null).getAll(ImmutableSet.of()), true);
|
||||||
|
}
|
||||||
|
|
||||||
Flux<Integer> testFluxFromStreamSupplier() {
|
Flux<Integer> testFluxFromStreamSupplier() {
|
||||||
return Flux.fromStream(() -> Stream.of(1));
|
return Flux.fromStream(() -> Stream.of(1));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package tech.picnic.errorprone.refasterrules;
|
package tech.picnic.errorprone.refasterrules;
|
||||||
|
|
||||||
|
import com.google.errorprone.VisitorState;
|
||||||
import com.google.errorprone.fixes.SuggestedFix;
|
import com.google.errorprone.fixes.SuggestedFix;
|
||||||
import com.sun.source.tree.ExpressionTree;
|
import com.sun.source.tree.ExpressionTree;
|
||||||
import com.sun.source.tree.Tree;
|
import com.sun.source.tree.Tree;
|
||||||
@@ -23,7 +24,9 @@ final class SuggestedFixRulesTest implements RefasterRuleCollectionTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SuggestedFix testSuggestedFixSwap() {
|
SuggestedFix testSuggestedFixSwap() {
|
||||||
return SuggestedFix.builder().swap((Tree) null, (ExpressionTree) null).build();
|
return SuggestedFix.builder()
|
||||||
|
.swap((Tree) null, (ExpressionTree) null, (VisitorState) null)
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
SuggestedFix testSuggestedFixPrefixWith() {
|
SuggestedFix testSuggestedFixPrefixWith() {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package tech.picnic.errorprone.refasterrules;
|
package tech.picnic.errorprone.refasterrules;
|
||||||
|
|
||||||
|
import com.google.errorprone.VisitorState;
|
||||||
import com.google.errorprone.fixes.SuggestedFix;
|
import com.google.errorprone.fixes.SuggestedFix;
|
||||||
import com.sun.source.tree.ExpressionTree;
|
import com.sun.source.tree.ExpressionTree;
|
||||||
import com.sun.source.tree.Tree;
|
import com.sun.source.tree.Tree;
|
||||||
@@ -23,7 +24,7 @@ final class SuggestedFixRulesTest implements RefasterRuleCollectionTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SuggestedFix testSuggestedFixSwap() {
|
SuggestedFix testSuggestedFixSwap() {
|
||||||
return SuggestedFix.swap((Tree) null, (ExpressionTree) null);
|
return SuggestedFix.swap((Tree) null, (ExpressionTree) null, (VisitorState) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
SuggestedFix testSuggestedFixPrefixWith() {
|
SuggestedFix testSuggestedFixPrefixWith() {
|
||||||
|
|||||||
@@ -155,8 +155,7 @@ final class TestNGToAssertJRulesTest implements RefasterRuleCollectionTestCase {
|
|||||||
assertEquals(Integer.valueOf(0), 1, "corge");
|
assertEquals(Integer.valueOf(0), 1, "corge");
|
||||||
assertEquals(Integer.valueOf(0), Integer.valueOf(1), "grault");
|
assertEquals(Integer.valueOf(0), Integer.valueOf(1), "grault");
|
||||||
assertEquals(0L, 1L, "garply");
|
assertEquals(0L, 1L, "garply");
|
||||||
// XXX: Ambiguous method call, as the relevant overload is missing. See testng-team/testng#3199.
|
assertEquals(0L, Long.valueOf(1), "waldo");
|
||||||
// assertEquals(0L, Long.valueOf(1), "waldo");
|
|
||||||
assertEquals(Long.valueOf(0), 1L, "fred");
|
assertEquals(Long.valueOf(0), 1L, "fred");
|
||||||
assertEquals(Long.valueOf(0), Long.valueOf(1), "plugh");
|
assertEquals(Long.valueOf(0), Long.valueOf(1), "plugh");
|
||||||
assertEquals(0.0F, 1.0F, "xyzzy");
|
assertEquals(0.0F, 1.0F, "xyzzy");
|
||||||
|
|||||||
@@ -160,8 +160,7 @@ final class TestNGToAssertJRulesTest implements RefasterRuleCollectionTestCase {
|
|||||||
assertThat(Integer.valueOf(0)).withFailMessage("corge").isEqualTo(1);
|
assertThat(Integer.valueOf(0)).withFailMessage("corge").isEqualTo(1);
|
||||||
assertThat(Integer.valueOf(0)).withFailMessage("grault").isEqualTo(Integer.valueOf(1));
|
assertThat(Integer.valueOf(0)).withFailMessage("grault").isEqualTo(Integer.valueOf(1));
|
||||||
assertThat(0L).withFailMessage("garply").isEqualTo(1L);
|
assertThat(0L).withFailMessage("garply").isEqualTo(1L);
|
||||||
// XXX: Ambiguous method call, as the relevant overload is missing. See testng-team/testng#3199.
|
assertThat(0L).withFailMessage("waldo").isEqualTo(Long.valueOf(1));
|
||||||
// assertEquals(0L, Long.valueOf(1), "waldo");
|
|
||||||
assertThat(Long.valueOf(0)).withFailMessage("fred").isEqualTo(1L);
|
assertThat(Long.valueOf(0)).withFailMessage("fred").isEqualTo(1L);
|
||||||
assertThat(Long.valueOf(0)).withFailMessage("plugh").isEqualTo(Long.valueOf(1));
|
assertThat(Long.valueOf(0)).withFailMessage("plugh").isEqualTo(Long.valueOf(1));
|
||||||
assertThat(0.0F).withFailMessage("xyzzy").isEqualTo(1.0F);
|
assertThat(0.0F).withFailMessage("xyzzy").isEqualTo(1.0F);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>tech.picnic.error-prone-support</groupId>
|
<groupId>tech.picnic.error-prone-support</groupId>
|
||||||
<artifactId>error-prone-support</artifactId>
|
<artifactId>error-prone-support</artifactId>
|
||||||
<version>0.20.0</version>
|
<version>0.22.1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>error-prone-experimental</artifactId>
|
<artifactId>error-prone-experimental</artifactId>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import com.sun.source.tree.ReturnTree;
|
|||||||
import com.sun.source.tree.Tree;
|
import com.sun.source.tree.Tree;
|
||||||
import com.sun.source.tree.VariableTree;
|
import com.sun.source.tree.VariableTree;
|
||||||
import com.sun.tools.javac.code.Symbol;
|
import com.sun.tools.javac.code.Symbol;
|
||||||
|
import com.sun.tools.javac.code.Symbol.PackageSymbol;
|
||||||
import com.sun.tools.javac.code.Type;
|
import com.sun.tools.javac.code.Type;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -126,7 +127,7 @@ public final class MethodReferenceUsage extends BugChecker implements LambdaExpr
|
|||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
Symbol sym = ASTHelpers.getSymbol(methodSelect);
|
Symbol sym = ASTHelpers.getSymbol(subTree);
|
||||||
return ASTHelpers.isStatic(sym)
|
return ASTHelpers.isStatic(sym)
|
||||||
? constructFix(lambdaExpr, sym.owner, methodSelect)
|
? constructFix(lambdaExpr, sym.owner, methodSelect)
|
||||||
: constructFix(lambdaExpr, "this", methodSelect);
|
: constructFix(lambdaExpr, "this", methodSelect);
|
||||||
@@ -200,7 +201,8 @@ public final class MethodReferenceUsage extends BugChecker implements LambdaExpr
|
|||||||
Name sName = target.getSimpleName();
|
Name sName = target.getSimpleName();
|
||||||
Optional<SuggestedFix.Builder> fix = constructFix(lambdaExpr, sName, methodName);
|
Optional<SuggestedFix.Builder> fix = constructFix(lambdaExpr, sName, methodName);
|
||||||
|
|
||||||
if (!"java.lang".equals(ASTHelpers.enclosingPackage(target).toString())) {
|
PackageSymbol pkg = ASTHelpers.enclosingPackage(target);
|
||||||
|
if (pkg != null && !"java.lang".equals(pkg.toString())) {
|
||||||
Name fqName = target.getQualifiedName();
|
Name fqName = target.getQualifiedName();
|
||||||
if (!sName.equals(fqName)) {
|
if (!sName.equals(fqName)) {
|
||||||
return fix.map(b -> b.addImport(fqName.toString()));
|
return fix.map(b -> b.addImport(fqName.toString()));
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>tech.picnic.error-prone-support</groupId>
|
<groupId>tech.picnic.error-prone-support</groupId>
|
||||||
<artifactId>error-prone-support</artifactId>
|
<artifactId>error-prone-support</artifactId>
|
||||||
<version>0.20.0</version>
|
<version>0.22.1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>error-prone-guidelines</artifactId>
|
<artifactId>error-prone-guidelines</artifactId>
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ import java.util.Set;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import javax.lang.model.element.AnnotationMirror;
|
import javax.lang.model.element.AnnotationMirror;
|
||||||
import javax.lang.model.element.AnnotationValue;
|
import javax.lang.model.element.AnnotationValue;
|
||||||
import javax.lang.model.element.Modifier;
|
|
||||||
import org.jspecify.annotations.Nullable;
|
import org.jspecify.annotations.Nullable;
|
||||||
import tech.picnic.errorprone.utils.SourceCode;
|
import tech.picnic.errorprone.utils.SourceCode;
|
||||||
|
|
||||||
@@ -102,7 +101,8 @@ public final class ExhaustiveRefasterTypeMigration extends BugChecker implements
|
|||||||
AnnotationTree migrationAnnotation = migrationAnnotations.onlyMatchingNode();
|
AnnotationTree migrationAnnotation = migrationAnnotations.onlyMatchingNode();
|
||||||
AnnotationMirror annotationMirror = ASTHelpers.getAnnotationMirror(migrationAnnotation);
|
AnnotationMirror annotationMirror = ASTHelpers.getAnnotationMirror(migrationAnnotation);
|
||||||
TypeSymbol migratedType = getMigratedType(annotationMirror);
|
TypeSymbol migratedType = getMigratedType(annotationMirror);
|
||||||
if (migratedType.asType().isPrimitive() || !(migratedType instanceof ClassSymbol)) {
|
if (migratedType.asType().isPrimitive()
|
||||||
|
|| !(migratedType instanceof ClassSymbol migratedClass)) {
|
||||||
return buildDescription(migrationAnnotation)
|
return buildDescription(migrationAnnotation)
|
||||||
.setMessage(String.format("Migration of type '%s' is unsupported", migratedType))
|
.setMessage(String.format("Migration of type '%s' is unsupported", migratedType))
|
||||||
.build();
|
.build();
|
||||||
@@ -111,7 +111,7 @@ public final class ExhaustiveRefasterTypeMigration extends BugChecker implements
|
|||||||
ImmutableList<String> methodsClaimedUnmigrated = getMethodsClaimedUnmigrated(annotationMirror);
|
ImmutableList<String> methodsClaimedUnmigrated = getMethodsClaimedUnmigrated(annotationMirror);
|
||||||
ImmutableList<String> unmigratedMethods =
|
ImmutableList<String> unmigratedMethods =
|
||||||
getMethodsDefinitelyUnmigrated(
|
getMethodsDefinitelyUnmigrated(
|
||||||
tree, (ClassSymbol) migratedType, signatureOrder(methodsClaimedUnmigrated), state);
|
tree, migratedClass, signatureOrder(methodsClaimedUnmigrated), state);
|
||||||
|
|
||||||
if (unmigratedMethods.equals(methodsClaimedUnmigrated)) {
|
if (unmigratedMethods.equals(methodsClaimedUnmigrated)) {
|
||||||
return Description.NO_MATCH;
|
return Description.NO_MATCH;
|
||||||
@@ -160,17 +160,11 @@ public final class ExhaustiveRefasterTypeMigration extends BugChecker implements
|
|||||||
.getValue().stream().map(a -> a.getValue().toString()).collect(toImmutableList());
|
.getValue().stream().map(a -> a.getValue().toString()).collect(toImmutableList());
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: Once only JDK 14 and above are supported, change the
|
|
||||||
// `m.getModifiers().contains(Modifier.PUBLIC)` check to just `m.isPublic()`.
|
|
||||||
private static ImmutableList<String> getMethodsDefinitelyUnmigrated(
|
private static ImmutableList<String> getMethodsDefinitelyUnmigrated(
|
||||||
ClassTree tree, ClassSymbol migratedType, Comparator<String> comparator, VisitorState state) {
|
ClassTree tree, ClassSymbol migratedType, Comparator<String> comparator, VisitorState state) {
|
||||||
Set<MethodSymbol> publicMethods =
|
Set<MethodSymbol> publicMethods =
|
||||||
Streams.stream(
|
Streams.stream(
|
||||||
ASTHelpers.scope(migratedType.members())
|
migratedType.members().getSymbols(m -> m.isPublic() && m instanceof MethodSymbol))
|
||||||
.getSymbols(
|
|
||||||
m ->
|
|
||||||
m.getModifiers().contains(Modifier.PUBLIC)
|
|
||||||
&& m instanceof MethodSymbol))
|
|
||||||
.map(MethodSymbol.class::cast)
|
.map(MethodSymbol.class::cast)
|
||||||
.collect(toCollection(HashSet::new));
|
.collect(toCollection(HashSet::new));
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>tech.picnic.error-prone-support</groupId>
|
<groupId>tech.picnic.error-prone-support</groupId>
|
||||||
<artifactId>error-prone-support</artifactId>
|
<artifactId>error-prone-support</artifactId>
|
||||||
<version>0.20.0</version>
|
<version>0.22.1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>error-prone-utils</artifactId>
|
<artifactId>error-prone-utils</artifactId>
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package tech.picnic.errorprone.utils;
|
package tech.picnic.errorprone.utils;
|
||||||
|
|
||||||
|
import static java.util.Objects.requireNonNull;
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
@@ -115,9 +117,15 @@ public final class AnnotationAttributeMatcher implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String extractAttributeName(ExpressionTree expr) {
|
private static String extractAttributeName(ExpressionTree expr) {
|
||||||
return (expr instanceof AssignmentTree assignment)
|
if (!(expr instanceof AssignmentTree assignment)) {
|
||||||
? ASTHelpers.getSymbol(assignment.getVariable()).getSimpleName().toString()
|
return "value";
|
||||||
: "value";
|
}
|
||||||
|
|
||||||
|
return requireNonNull(
|
||||||
|
ASTHelpers.getSymbol(assignment.getVariable()),
|
||||||
|
"Missing symbol for annotation attribute")
|
||||||
|
.getSimpleName()
|
||||||
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: The caller of this method can be implemented more efficiently in case of a "wholeTypes"
|
// XXX: The caller of this method can be implemented more efficiently in case of a "wholeTypes"
|
||||||
|
|||||||
@@ -303,14 +303,7 @@ final class SourceCodeTest {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Description matchLiteral(LiteralTree tree, VisitorState state) {
|
public Description matchLiteral(LiteralTree tree, VisitorState state) {
|
||||||
// XXX: The character conversion is a workaround for the fact that `ASTHelpers#constValue`
|
|
||||||
// returns an `Integer` value for `char` constants.
|
|
||||||
return Optional.ofNullable(ASTHelpers.constValue(tree))
|
return Optional.ofNullable(ASTHelpers.constValue(tree))
|
||||||
.map(
|
|
||||||
constant ->
|
|
||||||
ASTHelpers.isSubtype(ASTHelpers.getType(tree), state.getSymtab().charType, state)
|
|
||||||
? (char) (int) constant
|
|
||||||
: constant)
|
|
||||||
.map(constant -> describeMatch(tree, addComment(tree, constant, state)))
|
.map(constant -> describeMatch(tree, addComment(tree, constant, state)))
|
||||||
.orElse(Description.NO_MATCH);
|
.orElse(Description.NO_MATCH);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,15 +89,63 @@
|
|||||||
}
|
}
|
||||||
return new CollectdReporter(
|
return new CollectdReporter(
|
||||||
registry,
|
registry,
|
||||||
@@ -302,7 +297,7 @@ public class CollectdReporter extends ScheduledReporter {
|
@@ -177,7 +172,7 @@ public class CollectdReporter extends ScheduledReporter {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- private static final Logger LOG = LoggerFactory.getLogger(CollectdReporter.class);
|
||||||
|
+ private static final Logger LOGGER = LoggerFactory.getLogger(CollectdReporter.class);
|
||||||
|
private static final String REPORTER_NAME = "collectd-reporter";
|
||||||
|
private static final String FALLBACK_HOST_NAME = "localhost";
|
||||||
|
private static final String COLLECTD_TYPE_GAUGE = "gauge";
|
||||||
|
@@ -224,7 +219,7 @@ public class CollectdReporter extends ScheduledReporter {
|
||||||
|
try {
|
||||||
|
return InetAddress.getLocalHost().getHostName();
|
||||||
|
} catch (Exception e) {
|
||||||
|
- LOG.error("Failed to lookup local host name: {}", e.getMessage(), e);
|
||||||
|
+ LOGGER.error("Failed to lookup local host name: {}", e.getMessage(), e);
|
||||||
|
return FALLBACK_HOST_NAME;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -263,7 +258,7 @@ public class CollectdReporter extends ScheduledReporter {
|
||||||
|
serializeTimer(metaData.plugin(entry.getKey().getKey()), entry.getValue());
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
- LOG.warn("Unable to report to Collectd", e);
|
||||||
|
+ LOGGER.warn("Unable to report to Collectd", e);
|
||||||
|
} finally {
|
||||||
|
disconnect(sender);
|
||||||
|
}
|
||||||
|
@@ -279,7 +274,7 @@ public class CollectdReporter extends ScheduledReporter {
|
||||||
|
try {
|
||||||
|
sender.disconnect();
|
||||||
|
} catch (Exception e) {
|
||||||
|
- LOG.warn("Error disconnecting from Collectd", e);
|
||||||
|
+ LOGGER.warn("Error disconnecting from Collectd", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -302,9 +297,9 @@ public class CollectdReporter extends ScheduledReporter {
|
||||||
try {
|
try {
|
||||||
writer.write(metaData, value);
|
writer.write(metaData, value);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
- LOG.warn("Failed to process metric '" + metaData.getPlugin() + "': " + e.getMessage());
|
- LOG.warn("Failed to process metric '" + metaData.getPlugin() + "': " + e.getMessage());
|
||||||
+ LOG.warn("Failed to process metric '{}': {}", metaData.getPlugin(), e.getMessage());
|
+ LOGGER.warn("Failed to process metric '{}': {}", metaData.getPlugin(), e.getMessage());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOG.error("Failed to send metric to collectd", e);
|
- LOG.error("Failed to send metric to collectd", e);
|
||||||
|
+ LOGGER.error("Failed to send metric to collectd", e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -314,7 +309,7 @@ public class CollectdReporter extends ScheduledReporter {
|
||||||
|
} else if (metric.getValue() instanceof Boolean) {
|
||||||
|
write(metaData.typeInstance("value").get(), ((Boolean) metric.getValue()) ? 1 : 0);
|
||||||
|
} else {
|
||||||
|
- LOG.warn(
|
||||||
|
+ LOGGER.warn(
|
||||||
|
"Failed to process metric '{}'. Unsupported gauge of type: {} ",
|
||||||
|
metaData.get().getPlugin(),
|
||||||
|
metric.getValue().getClass().getName());
|
||||||
@@ -336,9 +331,9 @@ public class CollectdReporter extends ScheduledReporter {
|
@@ -336,9 +331,9 @@ public class CollectdReporter extends ScheduledReporter {
|
||||||
private void serializeHistogram(MetaData.Builder metaData, Histogram metric) {
|
private void serializeHistogram(MetaData.Builder metaData, Histogram metric) {
|
||||||
final Snapshot snapshot = metric.getSnapshot();
|
final Snapshot snapshot = metric.getSnapshot();
|
||||||
@@ -476,26 +524,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
--- a/metrics-core/src/main/java/io/dropwizard/metrics5/CsvReporter.java
|
|
||||||
+++ b/metrics-core/src/main/java/io/dropwizard/metrics5/CsvReporter.java
|
|
||||||
@@ -179,7 +179,7 @@ public class CsvReporter extends ScheduledReporter {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- private static final Logger LOGGER = LoggerFactory.getLogger(CsvReporter.class);
|
|
||||||
+ private static final Logger LOG = LoggerFactory.getLogger(CsvReporter.class);
|
|
||||||
|
|
||||||
private final File directory;
|
|
||||||
private final Locale locale;
|
|
||||||
@@ -391,7 +391,7 @@ public class CsvReporter extends ScheduledReporter {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
- LOGGER.warn("Error writing to {}", name, e);
|
|
||||||
+ LOG.warn("Error writing to {}", name, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
--- a/metrics-core/src/main/java/io/dropwizard/metrics5/ExponentialMovingAverages.java
|
--- a/metrics-core/src/main/java/io/dropwizard/metrics5/ExponentialMovingAverages.java
|
||||||
+++ b/metrics-core/src/main/java/io/dropwizard/metrics5/ExponentialMovingAverages.java
|
+++ b/metrics-core/src/main/java/io/dropwizard/metrics5/ExponentialMovingAverages.java
|
||||||
@@ -17,9 +17,9 @@ public class ExponentialMovingAverages implements MovingAverages {
|
@@ -17,9 +17,9 @@ public class ExponentialMovingAverages implements MovingAverages {
|
||||||
@@ -990,6 +1018,15 @@
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.SortedMap;
|
import java.util.SortedMap;
|
||||||
|
@@ -24,7 +27,7 @@ import org.slf4j.LoggerFactory;
|
||||||
|
*/
|
||||||
|
public abstract class ScheduledReporter implements Closeable, Reporter {
|
||||||
|
|
||||||
|
- private static final Logger LOG = LoggerFactory.getLogger(ScheduledReporter.class);
|
||||||
|
+ private static final Logger LOGGER = LoggerFactory.getLogger(ScheduledReporter.class);
|
||||||
|
|
||||||
|
/** A simple named thread factory. */
|
||||||
|
@SuppressWarnings("NullableProblems")
|
||||||
@@ -128,7 +131,7 @@ public abstract class ScheduledReporter implements Closeable, Reporter {
|
@@ -128,7 +131,7 @@ public abstract class ScheduledReporter implements Closeable, Reporter {
|
||||||
durationUnit,
|
durationUnit,
|
||||||
executor,
|
executor,
|
||||||
@@ -1040,6 +1077,33 @@
|
|||||||
protected ScheduledFuture<?> getScheduledFuture(
|
protected ScheduledFuture<?> getScheduledFuture(
|
||||||
long initialDelay, long period, TimeUnit unit, Runnable runnable) {
|
long initialDelay, long period, TimeUnit unit, Runnable runnable) {
|
||||||
return getScheduledFuture(initialDelay, period, unit, runnable, this.executor);
|
return getScheduledFuture(initialDelay, period, unit, runnable, this.executor);
|
||||||
|
@@ -225,7 +224,7 @@ public abstract class ScheduledReporter implements Closeable, Reporter {
|
||||||
|
try {
|
||||||
|
report();
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
- LOG.error(
|
||||||
|
+ LOGGER.error(
|
||||||
|
"Exception thrown from {}#report. Exception was suppressed.",
|
||||||
|
ScheduledReporter.this.getClass().getSimpleName(),
|
||||||
|
ex);
|
||||||
|
@@ -250,7 +249,7 @@ public abstract class ScheduledReporter implements Closeable, Reporter {
|
||||||
|
try {
|
||||||
|
report();
|
||||||
|
} catch (Exception e) {
|
||||||
|
- LOG.warn("Final reporting of metrics failed.", e);
|
||||||
|
+ LOGGER.warn("Final reporting of metrics failed.", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -261,7 +260,7 @@ public abstract class ScheduledReporter implements Closeable, Reporter {
|
||||||
|
executor.shutdownNow(); // Cancel currently executing tasks
|
||||||
|
// Wait a while for tasks to respond to being cancelled
|
||||||
|
if (!executor.awaitTermination(1, TimeUnit.SECONDS)) {
|
||||||
|
- LOG.warn("ScheduledExecutorService did not terminate.");
|
||||||
|
+ LOGGER.warn("ScheduledExecutorService did not terminate.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (InterruptedException ie) {
|
||||||
--- a/metrics-core/src/main/java/io/dropwizard/metrics5/SharedMetricRegistries.java
|
--- a/metrics-core/src/main/java/io/dropwizard/metrics5/SharedMetricRegistries.java
|
||||||
+++ b/metrics-core/src/main/java/io/dropwizard/metrics5/SharedMetricRegistries.java
|
+++ b/metrics-core/src/main/java/io/dropwizard/metrics5/SharedMetricRegistries.java
|
||||||
@@ -1,5 +1,7 @@
|
@@ -1,5 +1,7 @@
|
||||||
@@ -1200,32 +1264,15 @@
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -15,8 +14,8 @@ import org.junit.jupiter.api.Test;
|
@@ -15,7 +14,7 @@ import org.junit.jupiter.api.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
-class CachedGaugeTest {
|
-class CachedGaugeTest {
|
||||||
- private static final Logger LOGGER = LoggerFactory.getLogger(CachedGaugeTest.class);
|
|
||||||
+final class CachedGaugeTest {
|
+final class CachedGaugeTest {
|
||||||
+ private static final Logger LOG = LoggerFactory.getLogger(CachedGaugeTest.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(CachedGaugeTest.class);
|
||||||
private static final int THREAD_COUNT = 10;
|
private static final int THREAD_COUNT = 10;
|
||||||
private static final long RUNNING_TIME_MILLIS = TimeUnit.SECONDS.toMillis(10);
|
private static final long RUNNING_TIME_MILLIS = TimeUnit.SECONDS.toMillis(10);
|
||||||
|
|
||||||
@@ -100,12 +99,12 @@ class CachedGaugeTest {
|
|
||||||
Integer newValue = shortTimeoutGauge.getValue();
|
|
||||||
|
|
||||||
if (newValue == null) {
|
|
||||||
- LOGGER.warn("Cached gauge returned null value");
|
|
||||||
+ LOG.warn("Cached gauge returned null value");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newValue < lastValue) {
|
|
||||||
- LOGGER.error(
|
|
||||||
+ LOG.error(
|
|
||||||
"Cached gauge returned stale value, last: {}, new: {}",
|
|
||||||
lastValue,
|
|
||||||
newValue);
|
|
||||||
@@ -122,7 +121,7 @@ class CachedGaugeTest {
|
@@ -122,7 +121,7 @@ class CachedGaugeTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1899,29 +1946,16 @@
|
|||||||
assertThat(histogram.getSnapshot()).isEqualTo(snapshot);
|
assertThat(histogram.getSnapshot()).isEqualTo(snapshot);
|
||||||
--- a/metrics-core/src/test/java/io/dropwizard/metrics5/InstrumentedExecutorServiceTest.java
|
--- a/metrics-core/src/test/java/io/dropwizard/metrics5/InstrumentedExecutorServiceTest.java
|
||||||
+++ b/metrics-core/src/test/java/io/dropwizard/metrics5/InstrumentedExecutorServiceTest.java
|
+++ b/metrics-core/src/test/java/io/dropwizard/metrics5/InstrumentedExecutorServiceTest.java
|
||||||
@@ -19,10 +19,9 @@ import org.junit.jupiter.api.Test;
|
@@ -19,7 +19,7 @@ import org.junit.jupiter.api.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
-class InstrumentedExecutorServiceTest {
|
-class InstrumentedExecutorServiceTest {
|
||||||
+final class InstrumentedExecutorServiceTest {
|
+final class InstrumentedExecutorServiceTest {
|
||||||
|
|
||||||
- private static final Logger LOGGER =
|
private static final Logger LOGGER =
|
||||||
- LoggerFactory.getLogger(InstrumentedExecutorServiceTest.class);
|
LoggerFactory.getLogger(InstrumentedExecutorServiceTest.class);
|
||||||
+ private static final Logger LOG = LoggerFactory.getLogger(InstrumentedExecutorServiceTest.class);
|
@@ -115,8 +115,8 @@ class InstrumentedExecutorServiceTest {
|
||||||
private ExecutorService executor;
|
|
||||||
private MetricRegistry registry;
|
|
||||||
private InstrumentedExecutorService instrumentedExecutorService;
|
|
||||||
@@ -48,7 +47,7 @@ class InstrumentedExecutorServiceTest {
|
|
||||||
void tearDown() throws Exception {
|
|
||||||
instrumentedExecutorService.shutdown();
|
|
||||||
if (!instrumentedExecutorService.awaitTermination(2, TimeUnit.SECONDS)) {
|
|
||||||
- LOGGER.error("InstrumentedExecutorService did not terminate.");
|
|
||||||
+ LOG.error("InstrumentedExecutorService did not terminate.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -115,8 +114,8 @@ class InstrumentedExecutorServiceTest {
|
|
||||||
assertThat(idle.getSnapshot().size()).isEqualTo(1);
|
assertThat(idle.getSnapshot().size()).isEqualTo(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1931,7 +1965,7 @@
|
|||||||
void reportsTasksInformationForThreadPoolExecutor() throws Exception {
|
void reportsTasksInformationForThreadPoolExecutor() throws Exception {
|
||||||
executor =
|
executor =
|
||||||
new ThreadPoolExecutor(4, 16, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(32));
|
new ThreadPoolExecutor(4, 16, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(32));
|
||||||
@@ -180,7 +179,7 @@ class InstrumentedExecutorServiceTest {
|
@@ -180,7 +180,7 @@ class InstrumentedExecutorServiceTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -1940,7 +1974,7 @@
|
|||||||
executor =
|
executor =
|
||||||
new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1));
|
new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1));
|
||||||
instrumentedExecutorService = new InstrumentedExecutorService(executor, registry, "tp");
|
instrumentedExecutorService = new InstrumentedExecutorService(executor, registry, "tp");
|
||||||
@@ -207,7 +206,7 @@ class InstrumentedExecutorServiceTest {
|
@@ -207,7 +207,7 @@ class InstrumentedExecutorServiceTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -1949,7 +1983,7 @@
|
|||||||
executor =
|
executor =
|
||||||
new ThreadPoolExecutor(4, 16, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(32));
|
new ThreadPoolExecutor(4, 16, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(32));
|
||||||
instrumentedExecutorService = new InstrumentedExecutorService(executor, registry, "stp");
|
instrumentedExecutorService = new InstrumentedExecutorService(executor, registry, "stp");
|
||||||
@@ -236,8 +235,8 @@ class InstrumentedExecutorServiceTest {
|
@@ -236,8 +236,8 @@ class InstrumentedExecutorServiceTest {
|
||||||
MetricRegistry.name("stp", "tasks.capacity"));
|
MetricRegistry.name("stp", "tasks.capacity"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1959,7 +1993,7 @@
|
|||||||
void reportsTasksInformationForForkJoinPool() throws Exception {
|
void reportsTasksInformationForForkJoinPool() throws Exception {
|
||||||
executor = Executors.newWorkStealingPool(4);
|
executor = Executors.newWorkStealingPool(4);
|
||||||
instrumentedExecutorService = new InstrumentedExecutorService(executor, registry, "fjp");
|
instrumentedExecutorService = new InstrumentedExecutorService(executor, registry, "fjp");
|
||||||
@@ -291,7 +290,7 @@ class InstrumentedExecutorServiceTest {
|
@@ -291,7 +291,7 @@ class InstrumentedExecutorServiceTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -1970,17 +2004,15 @@
|
|||||||
|
|
||||||
--- a/metrics-core/src/test/java/io/dropwizard/metrics5/InstrumentedScheduledExecutorServiceTest.java
|
--- a/metrics-core/src/test/java/io/dropwizard/metrics5/InstrumentedScheduledExecutorServiceTest.java
|
||||||
+++ b/metrics-core/src/test/java/io/dropwizard/metrics5/InstrumentedScheduledExecutorServiceTest.java
|
+++ b/metrics-core/src/test/java/io/dropwizard/metrics5/InstrumentedScheduledExecutorServiceTest.java
|
||||||
@@ -13,8 +13,8 @@ import org.junit.jupiter.api.Test;
|
@@ -13,7 +13,7 @@ import org.junit.jupiter.api.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
-class InstrumentedScheduledExecutorServiceTest {
|
-class InstrumentedScheduledExecutorServiceTest {
|
||||||
- private static final Logger LOGGER =
|
|
||||||
+final class InstrumentedScheduledExecutorServiceTest {
|
+final class InstrumentedScheduledExecutorServiceTest {
|
||||||
+ private static final Logger LOG =
|
private static final Logger LOGGER =
|
||||||
LoggerFactory.getLogger(InstrumentedScheduledExecutorServiceTest.class);
|
LoggerFactory.getLogger(InstrumentedScheduledExecutorServiceTest.class);
|
||||||
|
|
||||||
private final ScheduledExecutorService scheduledExecutor =
|
|
||||||
@@ -35,17 +35,17 @@ class InstrumentedScheduledExecutorServiceTest {
|
@@ -35,17 +35,17 @@ class InstrumentedScheduledExecutorServiceTest {
|
||||||
private final Histogram percentOfPeriod = registry.histogram("xs.scheduled.percent-of-period");
|
private final Histogram percentOfPeriod = registry.histogram("xs.scheduled.percent-of-period");
|
||||||
|
|
||||||
@@ -2338,15 +2370,6 @@
|
|||||||
assertThat(completed.getCount()).isNotEqualTo(0);
|
assertThat(completed.getCount()).isNotEqualTo(0);
|
||||||
assertThat(duration.getCount()).isNotEqualTo(0);
|
assertThat(duration.getCount()).isNotEqualTo(0);
|
||||||
assertThat(duration.getSnapshot().size()).isNotEqualTo(0);
|
assertThat(duration.getSnapshot().size()).isNotEqualTo(0);
|
||||||
@@ -322,7 +322,7 @@ class InstrumentedScheduledExecutorServiceTest {
|
|
||||||
void tearDown() throws Exception {
|
|
||||||
instrumentedScheduledExecutor.shutdown();
|
|
||||||
if (!instrumentedScheduledExecutor.awaitTermination(2, TimeUnit.SECONDS)) {
|
|
||||||
- LOGGER.error("InstrumentedScheduledExecutorService did not terminate.");
|
|
||||||
+ LOG.error("InstrumentedScheduledExecutorService did not terminate.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
--- a/metrics-core/src/test/java/io/dropwizard/metrics5/InstrumentedThreadFactoryTest.java
|
--- a/metrics-core/src/test/java/io/dropwizard/metrics5/InstrumentedThreadFactoryTest.java
|
||||||
+++ b/metrics-core/src/test/java/io/dropwizard/metrics5/InstrumentedThreadFactoryTest.java
|
+++ b/metrics-core/src/test/java/io/dropwizard/metrics5/InstrumentedThreadFactoryTest.java
|
||||||
@@ -11,7 +11,7 @@ import java.util.concurrent.TimeUnit;
|
@@ -11,7 +11,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
@@ -3801,15 +3824,6 @@
|
|||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
@@ -29,7 +32,7 @@ public class Graphite implements GraphiteSender {
|
|
||||||
private Writer writer;
|
|
||||||
private int failures;
|
|
||||||
|
|
||||||
- private static final Logger LOGGER = LoggerFactory.getLogger(Graphite.class);
|
|
||||||
+ private static final Logger LOG = LoggerFactory.getLogger(Graphite.class);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new client which connects to the given address using the default {@link
|
|
||||||
@@ -63,13 +66,9 @@ public class Graphite implements GraphiteSender {
|
@@ -63,13 +66,9 @@ public class Graphite implements GraphiteSender {
|
||||||
* @param charset the character set used by the server
|
* @param charset the character set used by the server
|
||||||
*/
|
*/
|
||||||
@@ -3837,24 +3851,6 @@
|
|||||||
InetSocketAddress address = this.address;
|
InetSocketAddress address = this.address;
|
||||||
// the previous dns retry logic did not work, as address.getAddress would always return the
|
// the previous dns retry logic did not work, as address.getAddress would always return the
|
||||||
// cached value
|
// cached value
|
||||||
@@ -178,7 +175,7 @@ public class Graphite implements GraphiteSender {
|
|
||||||
writer.close();
|
|
||||||
}
|
|
||||||
} catch (IOException ex) {
|
|
||||||
- LOGGER.debug("Error closing writer", ex);
|
|
||||||
+ LOG.debug("Error closing writer", ex);
|
|
||||||
} finally {
|
|
||||||
this.writer = null;
|
|
||||||
}
|
|
||||||
@@ -188,7 +185,7 @@ public class Graphite implements GraphiteSender {
|
|
||||||
socket.close();
|
|
||||||
}
|
|
||||||
} catch (IOException ex) {
|
|
||||||
- LOGGER.debug("Error closing socket", ex);
|
|
||||||
+ LOG.debug("Error closing socket", ex);
|
|
||||||
} finally {
|
|
||||||
this.socket = null;
|
|
||||||
}
|
|
||||||
--- a/metrics-graphite/src/main/java/io/dropwizard/metrics5/graphite/GraphiteRabbitMQ.java
|
--- a/metrics-graphite/src/main/java/io/dropwizard/metrics5/graphite/GraphiteRabbitMQ.java
|
||||||
+++ b/metrics-graphite/src/main/java/io/dropwizard/metrics5/graphite/GraphiteRabbitMQ.java
|
+++ b/metrics-graphite/src/main/java/io/dropwizard/metrics5/graphite/GraphiteRabbitMQ.java
|
||||||
@@ -1,5 +1,6 @@
|
@@ -1,5 +1,6 @@
|
||||||
@@ -3923,39 +3919,7 @@
|
|||||||
this.addMetricAttributesAsTags = false;
|
this.addMetricAttributesAsTags = false;
|
||||||
this.floatingPointFormatter = DEFAULT_FP_FORMATTER;
|
this.floatingPointFormatter = DEFAULT_FP_FORMATTER;
|
||||||
}
|
}
|
||||||
@@ -249,7 +247,7 @@ public class GraphiteReporter extends ScheduledReporter {
|
@@ -455,9 +453,9 @@ public class GraphiteReporter extends ScheduledReporter {
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- private static final Logger LOGGER = LoggerFactory.getLogger(GraphiteReporter.class);
|
|
||||||
+ private static final Logger LOG = LoggerFactory.getLogger(GraphiteReporter.class);
|
|
||||||
// the Carbon plaintext format is pretty underspecified, but it seems like it just wants
|
|
||||||
// US-formatted digits
|
|
||||||
private static final DoubleFunction<String> DEFAULT_FP_FORMATTER =
|
|
||||||
@@ -430,12 +428,12 @@ public class GraphiteReporter extends ScheduledReporter {
|
|
||||||
}
|
|
||||||
graphite.flush();
|
|
||||||
} catch (IOException e) {
|
|
||||||
- LOGGER.warn("Unable to report to Graphite", graphite, e);
|
|
||||||
+ LOG.warn("Unable to report to Graphite", graphite, e);
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
graphite.close();
|
|
||||||
} catch (IOException e1) {
|
|
||||||
- LOGGER.warn("Error closing Graphite", graphite, e1);
|
|
||||||
+ LOG.warn("Error closing Graphite", graphite, e1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -448,16 +446,16 @@ public class GraphiteReporter extends ScheduledReporter {
|
|
||||||
try {
|
|
||||||
graphite.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
- LOGGER.debug("Error disconnecting from Graphite", graphite, e);
|
|
||||||
+ LOG.debug("Error disconnecting from Graphite", graphite, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void reportTimer(MetricName name, Timer timer, long timestamp) throws IOException {
|
private void reportTimer(MetricName name, Timer timer, long timestamp) throws IOException {
|
||||||
final Snapshot snapshot = timer.getSnapshot();
|
final Snapshot snapshot = timer.getSnapshot();
|
||||||
@@ -4017,15 +3981,6 @@
|
|||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
|
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
@@ -48,7 +49,7 @@ public class PickledGraphite implements GraphiteSender {
|
|
||||||
QUOTE = '\'',
|
|
||||||
LF = '\n';
|
|
||||||
|
|
||||||
- private static final Logger LOGGER = LoggerFactory.getLogger(PickledGraphite.class);
|
|
||||||
+ private static final Logger LOG = LoggerFactory.getLogger(PickledGraphite.class);
|
|
||||||
private static final int DEFAULT_BATCH_SIZE = 100;
|
|
||||||
|
|
||||||
private int batchSize;
|
|
||||||
@@ -173,9 +174,7 @@ public class PickledGraphite implements GraphiteSender {
|
@@ -173,9 +174,7 @@ public class PickledGraphite implements GraphiteSender {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -4046,17 +4001,6 @@
|
|||||||
try {
|
try {
|
||||||
byte[] payload = pickleMetrics(metrics);
|
byte[] payload = pickleMetrics(metrics);
|
||||||
byte[] header = ByteBuffer.allocate(4).putInt(payload.length).array();
|
byte[] header = ByteBuffer.allocate(4).putInt(payload.length).array();
|
||||||
@@ -260,8 +259,8 @@ public class PickledGraphite implements GraphiteSender {
|
|
||||||
outputStream.write(payload);
|
|
||||||
outputStream.flush();
|
|
||||||
|
|
||||||
- if (LOGGER.isDebugEnabled()) {
|
|
||||||
- LOGGER.debug("Wrote {} metrics", metrics.size());
|
|
||||||
+ if (LOG.isDebugEnabled()) {
|
|
||||||
+ LOG.debug("Wrote {} metrics", metrics.size());
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
this.failures++;
|
|
||||||
--- a/metrics-graphite/src/test/java/io/dropwizard/metrics5/graphite/GraphiteRabbitMQTest.java
|
--- a/metrics-graphite/src/test/java/io/dropwizard/metrics5/graphite/GraphiteRabbitMQTest.java
|
||||||
+++ b/metrics-graphite/src/test/java/io/dropwizard/metrics5/graphite/GraphiteRabbitMQTest.java
|
+++ b/metrics-graphite/src/test/java/io/dropwizard/metrics5/graphite/GraphiteRabbitMQTest.java
|
||||||
@@ -8,7 +8,6 @@ import static org.mockito.Mockito.anyString;
|
@@ -8,7 +8,6 @@ import static org.mockito.Mockito.anyString;
|
||||||
@@ -4475,15 +4419,6 @@
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -27,7 +29,7 @@ import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/** A registry for health checks. */
|
|
||||||
public class HealthCheckRegistry {
|
|
||||||
- private static final Logger LOGGER = LoggerFactory.getLogger(HealthCheckRegistry.class);
|
|
||||||
+ private static final Logger LOG = LoggerFactory.getLogger(HealthCheckRegistry.class);
|
|
||||||
private static final int ASYNC_EXECUTOR_POOL_SIZE = 2;
|
|
||||||
|
|
||||||
private final ConcurrentMap<String, HealthCheck> healthChecks;
|
|
||||||
@@ -92,9 +94,8 @@ public class HealthCheckRegistry {
|
@@ -92,9 +94,8 @@ public class HealthCheckRegistry {
|
||||||
public void register(String name, HealthCheck healthCheck) {
|
public void register(String name, HealthCheck healthCheck) {
|
||||||
HealthCheck registered;
|
HealthCheck registered;
|
||||||
@@ -4514,13 +4449,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -217,12 +218,12 @@ public class HealthCheckRegistry {
|
@@ -222,7 +223,7 @@ public class HealthCheckRegistry {
|
||||||
try {
|
|
||||||
results.put(entry.getKey(), entry.getValue().get());
|
|
||||||
} catch (Exception e) {
|
|
||||||
- LOGGER.warn("Error executing health check {}", entry.getKey(), e);
|
|
||||||
+ LOG.warn("Error executing health check {}", entry.getKey(), e);
|
|
||||||
results.put(entry.getKey(), HealthCheck.Result.unhealthy(e));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5357,39 +5286,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -196,7 +196,7 @@ public class InfluxDbReporter extends GarbageFreeScheduledReporter {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- private static final Logger LOGGER = LoggerFactory.getLogger(InfluxDbReporter.class);
|
|
||||||
+ private static final Logger LOG = LoggerFactory.getLogger(InfluxDbReporter.class);
|
|
||||||
private static final String VALUE = "value";
|
|
||||||
|
|
||||||
private final Clock clock;
|
|
||||||
@@ -279,12 +279,12 @@ public class InfluxDbReporter extends GarbageFreeScheduledReporter {
|
|
||||||
}
|
|
||||||
sender.flush();
|
|
||||||
} catch (IOException e) {
|
|
||||||
- LOGGER.warn("Unable to report to InfluxDb", sender, e);
|
|
||||||
+ LOG.warn("Unable to report to InfluxDb", sender, e);
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
sender.disconnect();
|
|
||||||
} catch (IOException e) {
|
|
||||||
- LOGGER.warn("Error disconnecting InfluxDb", sender, e);
|
|
||||||
+ LOG.warn("Error disconnecting InfluxDb", sender, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -297,7 +297,7 @@ public class InfluxDbReporter extends GarbageFreeScheduledReporter {
|
|
||||||
try {
|
|
||||||
sender.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
- LOGGER.debug("Error disconnecting from InfluxDb", e);
|
|
||||||
+ LOG.debug("Error disconnecting from InfluxDb", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
--- a/metrics-influxdb/src/main/java/io/dropwizard/metrics5/influxdb/InfluxDbUdpSender.java
|
--- a/metrics-influxdb/src/main/java/io/dropwizard/metrics5/influxdb/InfluxDbUdpSender.java
|
||||||
+++ b/metrics-influxdb/src/main/java/io/dropwizard/metrics5/influxdb/InfluxDbUdpSender.java
|
+++ b/metrics-influxdb/src/main/java/io/dropwizard/metrics5/influxdb/InfluxDbUdpSender.java
|
||||||
@@ -1,5 +1,7 @@
|
@@ -1,5 +1,7 @@
|
||||||
@@ -6065,15 +5961,6 @@
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@@ -33,7 +33,7 @@ public class JCacheGaugeSet implements MetricSet {
|
|
||||||
private static final String M_BEAN_COORDINATES =
|
|
||||||
"javax.cache:type=CacheStatistics,CacheManager=*,Cache=*";
|
|
||||||
|
|
||||||
- private static final Logger LOGGER = LoggerFactory.getLogger(JCacheGaugeSet.class);
|
|
||||||
+ private static final Logger LOG = LoggerFactory.getLogger(JCacheGaugeSet.class);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<MetricName, Metric> getMetrics() {
|
|
||||||
@@ -52,7 +52,7 @@ public class JCacheGaugeSet implements MetricSet {
|
@@ -52,7 +52,7 @@ public class JCacheGaugeSet implements MetricSet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6083,15 +5970,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Set<ObjectInstance> getCacheBeans() {
|
private Set<ObjectInstance> getCacheBeans() {
|
||||||
@@ -60,7 +60,7 @@ public class JCacheGaugeSet implements MetricSet {
|
|
||||||
return ManagementFactory.getPlatformMBeanServer()
|
|
||||||
.queryMBeans(ObjectName.getInstance(M_BEAN_COORDINATES), null);
|
|
||||||
} catch (MalformedObjectNameException e) {
|
|
||||||
- LOGGER.error("Unable to retrieve {}. Are JCache statistics enabled?", M_BEAN_COORDINATES);
|
|
||||||
+ LOG.error("Unable to retrieve {}. Are JCache statistics enabled?", M_BEAN_COORDINATES);
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
--- a/metrics-jcache/src/test/java/JCacheGaugeSetTest.java
|
--- a/metrics-jcache/src/test/java/JCacheGaugeSetTest.java
|
||||||
+++ b/metrics-jcache/src/test/java/JCacheGaugeSetTest.java
|
+++ b/metrics-jcache/src/test/java/JCacheGaugeSetTest.java
|
||||||
@@ -11,7 +11,7 @@ import org.junit.jupiter.api.AfterEach;
|
@@ -11,7 +11,7 @@ import org.junit.jupiter.api.AfterEach;
|
||||||
@@ -8461,11 +8339,11 @@
|
|||||||
|
|
||||||
private static final char[] QUOTABLE_CHARS = new char[] {',', '=', ':', '"'};
|
private static final char[] QUOTABLE_CHARS = new char[] {',', '=', ':', '"'};
|
||||||
- private static final Logger LOGGER = LoggerFactory.getLogger(JmxReporter.class);
|
- private static final Logger LOGGER = LoggerFactory.getLogger(JmxReporter.class);
|
||||||
+ private static final Logger LOG = LoggerFactory.getLogger(DefaultObjectNameFactory.class);
|
+ private static final Logger LOGGER = LoggerFactory.getLogger(DefaultObjectNameFactory.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectName createName(String type, String domain, MetricName name) {
|
public ObjectName createName(String type, String domain, MetricName name) {
|
||||||
@@ -38,14 +38,13 @@ public class DefaultObjectNameFactory implements ObjectNameFactory {
|
@@ -38,9 +38,8 @@ public class DefaultObjectNameFactory implements ObjectNameFactory {
|
||||||
|| shouldQuote(objectName.getKeyProperty("type"))) {
|
|| shouldQuote(objectName.getKeyProperty("type"))) {
|
||||||
properties.put("type", ObjectName.quote(type));
|
properties.put("type", ObjectName.quote(type));
|
||||||
}
|
}
|
||||||
@@ -8476,12 +8354,6 @@
|
|||||||
} catch (MalformedObjectNameException e) {
|
} catch (MalformedObjectNameException e) {
|
||||||
try {
|
try {
|
||||||
return new ObjectName(domain, "name", ObjectName.quote(name.getKey()));
|
return new ObjectName(domain, "name", ObjectName.quote(name.getKey()));
|
||||||
} catch (MalformedObjectNameException e1) {
|
|
||||||
- LOGGER.warn("Unable to register {} {}", type, name, e1);
|
|
||||||
+ LOG.warn("Unable to register {} {}", type, name, e1);
|
|
||||||
throw new RuntimeException(e1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
--- a/metrics-jmx/src/main/java/io/dropwizard/metrics5/jmx/JmxReporter.java
|
--- a/metrics-jmx/src/main/java/io/dropwizard/metrics5/jmx/JmxReporter.java
|
||||||
+++ b/metrics-jmx/src/main/java/io/dropwizard/metrics5/jmx/JmxReporter.java
|
+++ b/metrics-jmx/src/main/java/io/dropwizard/metrics5/jmx/JmxReporter.java
|
||||||
@@ -1,5 +1,9 @@
|
@@ -1,5 +1,9 @@
|
||||||
@@ -8542,147 +8414,6 @@
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,7 +160,7 @@ public class JmxReporter implements Reporter, Closeable {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- private static final Logger LOGGER = LoggerFactory.getLogger(JmxReporter.class);
|
|
||||||
+ private static final Logger LOG = LoggerFactory.getLogger(JmxReporter.class);
|
|
||||||
|
|
||||||
@SuppressWarnings("UnusedDeclaration")
|
|
||||||
public interface MetricMBean {
|
|
||||||
@@ -570,9 +571,9 @@ public class JmxReporter implements Reporter, Closeable {
|
|
||||||
registerMBean(new JmxGauge(gauge, objectName), objectName);
|
|
||||||
}
|
|
||||||
} catch (InstanceAlreadyExistsException e) {
|
|
||||||
- LOGGER.debug("Unable to register gauge", e);
|
|
||||||
+ LOG.debug("Unable to register gauge", e);
|
|
||||||
} catch (JMException e) {
|
|
||||||
- LOGGER.warn("Unable to register gauge", e);
|
|
||||||
+ LOG.warn("Unable to register gauge", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -582,9 +583,9 @@ public class JmxReporter implements Reporter, Closeable {
|
|
||||||
final ObjectName objectName = createName("gauges", name);
|
|
||||||
unregisterMBean(objectName);
|
|
||||||
} catch (InstanceNotFoundException e) {
|
|
||||||
- LOGGER.debug("Unable to unregister gauge", e);
|
|
||||||
+ LOG.debug("Unable to unregister gauge", e);
|
|
||||||
} catch (MBeanRegistrationException e) {
|
|
||||||
- LOGGER.warn("Unable to unregister gauge", e);
|
|
||||||
+ LOG.warn("Unable to unregister gauge", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -596,9 +597,9 @@ public class JmxReporter implements Reporter, Closeable {
|
|
||||||
registerMBean(new JmxCounter(counter, objectName), objectName);
|
|
||||||
}
|
|
||||||
} catch (InstanceAlreadyExistsException e) {
|
|
||||||
- LOGGER.debug("Unable to register counter", e);
|
|
||||||
+ LOG.debug("Unable to register counter", e);
|
|
||||||
} catch (JMException e) {
|
|
||||||
- LOGGER.warn("Unable to register counter", e);
|
|
||||||
+ LOG.warn("Unable to register counter", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -608,9 +609,9 @@ public class JmxReporter implements Reporter, Closeable {
|
|
||||||
final ObjectName objectName = createName("counters", name);
|
|
||||||
unregisterMBean(objectName);
|
|
||||||
} catch (InstanceNotFoundException e) {
|
|
||||||
- LOGGER.debug("Unable to unregister counter", e);
|
|
||||||
+ LOG.debug("Unable to unregister counter", e);
|
|
||||||
} catch (MBeanRegistrationException e) {
|
|
||||||
- LOGGER.warn("Unable to unregister counter", e);
|
|
||||||
+ LOG.warn("Unable to unregister counter", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -622,9 +623,9 @@ public class JmxReporter implements Reporter, Closeable {
|
|
||||||
registerMBean(new JmxHistogram(histogram, objectName), objectName);
|
|
||||||
}
|
|
||||||
} catch (InstanceAlreadyExistsException e) {
|
|
||||||
- LOGGER.debug("Unable to register histogram", e);
|
|
||||||
+ LOG.debug("Unable to register histogram", e);
|
|
||||||
} catch (JMException e) {
|
|
||||||
- LOGGER.warn("Unable to register histogram", e);
|
|
||||||
+ LOG.warn("Unable to register histogram", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -634,9 +635,9 @@ public class JmxReporter implements Reporter, Closeable {
|
|
||||||
final ObjectName objectName = createName("histograms", name);
|
|
||||||
unregisterMBean(objectName);
|
|
||||||
} catch (InstanceNotFoundException e) {
|
|
||||||
- LOGGER.debug("Unable to unregister histogram", e);
|
|
||||||
+ LOG.debug("Unable to unregister histogram", e);
|
|
||||||
} catch (MBeanRegistrationException e) {
|
|
||||||
- LOGGER.warn("Unable to unregister histogram", e);
|
|
||||||
+ LOG.warn("Unable to unregister histogram", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -649,9 +650,9 @@ public class JmxReporter implements Reporter, Closeable {
|
|
||||||
new JmxMeter(meter, objectName, timeUnits.rateFor(name.getKey())), objectName);
|
|
||||||
}
|
|
||||||
} catch (InstanceAlreadyExistsException e) {
|
|
||||||
- LOGGER.debug("Unable to register meter", e);
|
|
||||||
+ LOG.debug("Unable to register meter", e);
|
|
||||||
} catch (JMException e) {
|
|
||||||
- LOGGER.warn("Unable to register meter", e);
|
|
||||||
+ LOG.warn("Unable to register meter", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -661,9 +662,9 @@ public class JmxReporter implements Reporter, Closeable {
|
|
||||||
final ObjectName objectName = createName("meters", name);
|
|
||||||
unregisterMBean(objectName);
|
|
||||||
} catch (InstanceNotFoundException e) {
|
|
||||||
- LOGGER.debug("Unable to unregister meter", e);
|
|
||||||
+ LOG.debug("Unable to unregister meter", e);
|
|
||||||
} catch (MBeanRegistrationException e) {
|
|
||||||
- LOGGER.warn("Unable to unregister meter", e);
|
|
||||||
+ LOG.warn("Unable to unregister meter", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -681,9 +682,9 @@ public class JmxReporter implements Reporter, Closeable {
|
|
||||||
objectName);
|
|
||||||
}
|
|
||||||
} catch (InstanceAlreadyExistsException e) {
|
|
||||||
- LOGGER.debug("Unable to register timer", e);
|
|
||||||
+ LOG.debug("Unable to register timer", e);
|
|
||||||
} catch (JMException e) {
|
|
||||||
- LOGGER.warn("Unable to register timer", e);
|
|
||||||
+ LOG.warn("Unable to register timer", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -693,9 +694,9 @@ public class JmxReporter implements Reporter, Closeable {
|
|
||||||
final ObjectName objectName = createName("timers", name);
|
|
||||||
unregisterMBean(objectName);
|
|
||||||
} catch (InstanceNotFoundException e) {
|
|
||||||
- LOGGER.debug("Unable to unregister timer", e);
|
|
||||||
+ LOG.debug("Unable to unregister timer", e);
|
|
||||||
} catch (MBeanRegistrationException e) {
|
|
||||||
- LOGGER.warn("Unable to unregister timer", e);
|
|
||||||
+ LOG.warn("Unable to unregister timer", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -708,9 +709,9 @@ public class JmxReporter implements Reporter, Closeable {
|
|
||||||
try {
|
|
||||||
unregisterMBean(name);
|
|
||||||
} catch (InstanceNotFoundException e) {
|
|
||||||
- LOGGER.debug("Unable to unregister metric", e);
|
|
||||||
+ LOG.debug("Unable to unregister metric", e);
|
|
||||||
} catch (MBeanRegistrationException e) {
|
|
||||||
- LOGGER.warn("Unable to unregister metric", e);
|
|
||||||
+ LOG.warn("Unable to unregister metric", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
registered.clear();
|
|
||||||
--- a/metrics-jmx/src/test/java/io/dropwizard/metrics5/jmx/DefaultObjectNameFactoryTest.java
|
--- a/metrics-jmx/src/test/java/io/dropwizard/metrics5/jmx/DefaultObjectNameFactoryTest.java
|
||||||
+++ b/metrics-jmx/src/test/java/io/dropwizard/metrics5/jmx/DefaultObjectNameFactoryTest.java
|
+++ b/metrics-jmx/src/test/java/io/dropwizard/metrics5/jmx/DefaultObjectNameFactoryTest.java
|
||||||
@@ -7,7 +7,7 @@ import io.dropwizard.metrics5.MetricName;
|
@@ -7,7 +7,7 @@ import io.dropwizard.metrics5.MetricName;
|
||||||
@@ -9002,21 +8733,7 @@
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.management.JMException;
|
import javax.management.JMException;
|
||||||
@@ -19,7 +20,7 @@ import org.slf4j.LoggerFactory;
|
@@ -47,6 +48,6 @@ public class BufferPoolMetricSet implements MetricSet {
|
||||||
* <p>These JMX objects are only available on Java 7 and above.
|
|
||||||
*/
|
|
||||||
public class BufferPoolMetricSet implements MetricSet {
|
|
||||||
- private static final Logger LOGGER = LoggerFactory.getLogger(BufferPoolMetricSet.class);
|
|
||||||
+ private static final Logger LOG = LoggerFactory.getLogger(BufferPoolMetricSet.class);
|
|
||||||
private static final String[] ATTRIBUTES = {"Count", "MemoryUsed", "TotalCapacity"};
|
|
||||||
private static final String[] NAMES = {"count", "used", "capacity"};
|
|
||||||
private static final String[] POOLS = {"direct", "mapped"};
|
|
||||||
@@ -43,10 +44,10 @@ public class BufferPoolMetricSet implements MetricSet {
|
|
||||||
gauges.put(
|
|
||||||
MetricRegistry.name(pool, name), new JmxAttributeGauge(mBeanServer, on, attribute));
|
|
||||||
} catch (JMException ignored) {
|
|
||||||
- LOGGER.debug("Unable to load buffer pool MBeans, possibly running on Java 6");
|
|
||||||
+ LOG.debug("Unable to load buffer pool MBeans, possibly running on Java 6");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ metrics-collectd/src/main/java/io/dropwizard/metrics5/collectd/PacketWriter.java
|
|||||||
metrics-core/src/main/java/io/dropwizard/metrics5/CsvReporter.java:[390,35] [FormatStringConcatenation] Defer string concatenation to the invoked method
|
metrics-core/src/main/java/io/dropwizard/metrics5/CsvReporter.java:[390,35] [FormatStringConcatenation] Defer string concatenation to the invoked method
|
||||||
metrics-core/src/main/java/io/dropwizard/metrics5/InstrumentedExecutorService.java:[244,25] [try] auto-closeable resource durationContext is never referenced in body of corresponding try statement
|
metrics-core/src/main/java/io/dropwizard/metrics5/InstrumentedExecutorService.java:[244,25] [try] auto-closeable resource durationContext is never referenced in body of corresponding try statement
|
||||||
metrics-core/src/main/java/io/dropwizard/metrics5/InstrumentedExecutorService.java:[266,25] [try] auto-closeable resource context is never referenced in body of corresponding try statement
|
metrics-core/src/main/java/io/dropwizard/metrics5/InstrumentedExecutorService.java:[266,25] [try] auto-closeable resource context is never referenced in body of corresponding try statement
|
||||||
metrics-graphite/src/main/java/io/dropwizard/metrics5/graphite/GraphiteReporter.java:[431,14] [Slf4jLogStatement] Log statement contains 0 placeholders, but specifies 1 matching argument(s)
|
metrics-graphite/src/main/java/io/dropwizard/metrics5/graphite/GraphiteReporter.java:[431,17] [Slf4jLogStatement] Log statement contains 0 placeholders, but specifies 1 matching argument(s)
|
||||||
metrics-graphite/src/main/java/io/dropwizard/metrics5/graphite/GraphiteReporter.java:[436,16] [Slf4jLogStatement] Log statement contains 0 placeholders, but specifies 1 matching argument(s)
|
metrics-graphite/src/main/java/io/dropwizard/metrics5/graphite/GraphiteReporter.java:[436,19] [Slf4jLogStatement] Log statement contains 0 placeholders, but specifies 1 matching argument(s)
|
||||||
metrics-graphite/src/main/java/io/dropwizard/metrics5/graphite/GraphiteReporter.java:[449,17] [Slf4jLogStatement] Log statement contains 0 placeholders, but specifies 1 matching argument(s)
|
metrics-graphite/src/main/java/io/dropwizard/metrics5/graphite/GraphiteReporter.java:[449,20] [Slf4jLogStatement] Log statement contains 0 placeholders, but specifies 1 matching argument(s)
|
||||||
metrics-healthchecks/src/test/java/io/dropwizard/metrics5/health/HealthCheckTest.java:[189,46] [TimeZoneUsage] Derive the current time from an existing `Clock` Spring bean, and don't rely on a `Clock`'s time zone
|
metrics-healthchecks/src/test/java/io/dropwizard/metrics5/health/HealthCheckTest.java:[189,46] [TimeZoneUsage] Derive the current time from an existing `Clock` Spring bean, and don't rely on a `Clock`'s time zone
|
||||||
metrics-healthchecks/src/test/java/io/dropwizard/metrics5/health/HealthCheckTest.java:[203,46] [TimeZoneUsage] Derive the current time from an existing `Clock` Spring bean, and don't rely on a `Clock`'s time zone
|
metrics-healthchecks/src/test/java/io/dropwizard/metrics5/health/HealthCheckTest.java:[203,46] [TimeZoneUsage] Derive the current time from an existing `Clock` Spring bean, and don't rely on a `Clock`'s time zone
|
||||||
metrics-httpclient/src/test/java/io/dropwizard/metrics5/httpclient/HttpClientMetricNameStrategiesTest.java:[124,22] [deprecation] rewriteURI(URI,HttpHost,boolean) in URIUtils has been deprecated
|
metrics-httpclient/src/test/java/io/dropwizard/metrics5/httpclient/HttpClientMetricNameStrategiesTest.java:[124,22] [deprecation] rewriteURI(URI,HttpHost,boolean) in URIUtils has been deprecated
|
||||||
@@ -26,8 +26,8 @@ metrics-httpclient5/src/main/java/io/dropwizard/metrics5/httpclient5/Instrumente
|
|||||||
metrics-httpclient5/src/main/java/io/dropwizard/metrics5/httpclient5/InstrumentedHttpRequestExecutor.java:[49,4] [deprecation] HttpRequestExecutor(Timeout,ConnectionReuseStrategy,Http1StreamListener) in HttpRequestExecutor has been deprecated
|
metrics-httpclient5/src/main/java/io/dropwizard/metrics5/httpclient5/InstrumentedHttpRequestExecutor.java:[49,4] [deprecation] HttpRequestExecutor(Timeout,ConnectionReuseStrategy,Http1StreamListener) in HttpRequestExecutor has been deprecated
|
||||||
metrics-httpclient5/src/test/java/io/dropwizard/metrics5/httpclient5/InstrumentedHttpClientsTest.java:[46,10] [deprecation] execute(ClassicHttpRequest) in HttpClient has been deprecated
|
metrics-httpclient5/src/test/java/io/dropwizard/metrics5/httpclient5/InstrumentedHttpClientsTest.java:[46,10] [deprecation] execute(ClassicHttpRequest) in HttpClient has been deprecated
|
||||||
metrics-httpclient5/src/test/java/io/dropwizard/metrics5/httpclient5/InstrumentedHttpClientsTest.java:[68,12] [deprecation] execute(ClassicHttpRequest) in HttpClient has been deprecated
|
metrics-httpclient5/src/test/java/io/dropwizard/metrics5/httpclient5/InstrumentedHttpClientsTest.java:[68,12] [deprecation] execute(ClassicHttpRequest) in HttpClient has been deprecated
|
||||||
metrics-influxdb/src/main/java/io/dropwizard/metrics5/influxdb/InfluxDbReporter.java:[282,14] [Slf4jLogStatement] Log statement contains 0 placeholders, but specifies 1 matching argument(s)
|
metrics-influxdb/src/main/java/io/dropwizard/metrics5/influxdb/InfluxDbReporter.java:[282,17] [Slf4jLogStatement] Log statement contains 0 placeholders, but specifies 1 matching argument(s)
|
||||||
metrics-influxdb/src/main/java/io/dropwizard/metrics5/influxdb/InfluxDbReporter.java:[287,16] [Slf4jLogStatement] Log statement contains 0 placeholders, but specifies 1 matching argument(s)
|
metrics-influxdb/src/main/java/io/dropwizard/metrics5/influxdb/InfluxDbReporter.java:[287,19] [Slf4jLogStatement] Log statement contains 0 placeholders, but specifies 1 matching argument(s)
|
||||||
metrics-jakarta-servlets/src/test/java/io/dropwizard/metrics5/servlets/HealthCheckServletTest.java:[31,67] [TimeZoneUsage] Derive the current time from an existing `Clock` Spring bean, and don't rely on a `Clock`'s time zone
|
metrics-jakarta-servlets/src/test/java/io/dropwizard/metrics5/servlets/HealthCheckServletTest.java:[31,67] [TimeZoneUsage] Derive the current time from an existing `Clock` Spring bean, and don't rely on a `Clock`'s time zone
|
||||||
metrics-jdbi3/src/test/java/io/dropwizard/metrics5/jdbi3/strategies/SmartNameStrategyTest.java:[18,10] [deprecation] InstrumentedTimingCollector in io.dropwizard.metrics5.jdbi3 has been deprecated
|
metrics-jdbi3/src/test/java/io/dropwizard/metrics5/jdbi3/strategies/SmartNameStrategyTest.java:[18,10] [deprecation] InstrumentedTimingCollector in io.dropwizard.metrics5.jdbi3 has been deprecated
|
||||||
metrics-jdbi3/src/test/java/io/dropwizard/metrics5/jdbi3/strategies/SmartNameStrategyTest.java:[24,20] [deprecation] InstrumentedTimingCollector in io.dropwizard.metrics5.jdbi3 has been deprecated
|
metrics-jdbi3/src/test/java/io/dropwizard/metrics5/jdbi3/strategies/SmartNameStrategyTest.java:[24,20] [deprecation] InstrumentedTimingCollector in io.dropwizard.metrics5.jdbi3 has been deprecated
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
+ <dependency>
|
+ <dependency>
|
||||||
+ <groupId>com.google.guava</groupId>
|
+ <groupId>com.google.guava</groupId>
|
||||||
+ <artifactId>guava</artifactId>
|
+ <artifactId>guava</artifactId>
|
||||||
+ <version>33.4.0-jre<!-- Renovate: com.google.guava:guava-bom --></version>
|
+ <version>33.4.7-jre<!-- Renovate: com.google.guava:guava-bom --></version>
|
||||||
+ </dependency>
|
+ </dependency>
|
||||||
+ </dependencies>
|
+ </dependencies>
|
||||||
+ </dependencyManagement>
|
+ </dependencyManagement>
|
||||||
|
|||||||
@@ -8,11 +8,7 @@ repository='https://github.com/dropwizard/metrics.git'
|
|||||||
revision='v5.0.0-rc22'
|
revision='v5.0.0-rc22'
|
||||||
additional_build_flags=''
|
additional_build_flags=''
|
||||||
additional_source_directories=''
|
additional_source_directories=''
|
||||||
# XXX: Minimize the diff by including
|
shared_error_prone_flags='-XepExcludedPaths:.*/target/generated-sources/.* -XepOpt:Slf4jLoggerDeclaration:CanonicalStaticLoggerName=LOGGER'
|
||||||
# `-XepOpt:Slf4jLoggerDeclaration:CanonicalStaticLoggerName=LOGGER` once such
|
|
||||||
# flags are supported in patch mode. See
|
|
||||||
# https://github.com/google/error-prone/pull/4699.
|
|
||||||
shared_error_prone_flags='-XepExcludedPaths:.*/target/generated-sources/.*'
|
|
||||||
patch_error_prone_flags=''
|
patch_error_prone_flags=''
|
||||||
validation_error_prone_flags=''
|
validation_error_prone_flags=''
|
||||||
validation_build_flags=''
|
validation_build_flags=''
|
||||||
|
|||||||
138
pom.xml
138
pom.xml
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<groupId>tech.picnic.error-prone-support</groupId>
|
<groupId>tech.picnic.error-prone-support</groupId>
|
||||||
<artifactId>error-prone-support</artifactId>
|
<artifactId>error-prone-support</artifactId>
|
||||||
<version>0.20.0</version>
|
<version>0.22.1-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<name>Picnic :: Error Prone Support</name>
|
<name>Picnic :: Error Prone Support</name>
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
<scm child.scm.developerConnection.inherit.append.path="false" child.scm.url.inherit.append.path="false">
|
<scm child.scm.developerConnection.inherit.append.path="false" child.scm.url.inherit.append.path="false">
|
||||||
<developerConnection>scm:git:git@github.com:PicnicSupermarket/error-prone-support.git</developerConnection>
|
<developerConnection>scm:git:git@github.com:PicnicSupermarket/error-prone-support.git</developerConnection>
|
||||||
<tag>v0.20.0</tag>
|
<tag>HEAD</tag>
|
||||||
<url>https://github.com/PicnicSupermarket/error-prone-support</url>
|
<url>https://github.com/PicnicSupermarket/error-prone-support</url>
|
||||||
</scm>
|
</scm>
|
||||||
<issueManagement>
|
<issueManagement>
|
||||||
@@ -146,7 +146,7 @@
|
|||||||
<error-prone.self-check-args />
|
<error-prone.self-check-args />
|
||||||
<!-- The build timestamp is derived from the most recent commit
|
<!-- The build timestamp is derived from the most recent commit
|
||||||
timestamp in support of reproducible builds. -->
|
timestamp in support of reproducible builds. -->
|
||||||
<project.build.outputTimestamp>2025-02-02T12:14:39Z</project.build.outputTimestamp>
|
<project.build.outputTimestamp>2025-04-14T09:36:15Z</project.build.outputTimestamp>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<!-- Glob pattern identifying Refaster rule definition files. These
|
<!-- Glob pattern identifying Refaster rule definition files. These
|
||||||
Java classes don't contain "regular" code, and thus require special
|
Java classes don't contain "regular" code, and thus require special
|
||||||
@@ -205,17 +205,17 @@
|
|||||||
<version.auto-service>1.1.1</version.auto-service>
|
<version.auto-service>1.1.1</version.auto-service>
|
||||||
<version.auto-value>1.11.0</version.auto-value>
|
<version.auto-value>1.11.0</version.auto-value>
|
||||||
<version.error-prone>${version.error-prone-orig}</version.error-prone>
|
<version.error-prone>${version.error-prone-orig}</version.error-prone>
|
||||||
<version.error-prone-fork>${version.error-prone-orig}-picnic-2</version.error-prone-fork>
|
<version.error-prone-fork>${version.error-prone-orig}-picnic-1</version.error-prone-fork>
|
||||||
<version.error-prone-orig>2.36.0</version.error-prone-orig>
|
<version.error-prone-orig>2.37.0</version.error-prone-orig>
|
||||||
<version.error-prone-slf4j>0.1.28</version.error-prone-slf4j>
|
<version.error-prone-slf4j>0.1.28</version.error-prone-slf4j>
|
||||||
<version.guava-beta-checker>1.0</version.guava-beta-checker>
|
<version.guava-beta-checker>1.0</version.guava-beta-checker>
|
||||||
<version.jdk>17</version.jdk>
|
<version.jdk>17</version.jdk>
|
||||||
<version.maven>3.9.9</version.maven>
|
<version.maven>3.9.9</version.maven>
|
||||||
<version.mockito>5.15.2</version.mockito>
|
<version.mockito>5.17.0</version.mockito>
|
||||||
<version.nopen-checker>1.0.1</version.nopen-checker>
|
<version.nopen-checker>1.0.1</version.nopen-checker>
|
||||||
<version.nullaway>0.12.3</version.nullaway>
|
<version.nullaway>0.12.6</version.nullaway>
|
||||||
<version.pitest-git>1.1.4</version.pitest-git>
|
<version.pitest-git>2.2.1</version.pitest-git>
|
||||||
<version.rewrite-templating>1.22.0</version.rewrite-templating>
|
<version.rewrite-templating>1.25.1</version.rewrite-templating>
|
||||||
<version.surefire>3.2.3</version.surefire>
|
<version.surefire>3.2.3</version.surefire>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
@@ -269,7 +269,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson</groupId>
|
<groupId>com.fasterxml.jackson</groupId>
|
||||||
<artifactId>jackson-bom</artifactId>
|
<artifactId>jackson-bom</artifactId>
|
||||||
<version>2.18.2</version>
|
<version>2.18.3</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
@@ -303,6 +303,16 @@
|
|||||||
<artifactId>auto-value-annotations</artifactId>
|
<artifactId>auto-value-annotations</artifactId>
|
||||||
<version>${version.auto-value}</version>
|
<version>${version.auto-value}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- XXX: JSR-305 (meta-)annotation usage by some dependencies
|
||||||
|
triggers NullAway to attempt to load said annotations. As such
|
||||||
|
some modules require these annotations to be on the classpath.
|
||||||
|
Periodically review whether we can drop this dependeny version
|
||||||
|
declaration. See https://github.com/uber/NullAway/issues/1171. -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.code.findbugs</groupId>
|
||||||
|
<artifactId>jsr305</artifactId>
|
||||||
|
<version>3.0.2</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.errorprone</groupId>
|
<groupId>com.google.errorprone</groupId>
|
||||||
<artifactId>error_prone_annotation</artifactId>
|
<artifactId>error_prone_annotation</artifactId>
|
||||||
@@ -331,7 +341,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.googlejavaformat</groupId>
|
<groupId>com.google.googlejavaformat</groupId>
|
||||||
<artifactId>google-java-format</artifactId>
|
<artifactId>google-java-format</artifactId>
|
||||||
<version>1.25.2</version>
|
<version>1.26.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
@@ -341,7 +351,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava-bom</artifactId>
|
<artifactId>guava-bom</artifactId>
|
||||||
<version>33.4.0-jre</version>
|
<version>33.4.7-jre</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
@@ -363,14 +373,14 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.micrometer</groupId>
|
<groupId>io.micrometer</groupId>
|
||||||
<artifactId>micrometer-bom</artifactId>
|
<artifactId>micrometer-bom</artifactId>
|
||||||
<version>1.14.3</version>
|
<version>1.14.6</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.projectreactor</groupId>
|
<groupId>io.projectreactor</groupId>
|
||||||
<artifactId>reactor-bom</artifactId>
|
<artifactId>reactor-bom</artifactId>
|
||||||
<version>2024.0.2</version>
|
<version>2024.0.5</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
@@ -387,7 +397,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.swagger.core.v3</groupId>
|
<groupId>io.swagger.core.v3</groupId>
|
||||||
<artifactId>swagger-annotations</artifactId>
|
<artifactId>swagger-annotations</artifactId>
|
||||||
<version>2.2.28</version>
|
<version>2.2.30</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>jakarta.servlet</groupId>
|
<groupId>jakarta.servlet</groupId>
|
||||||
@@ -422,7 +432,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.bytebuddy</groupId>
|
<groupId>net.bytebuddy</groupId>
|
||||||
<artifactId>byte-buddy</artifactId>
|
<artifactId>byte-buddy</artifactId>
|
||||||
<version>1.17.0</version>
|
<version>1.17.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- Specified so that Renovate will file Maven upgrade PRs, which
|
<!-- Specified so that Renovate will file Maven upgrade PRs, which
|
||||||
subsequently will cause `maven-enforcer-plugin` to require that
|
subsequently will cause `maven-enforcer-plugin` to require that
|
||||||
@@ -435,7 +445,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.aspectj</groupId>
|
<groupId>org.aspectj</groupId>
|
||||||
<artifactId>aspectjweaver</artifactId>
|
<artifactId>aspectjweaver</artifactId>
|
||||||
<version>1.9.22.1</version>
|
<version>1.9.24</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.assertj</groupId>
|
<groupId>org.assertj</groupId>
|
||||||
@@ -447,7 +457,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.checkerframework</groupId>
|
<groupId>org.checkerframework</groupId>
|
||||||
<artifactId>checker-qual</artifactId>
|
<artifactId>checker-qual</artifactId>
|
||||||
<version>3.48.4</version>
|
<version>3.49.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hamcrest</groupId>
|
<groupId>org.hamcrest</groupId>
|
||||||
@@ -472,7 +482,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit</groupId>
|
<groupId>org.junit</groupId>
|
||||||
<artifactId>junit-bom</artifactId>
|
<artifactId>junit-bom</artifactId>
|
||||||
<version>5.11.4</version>
|
<version>5.12.2</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
@@ -485,8 +495,10 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mongodb</groupId>
|
<groupId>org.mongodb</groupId>
|
||||||
<artifactId>mongodb-driver-core</artifactId>
|
<artifactId>mongodb-driver-bom</artifactId>
|
||||||
<version>5.3.1</version>
|
<version>5.4.0</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openrewrite</groupId>
|
<groupId>org.openrewrite</groupId>
|
||||||
@@ -496,40 +508,40 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openrewrite.recipe</groupId>
|
<groupId>org.openrewrite.recipe</groupId>
|
||||||
<artifactId>rewrite-recipe-bom</artifactId>
|
<artifactId>rewrite-recipe-bom</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.6.1</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-bom</artifactId>
|
<artifactId>slf4j-bom</artifactId>
|
||||||
<version>2.0.16</version>
|
<version>2.0.17</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-framework-bom</artifactId>
|
<artifactId>spring-framework-bom</artifactId>
|
||||||
<version>6.2.2</version>
|
<version>6.2.5</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-test</artifactId>
|
<artifactId>spring-boot-test</artifactId>
|
||||||
<version>3.4.2</version>
|
<version>3.4.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.security</groupId>
|
<groupId>org.springframework.security</groupId>
|
||||||
<artifactId>spring-security-bom</artifactId>
|
<artifactId>spring-security-bom</artifactId>
|
||||||
<version>6.4.2</version>
|
<version>6.4.4</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.testng</groupId>
|
<groupId>org.testng</groupId>
|
||||||
<artifactId>testng</artifactId>
|
<artifactId>testng</artifactId>
|
||||||
<version>7.10.2</version>
|
<version>7.11.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
@@ -548,6 +560,16 @@
|
|||||||
<build>
|
<build>
|
||||||
<pluginManagement>
|
<pluginManagement>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.arcmutate</groupId>
|
||||||
|
<artifactId>pitest-git-maven-plugin</artifactId>
|
||||||
|
<version>${version.pitest-git}</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.arcmutate</groupId>
|
||||||
|
<artifactId>pitest-github-maven-plugin</artifactId>
|
||||||
|
<version>${version.pitest-git}</version>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>com.github.ekryd.sortpom</groupId>
|
<groupId>com.github.ekryd.sortpom</groupId>
|
||||||
<artifactId>sortpom-maven-plugin</artifactId>
|
<artifactId>sortpom-maven-plugin</artifactId>
|
||||||
@@ -575,16 +597,6 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>com.groupcdg</groupId>
|
|
||||||
<artifactId>pitest-git-maven-plugin</artifactId>
|
|
||||||
<version>${version.pitest-git}</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>com.groupcdg</groupId>
|
|
||||||
<artifactId>pitest-github-maven-plugin</artifactId>
|
|
||||||
<version>${version.pitest-git}</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>com.spotify.fmt</groupId>
|
<groupId>com.spotify.fmt</groupId>
|
||||||
<artifactId>fmt-maven-plugin</artifactId>
|
<artifactId>fmt-maven-plugin</artifactId>
|
||||||
@@ -608,7 +620,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>de.thetaphi</groupId>
|
<groupId>de.thetaphi</groupId>
|
||||||
<artifactId>forbiddenapis</artifactId>
|
<artifactId>forbiddenapis</artifactId>
|
||||||
<version>3.8</version>
|
<version>3.9</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<bundledSignatures>
|
<bundledSignatures>
|
||||||
<bundledSignature>jdk-internal</bundledSignature>
|
<bundledSignature>jdk-internal</bundledSignature>
|
||||||
@@ -923,7 +935,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.puppycrawl.tools</groupId>
|
<groupId>com.puppycrawl.tools</groupId>
|
||||||
<artifactId>checkstyle</artifactId>
|
<artifactId>checkstyle</artifactId>
|
||||||
<version>10.21.2</version>
|
<version>10.23.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.spring.nohttp</groupId>
|
<groupId>io.spring.nohttp</groupId>
|
||||||
@@ -943,12 +955,12 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-clean-plugin</artifactId>
|
<artifactId>maven-clean-plugin</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.13.0</version>
|
<version>3.14.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<annotationProcessorPaths>
|
<annotationProcessorPaths>
|
||||||
<!-- XXX: Inline and drop the version
|
<!-- XXX: Inline and drop the version
|
||||||
@@ -1056,7 +1068,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-deploy-plugin</artifactId>
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
<version>3.1.3</version>
|
<version>3.1.4</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<retryFailedDeploymentCount>3</retryFailedDeploymentCount>
|
<retryFailedDeploymentCount>3</retryFailedDeploymentCount>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -1134,7 +1146,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>extra-enforcer-rules</artifactId>
|
<artifactId>extra-enforcer-rules</artifactId>
|
||||||
<version>1.9.0</version>
|
<version>1.10.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<executions>
|
<executions>
|
||||||
@@ -1162,7 +1174,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-install-plugin</artifactId>
|
<artifactId>maven-install-plugin</artifactId>
|
||||||
<version>3.1.3</version>
|
<version>3.1.4</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
@@ -1298,7 +1310,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>3.5.2</version>
|
<version>3.5.3</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<includes>
|
<includes>
|
||||||
<include>**/*Test.java</include>
|
<include>**/*Test.java</include>
|
||||||
@@ -1306,6 +1318,7 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<configurationParameters>junit.jupiter.execution.parallel.enabled=true
|
<configurationParameters>junit.jupiter.execution.parallel.enabled=true
|
||||||
junit.jupiter.execution.parallel.mode.default=concurrent
|
junit.jupiter.execution.parallel.mode.default=concurrent
|
||||||
|
junit.jupiter.execution.timeout.threaddump.enabled=true
|
||||||
junit.platform.stacktrace.pruning.enabled=false</configurationParameters>
|
junit.platform.stacktrace.pruning.enabled=false</configurationParameters>
|
||||||
</properties>
|
</properties>
|
||||||
<redirectTestOutputToFile>true</redirectTestOutputToFile>
|
<redirectTestOutputToFile>true</redirectTestOutputToFile>
|
||||||
@@ -1442,7 +1455,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>tidy-maven-plugin</artifactId>
|
<artifactId>tidy-maven-plugin</artifactId>
|
||||||
<version>1.3.0</version>
|
<version>1.4.0</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>check-pom</id>
|
<id>check-pom</id>
|
||||||
@@ -1494,7 +1507,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.jacoco</groupId>
|
<groupId>org.jacoco</groupId>
|
||||||
<artifactId>jacoco-maven-plugin</artifactId>
|
<artifactId>jacoco-maven-plugin</artifactId>
|
||||||
<version>0.8.12</version>
|
<version>0.8.13</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<excludes>
|
<excludes>
|
||||||
<!-- Refaster rules are tested using a custom method
|
<!-- Refaster rules are tested using a custom method
|
||||||
@@ -1524,7 +1537,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.pitest</groupId>
|
<groupId>org.pitest</groupId>
|
||||||
<artifactId>pitest-maven</artifactId>
|
<artifactId>pitest-maven</artifactId>
|
||||||
<version>1.17.4</version>
|
<version>1.19.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<excludedClasses>
|
<excludedClasses>
|
||||||
<!-- AutoValue generated classes. -->
|
<!-- AutoValue generated classes. -->
|
||||||
@@ -1546,24 +1559,24 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.groupcdg</groupId>
|
<groupId>com.arcmutate</groupId>
|
||||||
|
<artifactId>base</artifactId>
|
||||||
|
<version>1.4.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.arcmutate</groupId>
|
||||||
|
<artifactId>pitest-accelerator-junit5</artifactId>
|
||||||
|
<version>1.2.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.arcmutate</groupId>
|
||||||
<artifactId>pitest-git-plugin</artifactId>
|
<artifactId>pitest-git-plugin</artifactId>
|
||||||
<version>${version.pitest-git}</version>
|
<version>${version.pitest-git}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.groupcdg.arcmutate</groupId>
|
|
||||||
<artifactId>base</artifactId>
|
|
||||||
<version>1.2.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.groupcdg.pitest</groupId>
|
|
||||||
<artifactId>pitest-accelerator-junit5</artifactId>
|
|
||||||
<version>1.0.6</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.pitest</groupId>
|
<groupId>org.pitest</groupId>
|
||||||
<artifactId>pitest-junit5-plugin</artifactId>
|
<artifactId>pitest-junit5-plugin</artifactId>
|
||||||
<version>1.2.1</version>
|
<version>1.2.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<executions>
|
<executions>
|
||||||
@@ -1578,7 +1591,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.sonarsource.scanner.maven</groupId>
|
<groupId>org.sonarsource.scanner.maven</groupId>
|
||||||
<artifactId>sonar-maven-plugin</artifactId>
|
<artifactId>sonar-maven-plugin</artifactId>
|
||||||
<version>5.0.0.4389</version>
|
<version>5.1.0.4751</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</pluginManagement>
|
</pluginManagement>
|
||||||
@@ -1937,10 +1950,9 @@
|
|||||||
-XepOpt:NullAway:AnnotatedPackages=tech.picnic
|
-XepOpt:NullAway:AnnotatedPackages=tech.picnic
|
||||||
-XepOpt:NullAway:AssertsEnabled=true
|
-XepOpt:NullAway:AssertsEnabled=true
|
||||||
-XepOpt:NullAway:CheckOptionalEmptiness=true
|
-XepOpt:NullAway:CheckOptionalEmptiness=true
|
||||||
|
-XepOpt:NullAway:JSpecifyMode=true
|
||||||
-XepOpt:Nullness:Conservative=false
|
-XepOpt:Nullness:Conservative=false
|
||||||
-XepOpt:StatementSwitchToExpressionSwitch:EnableAssignmentSwitchConversion=true
|
|
||||||
-XepOpt:StatementSwitchToExpressionSwitch:EnableDirectConversion=true
|
-XepOpt:StatementSwitchToExpressionSwitch:EnableDirectConversion=true
|
||||||
-XepOpt:StatementSwitchToExpressionSwitch:EnableReturnSwitchConversion=true
|
|
||||||
<!-- Append additional custom arguments. -->
|
<!-- Append additional custom arguments. -->
|
||||||
${error-prone.patch-args}
|
${error-prone.patch-args}
|
||||||
${error-prone.self-check-args}
|
${error-prone.self-check-args}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>tech.picnic.error-prone-support</groupId>
|
<groupId>tech.picnic.error-prone-support</groupId>
|
||||||
<artifactId>error-prone-support</artifactId>
|
<artifactId>error-prone-support</artifactId>
|
||||||
<version>0.20.0</version>
|
<version>0.22.1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>refaster-compiler</artifactId>
|
<artifactId>refaster-compiler</artifactId>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>tech.picnic.error-prone-support</groupId>
|
<groupId>tech.picnic.error-prone-support</groupId>
|
||||||
<artifactId>error-prone-support</artifactId>
|
<artifactId>error-prone-support</artifactId>
|
||||||
<version>0.20.0</version>
|
<version>0.22.1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>refaster-runner</artifactId>
|
<artifactId>refaster-runner</artifactId>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>tech.picnic.error-prone-support</groupId>
|
<groupId>tech.picnic.error-prone-support</groupId>
|
||||||
<artifactId>error-prone-support</artifactId>
|
<artifactId>error-prone-support</artifactId>
|
||||||
<version>0.20.0</version>
|
<version>0.22.1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>refaster-support</artifactId>
|
<artifactId>refaster-support</artifactId>
|
||||||
|
|||||||
@@ -118,11 +118,12 @@ public final class IsEmpty implements Matcher<ExpressionTree> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isEmptyCollectionConstructor(ExpressionTree tree, VisitorState state) {
|
private boolean isEmptyCollectionConstructor(ExpressionTree tree, VisitorState state) {
|
||||||
if (!(tree instanceof NewClassTree) || !MUTABLE_COLLECTION_TYPE.matches(tree, state)) {
|
if (!(tree instanceof NewClassTree newClassTree)
|
||||||
|
|| !MUTABLE_COLLECTION_TYPE.matches(tree, state)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<? extends ExpressionTree> arguments = ((NewClassTree) tree).getArguments();
|
List<? extends ExpressionTree> arguments = newClassTree.getArguments();
|
||||||
if (arguments.stream().allMatch(a -> EMPTY_COLLECTION_CONSTRUCTOR_ARGUMENT.matches(a, state))) {
|
if (arguments.stream().allMatch(a -> EMPTY_COLLECTION_CONSTRUCTOR_ARGUMENT.matches(a, state))) {
|
||||||
/*
|
/*
|
||||||
* This is a default constructor, or a constructor that creates an empty collection using
|
* This is a default constructor, or a constructor that creates an empty collection using
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>tech.picnic.error-prone-support</groupId>
|
<groupId>tech.picnic.error-prone-support</groupId>
|
||||||
<artifactId>error-prone-support</artifactId>
|
<artifactId>error-prone-support</artifactId>
|
||||||
<version>0.20.0</version>
|
<version>0.22.1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>refaster-test-support</artifactId>
|
<artifactId>refaster-test-support</artifactId>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
|||||||
import static com.google.common.collect.ImmutableSortedSet.toImmutableSortedSet;
|
import static com.google.common.collect.ImmutableSortedSet.toImmutableSortedSet;
|
||||||
import static com.google.errorprone.BugPattern.LinkType.NONE;
|
import static com.google.errorprone.BugPattern.LinkType.NONE;
|
||||||
import static com.google.errorprone.BugPattern.SeverityLevel.ERROR;
|
import static com.google.errorprone.BugPattern.SeverityLevel.ERROR;
|
||||||
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
import static java.util.Comparator.naturalOrder;
|
import static java.util.Comparator.naturalOrder;
|
||||||
import static tech.picnic.errorprone.refaster.runner.Refaster.INCLUDED_RULES_PATTERN_FLAG;
|
import static tech.picnic.errorprone.refaster.runner.Refaster.INCLUDED_RULES_PATTERN_FLAG;
|
||||||
|
|
||||||
@@ -17,6 +18,7 @@ import com.google.common.collect.ImmutableSortedSet;
|
|||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Range;
|
import com.google.common.collect.Range;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
import com.google.common.io.Resources;
|
||||||
import com.google.errorprone.BugCheckerRefactoringTestHelper;
|
import com.google.errorprone.BugCheckerRefactoringTestHelper;
|
||||||
import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;
|
import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;
|
||||||
import com.google.errorprone.BugPattern;
|
import com.google.errorprone.BugPattern;
|
||||||
@@ -38,6 +40,9 @@ import com.sun.source.util.TreeScanner;
|
|||||||
import com.sun.tools.javac.tree.EndPosTable;
|
import com.sun.tools.javac.tree.EndPosTable;
|
||||||
import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
|
import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
|
||||||
import com.sun.tools.javac.util.Position;
|
import com.sun.tools.javac.util.Position;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.UncheckedIOException;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -124,13 +129,15 @@ public final class RefasterRuleCollection extends BugChecker implements Compilat
|
|||||||
*/
|
*/
|
||||||
public static void validate(Class<?> clazz) {
|
public static void validate(Class<?> clazz) {
|
||||||
String className = clazz.getSimpleName();
|
String className = clazz.getSimpleName();
|
||||||
|
String inputResource = className + "TestInput.java";
|
||||||
|
String outputResource = className + "TestOutput.java";
|
||||||
|
|
||||||
BugCheckerRefactoringTestHelper.newInstance(RefasterRuleCollection.class, clazz)
|
BugCheckerRefactoringTestHelper.newInstance(RefasterRuleCollection.class, clazz)
|
||||||
.setArgs(
|
.setArgs(
|
||||||
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
|
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
|
||||||
"-XepOpt:" + RULE_COLLECTION_FLAG + '=' + className)
|
"-XepOpt:" + RULE_COLLECTION_FLAG + '=' + className)
|
||||||
.addInput(className + "TestInput.java")
|
.addInputLines(inputResource, loadResource(clazz, inputResource))
|
||||||
.addOutput(className + "TestOutput.java")
|
.addOutputLines(outputResource, loadResource(clazz, outputResource))
|
||||||
.doTest(TestMode.TEXT_MATCH);
|
.doTest(TestMode.TEXT_MATCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,6 +254,15 @@ public final class RefasterRuleCollection extends BugChecker implements Compilat
|
|||||||
return value.substring(index + 1);
|
return value.substring(index + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String loadResource(Class<?> contextClass, String resource) {
|
||||||
|
URL url = Resources.getResource(contextClass, resource);
|
||||||
|
try {
|
||||||
|
return Resources.toString(url, UTF_8);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new UncheckedIOException("Cannot find resource: " + url, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class UnexpectedMatchReporter extends TreeScanner<@Nullable Void, VisitorState> {
|
private class UnexpectedMatchReporter extends TreeScanner<@Nullable Void, VisitorState> {
|
||||||
private final ImmutableRangeMap<Integer, String> indexedMatches;
|
private final ImmutableRangeMap<Integer, String> indexedMatches;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,22 @@
|
|||||||
# An overview of Error Prone Support releases, along with compatible Error
|
# An overview of Error Prone Support releases, along with compatible Error
|
||||||
# Prone releases. This data was generated by `generate-version-compatibility-overview.sh`.
|
# Prone releases. This data was generated by `generate-version-compatibility-overview.sh`.
|
||||||
releases:
|
releases:
|
||||||
|
- version: 0.22.0
|
||||||
|
compatible:
|
||||||
|
- "2.37.0"
|
||||||
|
- version: 0.21.0
|
||||||
|
compatible:
|
||||||
|
- "2.37.0"
|
||||||
|
- version: 0.20.0
|
||||||
|
compatible:
|
||||||
|
- "2.36.0"
|
||||||
|
- "2.35.1"
|
||||||
|
- "2.35.0"
|
||||||
|
- "2.34.0"
|
||||||
|
- "2.33.0"
|
||||||
|
- "2.32.0"
|
||||||
|
- "2.31.0"
|
||||||
|
- "2.30.0"
|
||||||
- version: 0.19.1
|
- version: 0.19.1
|
||||||
compatible:
|
compatible:
|
||||||
- "2.36.0"
|
- "2.36.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user