mirror of
https://github.com/jlengrand/error-prone-support.git
synced 2026-03-10 15:49:33 +00:00
Compare commits
46 Commits
solutions-
...
rossendrij
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ac65e9f53 | ||
|
|
f793c73bba | ||
|
|
13684ec59d | ||
|
|
a51ff4de4e | ||
|
|
da9b313ff7 | ||
|
|
6a50fe2d9c | ||
|
|
ed32cbae06 | ||
|
|
00549a3ba6 | ||
|
|
13f1fa3167 | ||
|
|
6396def588 | ||
|
|
7599b0f22f | ||
|
|
08eb7e7699 | ||
|
|
89f918c23e | ||
|
|
f08fc344f5 | ||
|
|
99aa656a1e | ||
|
|
86fbaf7403 | ||
|
|
563012549a | ||
|
|
4f46eb30d2 | ||
|
|
2f30082127 | ||
|
|
548506fbbb | ||
|
|
cc69b87b89 | ||
|
|
8b4cba4ac9 | ||
|
|
ee0018114d | ||
|
|
51ec7bcbd4 | ||
|
|
1ff1d5705b | ||
|
|
78cac86a28 | ||
|
|
b9836c6017 | ||
|
|
75eb8d27e1 | ||
|
|
041778308b | ||
|
|
dddb602869 | ||
|
|
4dafc7e6ee | ||
|
|
79931df780 | ||
|
|
4dcfb10dd9 | ||
|
|
97989c6294 | ||
|
|
5825498bec | ||
|
|
713853dfe1 | ||
|
|
3b2a0b4563 | ||
|
|
b6bed8698a | ||
|
|
2ebd53050c | ||
|
|
952451c877 | ||
|
|
36f8b01add | ||
|
|
be6d3e555b | ||
|
|
d7a3fbe9af | ||
|
|
d18dd8af52 | ||
|
|
11d02d468e | ||
|
|
4ec0678147 |
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
||||
continue-on-error: ${{ matrix.experimental }}
|
||||
steps:
|
||||
- name: Install Harden-Runner
|
||||
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
|
||||
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
|
||||
with:
|
||||
disable-sudo: true
|
||||
egress-policy: block
|
||||
@@ -42,7 +42,7 @@ jobs:
|
||||
# additionally enabling all checks defined in this project and any Error
|
||||
# Prone checks available only from other artifact repositories.
|
||||
- name: Check out code and set up JDK and Maven
|
||||
uses: s4u/setup-maven-action@489441643219d2b93ee2a127b2402eb640a1b947 # v1.13.0
|
||||
uses: s4u/setup-maven-action@382542f77617f34e56bf83868920a4d45b7451e7 # v1.16.0
|
||||
with:
|
||||
java-version: ${{ matrix.jdk }}
|
||||
java-distribution: ${{ matrix.distribution }}
|
||||
@@ -54,6 +54,6 @@ jobs:
|
||||
- name: Build project with self-check against Error Prone fork
|
||||
run: mvn -T1C clean verify -Perror-prone-fork -Pnon-maven-central -Pself-check -s settings.xml
|
||||
- name: Remove installed project artifacts
|
||||
run: mvn build-helper:remove-project-artifact
|
||||
run: mvn dependency:purge-local-repository -DmanualInclude='${project.groupId}' -DresolutionFuzziness=groupId
|
||||
|
||||
# XXX: Enable Codecov once we "go public".
|
||||
|
||||
4
.github/workflows/codeql.yml
vendored
4
.github/workflows/codeql.yml
vendored
@@ -22,7 +22,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Install Harden-Runner
|
||||
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
|
||||
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
|
||||
with:
|
||||
disable-sudo: true
|
||||
egress-policy: block
|
||||
@@ -34,7 +34,7 @@ jobs:
|
||||
repo.maven.apache.org:443
|
||||
uploads.github.com:443
|
||||
- name: Check out code and set up JDK and Maven
|
||||
uses: s4u/setup-maven-action@489441643219d2b93ee2a127b2402eb640a1b947 # v1.13.0
|
||||
uses: s4u/setup-maven-action@382542f77617f34e56bf83868920a4d45b7451e7 # v1.16.0
|
||||
with:
|
||||
java-version: 17.0.13
|
||||
java-distribution: temurin
|
||||
|
||||
6
.github/workflows/deploy-website.yml
vendored
6
.github/workflows/deploy-website.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Install Harden-Runner
|
||||
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
|
||||
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
|
||||
with:
|
||||
disable-sudo: true
|
||||
egress-policy: block
|
||||
@@ -39,7 +39,7 @@ jobs:
|
||||
www.youtube.com:443
|
||||
youtrack.jetbrains.com:443
|
||||
- name: Check out code
|
||||
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: ruby/setup-ruby@7d3497fd78c07c0d84ebafa58d8dac60cd1f0763 # v1.199.0
|
||||
@@ -74,7 +74,7 @@ jobs:
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
steps:
|
||||
- name: Install Harden-Runner
|
||||
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
|
||||
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
|
||||
with:
|
||||
disable-sudo: true
|
||||
egress-policy: block
|
||||
|
||||
9
.github/workflows/openssf-scorecard.yml
vendored
9
.github/workflows/openssf-scorecard.yml
vendored
@@ -21,25 +21,28 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Install Harden-Runner
|
||||
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
|
||||
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
|
||||
with:
|
||||
disable-sudo: true
|
||||
egress-policy: block
|
||||
allowed-endpoints: >
|
||||
api.deps.dev:443
|
||||
api.github.com:443
|
||||
api.osv.dev:443
|
||||
api.scorecard.dev:443
|
||||
api.securityscorecards.dev:443
|
||||
github.com:443
|
||||
index.docker.io:443
|
||||
oss-fuzz-build-logs.storage.googleapis.com:443
|
||||
repo.maven.apache.org:443
|
||||
*.sigstore.dev:443
|
||||
www.bestpractices.dev:443
|
||||
- name: Check out code
|
||||
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Run OpenSSF Scorecard analysis
|
||||
uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3
|
||||
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
|
||||
with:
|
||||
results_file: results.sarif
|
||||
results_format: sarif
|
||||
|
||||
6
.github/workflows/pitest-analyze-pr.yml
vendored
6
.github/workflows/pitest-analyze-pr.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Install Harden-Runner
|
||||
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
|
||||
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
|
||||
with:
|
||||
disable-sudo: true
|
||||
egress-policy: block
|
||||
@@ -22,7 +22,7 @@ jobs:
|
||||
objects.githubusercontent.com:443
|
||||
repo.maven.apache.org:443
|
||||
- name: Check out code and set up JDK and Maven
|
||||
uses: s4u/setup-maven-action@489441643219d2b93ee2a127b2402eb640a1b947 # v1.13.0
|
||||
uses: s4u/setup-maven-action@382542f77617f34e56bf83868920a4d45b7451e7 # v1.16.0
|
||||
with:
|
||||
checkout-fetch-depth: 2
|
||||
java-version: 17.0.13
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
- name: Aggregate Pitest reports
|
||||
run: mvn pitest-git:aggregate -DkilledEmoji=":tada:" -DmutantEmoji=":zombie:" -DtrailingText="Mutation testing report by [Pitest](https://pitest.org/). Review any surviving mutants by inspecting the line comments under [_Files changed_](${{ github.event.number }}/files)."
|
||||
- name: Upload Pitest reports as artifact
|
||||
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
|
||||
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
|
||||
with:
|
||||
name: pitest-reports
|
||||
path: ./target/pit-reports-ci
|
||||
|
||||
4
.github/workflows/pitest-update-pr.yml
vendored
4
.github/workflows/pitest-update-pr.yml
vendored
@@ -20,7 +20,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Install Harden-Runner
|
||||
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
|
||||
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
|
||||
with:
|
||||
disable-sudo: true
|
||||
egress-policy: block
|
||||
@@ -31,7 +31,7 @@ jobs:
|
||||
objects.githubusercontent.com:443
|
||||
repo.maven.apache.org:443
|
||||
- name: Check out code and set up JDK and Maven
|
||||
uses: s4u/setup-maven-action@489441643219d2b93ee2a127b2402eb640a1b947 # v1.13.0
|
||||
uses: s4u/setup-maven-action@382542f77617f34e56bf83868920a4d45b7451e7 # v1.16.0
|
||||
with:
|
||||
java-version: 17.0.13
|
||||
java-distribution: temurin
|
||||
|
||||
28
.github/workflows/run-integration-tests.yml
vendored
28
.github/workflows/run-integration-tests.yml
vendored
@@ -2,24 +2,29 @@
|
||||
# against the project, using the code found on the pull request branch.
|
||||
# XXX: Generalize this to a matrix build of multiple integration tests,
|
||||
# possibly using multiple JDK or OS versions.
|
||||
# XXX: Investigate whether the comment can specify which integration tests run
|
||||
# run. See this example of a dynamic build matrix:
|
||||
# XXX: Investigate whether the comment can specify which integration tests run.
|
||||
# See this example of a dynamic build matrix:
|
||||
# https://docs.github.com/en/actions/learn-github-actions/expressions#example-returning-a-json-object
|
||||
name: "Integration tests"
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
issue_comment:
|
||||
types: [ created ]
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
run-integration-tests:
|
||||
name: On-demand integration test
|
||||
if: |
|
||||
github.event.issue.pull_request && contains(github.event.comment.body, '/integration-test')
|
||||
runs-on: ubuntu-24.04
|
||||
# if: github.event.issue.pull_request && contains(github.event.comment.body, '/integration-test')
|
||||
# XXX: Configure permissions.
|
||||
strategy:
|
||||
matrix:
|
||||
integration-test: [ "metrics", "checkstyle" ]
|
||||
name: On-demand integration test
|
||||
steps:
|
||||
- name: Install Harden-Runner
|
||||
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
|
||||
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
|
||||
with:
|
||||
disable-sudo: true
|
||||
egress-policy: block
|
||||
@@ -33,8 +38,9 @@ jobs:
|
||||
repo.maven.apache.org:443
|
||||
repository.sonatype.org:443
|
||||
- name: Check out code and set up JDK and Maven
|
||||
uses: s4u/setup-maven-action@489441643219d2b93ee2a127b2402eb640a1b947 # v1.13.0
|
||||
uses: s4u/setup-maven-action@382542f77617f34e56bf83868920a4d45b7451e7 # v1.16.0
|
||||
with:
|
||||
# checkout-ref: "refs/pull/894/head"
|
||||
checkout-ref: "refs/pull/${{ github.event.issue.number }}/head"
|
||||
java-version: 17.0.13
|
||||
java-distribution: temurin
|
||||
@@ -42,12 +48,12 @@ jobs:
|
||||
- name: Install project to local Maven repository
|
||||
run: mvn -T1C install -DskipTests -Dverification.skip
|
||||
- name: Run integration test
|
||||
run: xvfb-run ./integration-tests/checkstyle.sh "${{ runner.temp }}/artifacts"
|
||||
run: xvfb-run "./integration-tests/${{ matrix.integration-test }}.sh" "${{ runner.temp }}/artifacts"
|
||||
- name: Upload artifacts on failure
|
||||
if: ${{ failure() }}
|
||||
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
|
||||
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
|
||||
with:
|
||||
name: integration-test-checkstyle
|
||||
name: "integration-test-${{ matrix.integration-test }}"
|
||||
path: "${{ runner.temp }}/artifacts"
|
||||
- name: Remove installed project artifacts
|
||||
run: mvn build-helper:remove-project-artifact
|
||||
run: mvn dependency:purge-local-repository -DmanualInclude='${project.groupId}' -DresolutionFuzziness=groupId
|
||||
|
||||
4
.github/workflows/sonarcloud.yml
vendored
4
.github/workflows/sonarcloud.yml
vendored
@@ -19,7 +19,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Install Harden-Runner
|
||||
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
|
||||
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
|
||||
with:
|
||||
disable-sudo: true
|
||||
egress-policy: block
|
||||
@@ -35,7 +35,7 @@ jobs:
|
||||
*.sonarcloud.io:443
|
||||
sonarcloud.io:443
|
||||
- name: Check out code and set up JDK and Maven
|
||||
uses: s4u/setup-maven-action@489441643219d2b93ee2a127b2402eb640a1b947 # v1.13.0
|
||||
uses: s4u/setup-maven-action@382542f77617f34e56bf83868920a4d45b7451e7 # v1.16.0
|
||||
with:
|
||||
checkout-fetch-depth: 0
|
||||
java-version: 17.0.13
|
||||
|
||||
BIN
.mvn/wrapper/maven-wrapper.jar
vendored
BIN
.mvn/wrapper/maven-wrapper.jar
vendored
Binary file not shown.
18
.mvn/wrapper/maven-wrapper.properties
vendored
18
.mvn/wrapper/maven-wrapper.properties
vendored
@@ -1,18 +0,0 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
|
||||
@@ -298,6 +298,9 @@
|
||||
<version>${project.version}</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
<compilerArgs combine.children="append">
|
||||
<arg>-Xplugin:DocumentationGenerator -XoutputDirectory=${project.build.directory}/docs</arg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
<executions>
|
||||
<!-- The Refaster input/output test classes used by
|
||||
|
||||
@@ -39,6 +39,7 @@ import com.sun.source.tree.MemberSelectTree;
|
||||
import com.sun.source.tree.MethodInvocationTree;
|
||||
import com.sun.tools.javac.code.Type;
|
||||
import com.sun.tools.javac.code.Types;
|
||||
import java.time.Instant;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import tech.picnic.errorprone.utils.SourceCode;
|
||||
@@ -84,6 +85,7 @@ public final class IdentityConversion extends BugChecker implements MethodInvoca
|
||||
ImmutableSetMultimap.class.getCanonicalName(),
|
||||
ImmutableTable.class.getCanonicalName())
|
||||
.named("copyOf"),
|
||||
staticMethod().onClass(Instant.class.getCanonicalName()).namedAnyOf("from"),
|
||||
staticMethod().onClass(Matchers.class.getCanonicalName()).namedAnyOf("allOf", "anyOf"),
|
||||
staticMethod().onClass("reactor.adapter.rxjava.RxJava2Adapter"),
|
||||
staticMethod()
|
||||
|
||||
@@ -279,6 +279,9 @@ final class OptionalRules {
|
||||
*/
|
||||
// XXX: Do we need the `.filter(Optional::isPresent)`? If it's absent the caller probably assumed
|
||||
// that the values are present. (If we drop it, we should rewrite vacuous filter steps.)
|
||||
// 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
|
||||
// with JMH benchmarks; this would be a great use case.)
|
||||
static final class StreamFlatMapOptional<T> {
|
||||
@BeforeTemplate
|
||||
Stream<T> before(Stream<Optional<T>> stream) {
|
||||
@@ -395,10 +398,7 @@ final class OptionalRules {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid unnecessary operations on an {@link Optional} that ultimately result in that very same
|
||||
* {@link Optional}.
|
||||
*/
|
||||
/** Don't unnecessarily transform an {@link Optional} to an equivalent instance. */
|
||||
static final class OptionalIdentity<T> {
|
||||
@BeforeTemplate
|
||||
@SuppressWarnings("NestedOptionals")
|
||||
|
||||
@@ -1768,6 +1768,60 @@ final class ReactorRules {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prefer {@link StepVerifier#verify()} over a dangling {@link
|
||||
* StepVerifier#verifyThenAssertThat()}.
|
||||
*/
|
||||
// XXX: Application of this rule (and several others in this class) will cause invalid code if the
|
||||
// result of the rewritten expression is dereferenced. Consider introducing a bug checker that
|
||||
// identifies rules that change the return type of an expression and annotates them accordingly.
|
||||
// The associated annotation can then be used to instruct an annotation processor to generate
|
||||
// corresponding `void` rules that match only statements. This would allow the `Refaster` check to
|
||||
// conditionally skip "not fully safe" rules. This allows conditionally flagging more dubious
|
||||
// code, at the risk of compilation failures. With this rule, for example, we want to explicitly
|
||||
// nudge users towards `StepVerifier.Step#assertNext(Consumer)` or
|
||||
// `StepVerifier.Step#expectNext(Object)`, together with `Step#verifyComplete()`.
|
||||
static final class StepVerifierVerify {
|
||||
@BeforeTemplate
|
||||
StepVerifier.Assertions before(StepVerifier stepVerifier) {
|
||||
return stepVerifier.verifyThenAssertThat();
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
Duration after(StepVerifier stepVerifier) {
|
||||
return stepVerifier.verify();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prefer {@link StepVerifier#verify(Duration)} over a dangling {@link
|
||||
* StepVerifier#verifyThenAssertThat(Duration)}.
|
||||
*/
|
||||
static final class StepVerifierVerifyDuration {
|
||||
@BeforeTemplate
|
||||
StepVerifier.Assertions before(StepVerifier stepVerifier, Duration duration) {
|
||||
return stepVerifier.verifyThenAssertThat(duration);
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
Duration after(StepVerifier stepVerifier, Duration duration) {
|
||||
return stepVerifier.verify(duration);
|
||||
}
|
||||
}
|
||||
|
||||
/** Don't unnecessarily invoke {@link StepVerifier#verifyLater()} multiple times. */
|
||||
static final class StepVerifierVerifyLater {
|
||||
@BeforeTemplate
|
||||
StepVerifier before(StepVerifier stepVerifier) {
|
||||
return stepVerifier.verifyLater().verifyLater();
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
StepVerifier after(StepVerifier stepVerifier) {
|
||||
return stepVerifier.verifyLater();
|
||||
}
|
||||
}
|
||||
|
||||
/** Don't unnecessarily have {@link StepVerifier.Step} expect no elements. */
|
||||
static final class StepVerifierStepIdentity<T> {
|
||||
@BeforeTemplate
|
||||
@@ -1868,6 +1922,12 @@ final class ReactorRules {
|
||||
return step.expectErrorMatches(predicate).verify();
|
||||
}
|
||||
|
||||
@BeforeTemplate
|
||||
@SuppressWarnings("StepVerifierVerify" /* This is a more specific template. */)
|
||||
StepVerifier.Assertions before2(StepVerifier.LastStep step, Predicate<Throwable> predicate) {
|
||||
return step.expectError().verifyThenAssertThat().hasOperatorErrorMatching(predicate);
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
Duration after(StepVerifier.LastStep step, Predicate<Throwable> predicate) {
|
||||
return step.verifyErrorMatches(predicate);
|
||||
@@ -1890,6 +1950,30 @@ final class ReactorRules {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prefer {@link StepVerifier.LastStep#verifyErrorSatisfies(Consumer)} with AssertJ over more
|
||||
* contrived alternatives.
|
||||
*/
|
||||
static final class StepVerifierLastStepVerifyErrorSatisfiesAssertJ<T extends Throwable> {
|
||||
@BeforeTemplate
|
||||
@SuppressWarnings("StepVerifierVerify" /* This is a more specific template. */)
|
||||
StepVerifier.Assertions before(StepVerifier.LastStep step, Class<T> clazz, String message) {
|
||||
return Refaster.anyOf(
|
||||
step.expectError()
|
||||
.verifyThenAssertThat()
|
||||
.hasOperatorErrorOfType(clazz)
|
||||
.hasOperatorErrorWithMessage(message),
|
||||
step.expectError(clazz).verifyThenAssertThat().hasOperatorErrorWithMessage(message),
|
||||
step.expectErrorMessage(message).verifyThenAssertThat().hasOperatorErrorOfType(clazz));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@UseImportPolicy(STATIC_IMPORT_ALWAYS)
|
||||
Duration after(StepVerifier.LastStep step, Class<T> clazz, String message) {
|
||||
return step.verifyErrorSatisfies(t -> assertThat(t).isInstanceOf(clazz).hasMessage(message));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prefer {@link StepVerifier.LastStep#verifyErrorMessage(String)} over more verbose alternatives.
|
||||
*/
|
||||
|
||||
@@ -142,6 +142,63 @@ final class TimeRules {
|
||||
}
|
||||
}
|
||||
|
||||
/** Don't unnecessarily transform an {@link Instant} to an equivalent instance. */
|
||||
static final class InstantIdentity {
|
||||
@BeforeTemplate
|
||||
Instant before(Instant instant, TemporalUnit temporalUnit) {
|
||||
return Refaster.anyOf(
|
||||
instant.plus(Duration.ZERO),
|
||||
instant.plus(0, temporalUnit),
|
||||
instant.plusNanos(0),
|
||||
instant.plusMillis(0),
|
||||
instant.plusSeconds(0),
|
||||
instant.minus(Duration.ZERO),
|
||||
instant.minus(0, temporalUnit),
|
||||
instant.minusNanos(0),
|
||||
instant.minusMillis(0),
|
||||
instant.minusSeconds(0),
|
||||
Instant.parse(instant.toString()),
|
||||
instant.truncatedTo(ChronoUnit.NANOS),
|
||||
Instant.ofEpochSecond(instant.getEpochSecond(), instant.getNano()));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
Instant after(Instant instant) {
|
||||
return instant;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prefer {@link Instant#truncatedTo(TemporalUnit)} over less obvious alternatives.
|
||||
*
|
||||
* <p>Note that {@link Instant#toEpochMilli()} throws an {@link ArithmeticException} for dates
|
||||
* very far in the past or future, while the suggested alternative doesn't.
|
||||
*/
|
||||
static final class InstantTruncatedToMilliseconds {
|
||||
@BeforeTemplate
|
||||
Instant before(Instant instant) {
|
||||
return Instant.ofEpochMilli(instant.toEpochMilli());
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
Instant after(Instant instant) {
|
||||
return instant.truncatedTo(ChronoUnit.MILLIS);
|
||||
}
|
||||
}
|
||||
|
||||
/** Prefer {@link Instant#truncatedTo(TemporalUnit)} over less obvious alternatives. */
|
||||
static final class InstantTruncatedToSeconds {
|
||||
@BeforeTemplate
|
||||
Instant before(Instant instant) {
|
||||
return Instant.ofEpochSecond(instant.getEpochSecond());
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
Instant after(Instant instant) {
|
||||
return instant.truncatedTo(ChronoUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
/** Prefer {@link Instant#atOffset(ZoneOffset)} over more verbose alternatives. */
|
||||
static final class InstantAtOffset {
|
||||
@BeforeTemplate
|
||||
|
||||
@@ -28,6 +28,8 @@ final class IdentityConversionTest {
|
||||
"import com.google.common.collect.ImmutableTable;",
|
||||
"import com.google.errorprone.matchers.Matcher;",
|
||||
"import com.google.errorprone.matchers.Matchers;",
|
||||
"import java.time.Instant;",
|
||||
"import java.time.ZonedDateTime;",
|
||||
"import reactor.adapter.rxjava.RxJava2Adapter;",
|
||||
"import reactor.core.publisher.Flux;",
|
||||
"import reactor.core.publisher.Mono;",
|
||||
@@ -149,6 +151,10 @@ final class IdentityConversionTest {
|
||||
" // BUG: Diagnostic contains:",
|
||||
" ImmutableTable<Object, Object, Object> o11 = ImmutableTable.copyOf(ImmutableTable.of());",
|
||||
"",
|
||||
" Instant instant1 = Instant.from(ZonedDateTime.now());",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" Instant instant2 = Instant.from(Instant.now());",
|
||||
"",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" Matcher allOf1 = Matchers.allOf(instanceMethod());",
|
||||
" Matcher allOf2 = Matchers.allOf(instanceMethod(), staticMethod());",
|
||||
|
||||
@@ -598,6 +598,18 @@ final class ReactorRulesTest implements RefasterRuleCollectionTestCase {
|
||||
return StepVerifier.create(Flux.just(1));
|
||||
}
|
||||
|
||||
Object testStepVerifierVerify() {
|
||||
return Mono.empty().as(StepVerifier::create).expectError().verifyThenAssertThat();
|
||||
}
|
||||
|
||||
Object testStepVerifierVerifyDuration() {
|
||||
return Mono.empty().as(StepVerifier::create).expectError().verifyThenAssertThat(Duration.ZERO);
|
||||
}
|
||||
|
||||
StepVerifier testStepVerifierVerifyLater() {
|
||||
return Mono.empty().as(StepVerifier::create).expectError().verifyLater().verifyLater();
|
||||
}
|
||||
|
||||
ImmutableSet<StepVerifier.Step<Integer>> testStepVerifierStepIdentity() {
|
||||
return ImmutableSet.of(
|
||||
Mono.just(1).as(StepVerifier::create).expectNext(),
|
||||
@@ -638,17 +650,43 @@ final class ReactorRulesTest implements RefasterRuleCollectionTestCase {
|
||||
.verifyErrorSatisfies(t -> assertThat(t).isInstanceOf(AssertionError.class)));
|
||||
}
|
||||
|
||||
Duration testStepVerifierLastStepVerifyErrorMatches() {
|
||||
return Mono.empty()
|
||||
.as(StepVerifier::create)
|
||||
.expectErrorMatches(IllegalArgumentException.class::equals)
|
||||
.verify();
|
||||
ImmutableSet<?> testStepVerifierLastStepVerifyErrorMatches() {
|
||||
return ImmutableSet.of(
|
||||
Mono.empty()
|
||||
.as(StepVerifier::create)
|
||||
.expectErrorMatches(IllegalArgumentException.class::equals)
|
||||
.verify(),
|
||||
Mono.empty()
|
||||
.as(StepVerifier::create)
|
||||
.expectError()
|
||||
.verifyThenAssertThat()
|
||||
.hasOperatorErrorMatching(IllegalStateException.class::equals));
|
||||
}
|
||||
|
||||
Duration testStepVerifierLastStepVerifyErrorSatisfies() {
|
||||
return Mono.empty().as(StepVerifier::create).expectErrorSatisfies(t -> {}).verify();
|
||||
}
|
||||
|
||||
ImmutableSet<?> testStepVerifierLastStepVerifyErrorSatisfiesAssertJ() {
|
||||
return ImmutableSet.of(
|
||||
Mono.empty()
|
||||
.as(StepVerifier::create)
|
||||
.expectError()
|
||||
.verifyThenAssertThat()
|
||||
.hasOperatorErrorOfType(IllegalArgumentException.class)
|
||||
.hasOperatorErrorWithMessage("foo"),
|
||||
Mono.empty()
|
||||
.as(StepVerifier::create)
|
||||
.expectError(IllegalStateException.class)
|
||||
.verifyThenAssertThat()
|
||||
.hasOperatorErrorWithMessage("bar"),
|
||||
Mono.empty()
|
||||
.as(StepVerifier::create)
|
||||
.expectErrorMessage("baz")
|
||||
.verifyThenAssertThat()
|
||||
.hasOperatorErrorOfType(AssertionError.class));
|
||||
}
|
||||
|
||||
Duration testStepVerifierLastStepVerifyErrorMessage() {
|
||||
return Mono.empty().as(StepVerifier::create).expectErrorMessage("foo").verify();
|
||||
}
|
||||
|
||||
@@ -586,6 +586,18 @@ final class ReactorRulesTest implements RefasterRuleCollectionTestCase {
|
||||
return Flux.just(1).as(StepVerifier::create);
|
||||
}
|
||||
|
||||
Object testStepVerifierVerify() {
|
||||
return Mono.empty().as(StepVerifier::create).expectError().verify();
|
||||
}
|
||||
|
||||
Object testStepVerifierVerifyDuration() {
|
||||
return Mono.empty().as(StepVerifier::create).expectError().verify(Duration.ZERO);
|
||||
}
|
||||
|
||||
StepVerifier testStepVerifierVerifyLater() {
|
||||
return Mono.empty().as(StepVerifier::create).expectError().verifyLater();
|
||||
}
|
||||
|
||||
ImmutableSet<StepVerifier.Step<Integer>> testStepVerifierStepIdentity() {
|
||||
return ImmutableSet.of(
|
||||
Mono.just(1).as(StepVerifier::create),
|
||||
@@ -619,16 +631,36 @@ final class ReactorRulesTest implements RefasterRuleCollectionTestCase {
|
||||
Mono.empty().as(StepVerifier::create).verifyError(AssertionError.class));
|
||||
}
|
||||
|
||||
Duration testStepVerifierLastStepVerifyErrorMatches() {
|
||||
return Mono.empty()
|
||||
.as(StepVerifier::create)
|
||||
.verifyErrorMatches(IllegalArgumentException.class::equals);
|
||||
ImmutableSet<?> testStepVerifierLastStepVerifyErrorMatches() {
|
||||
return ImmutableSet.of(
|
||||
Mono.empty()
|
||||
.as(StepVerifier::create)
|
||||
.verifyErrorMatches(IllegalArgumentException.class::equals),
|
||||
Mono.empty()
|
||||
.as(StepVerifier::create)
|
||||
.verifyErrorMatches(IllegalStateException.class::equals));
|
||||
}
|
||||
|
||||
Duration testStepVerifierLastStepVerifyErrorSatisfies() {
|
||||
return Mono.empty().as(StepVerifier::create).verifyErrorSatisfies(t -> {});
|
||||
}
|
||||
|
||||
ImmutableSet<?> testStepVerifierLastStepVerifyErrorSatisfiesAssertJ() {
|
||||
return ImmutableSet.of(
|
||||
Mono.empty()
|
||||
.as(StepVerifier::create)
|
||||
.verifyErrorSatisfies(
|
||||
t -> assertThat(t).isInstanceOf(IllegalArgumentException.class).hasMessage("foo")),
|
||||
Mono.empty()
|
||||
.as(StepVerifier::create)
|
||||
.verifyErrorSatisfies(
|
||||
t -> assertThat(t).isInstanceOf(IllegalStateException.class).hasMessage("bar")),
|
||||
Mono.empty()
|
||||
.as(StepVerifier::create)
|
||||
.verifyErrorSatisfies(
|
||||
t -> assertThat(t).isInstanceOf(AssertionError.class).hasMessage("baz")));
|
||||
}
|
||||
|
||||
Duration testStepVerifierLastStepVerifyErrorMessage() {
|
||||
return Mono.empty().as(StepVerifier::create).verifyErrorMessage("foo");
|
||||
}
|
||||
|
||||
@@ -66,6 +66,32 @@ final class TimeRulesTest implements RefasterRuleCollectionTestCase {
|
||||
return Instant.EPOCH.atZone(ZoneOffset.UTC).toOffsetDateTime();
|
||||
}
|
||||
|
||||
ImmutableSet<Instant> testInstantIdentity() {
|
||||
return ImmutableSet.of(
|
||||
Instant.EPOCH.plusMillis(1).plus(Duration.ZERO),
|
||||
Instant.EPOCH.plusMillis(2).plus(0, ChronoUnit.MILLIS),
|
||||
Instant.EPOCH.plusMillis(3).plusNanos(0L),
|
||||
Instant.EPOCH.plusMillis(4).plusMillis(0),
|
||||
Instant.EPOCH.plusMillis(5).plusSeconds(0L),
|
||||
Instant.EPOCH.plusMillis(6).minus(Duration.ZERO),
|
||||
Instant.EPOCH.plusMillis(7).minus(0, ChronoUnit.SECONDS),
|
||||
Instant.EPOCH.plusMillis(8).minusNanos(0L),
|
||||
Instant.EPOCH.plusMillis(9).minusMillis(0),
|
||||
Instant.EPOCH.plusMillis(10).minusSeconds(0L),
|
||||
Instant.parse(Instant.EPOCH.plusMillis(11).toString()),
|
||||
Instant.EPOCH.plusMillis(12).truncatedTo(ChronoUnit.NANOS),
|
||||
Instant.ofEpochSecond(
|
||||
Instant.EPOCH.plusMillis(13).getEpochSecond(), Instant.EPOCH.plusMillis(13).getNano()));
|
||||
}
|
||||
|
||||
Instant testInstantTruncatedToMilliseconds() {
|
||||
return Instant.ofEpochMilli(Instant.EPOCH.toEpochMilli());
|
||||
}
|
||||
|
||||
Instant testInstantTruncatedToSeconds() {
|
||||
return Instant.ofEpochSecond(Instant.EPOCH.getEpochSecond());
|
||||
}
|
||||
|
||||
OffsetDateTime testInstantAtOffset() {
|
||||
return OffsetDateTime.ofInstant(Instant.EPOCH, ZoneOffset.UTC);
|
||||
}
|
||||
|
||||
@@ -66,6 +66,31 @@ final class TimeRulesTest implements RefasterRuleCollectionTestCase {
|
||||
return OffsetDateTime.ofInstant(Instant.EPOCH, ZoneOffset.UTC);
|
||||
}
|
||||
|
||||
ImmutableSet<Instant> testInstantIdentity() {
|
||||
return ImmutableSet.of(
|
||||
Instant.EPOCH.plusMillis(1),
|
||||
Instant.EPOCH.plusMillis(2),
|
||||
Instant.EPOCH.plusMillis(3),
|
||||
Instant.EPOCH.plusMillis(4),
|
||||
Instant.EPOCH.plusMillis(5),
|
||||
Instant.EPOCH.plusMillis(6),
|
||||
Instant.EPOCH.plusMillis(7),
|
||||
Instant.EPOCH.plusMillis(8),
|
||||
Instant.EPOCH.plusMillis(9),
|
||||
Instant.EPOCH.plusMillis(10),
|
||||
Instant.EPOCH.plusMillis(11),
|
||||
Instant.EPOCH.plusMillis(12),
|
||||
Instant.EPOCH.plusMillis(13));
|
||||
}
|
||||
|
||||
Instant testInstantTruncatedToMilliseconds() {
|
||||
return Instant.EPOCH.truncatedTo(ChronoUnit.MILLIS);
|
||||
}
|
||||
|
||||
Instant testInstantTruncatedToSeconds() {
|
||||
return Instant.EPOCH.truncatedTo(ChronoUnit.SECONDS);
|
||||
}
|
||||
|
||||
OffsetDateTime testInstantAtOffset() {
|
||||
return Instant.EPOCH.atOffset(ZoneOffset.UTC);
|
||||
}
|
||||
|
||||
@@ -118,6 +118,9 @@
|
||||
<version>${project.version}</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
<compilerArgs combine.children="append">
|
||||
<arg>-Xplugin:DocumentationGenerator -XoutputDirectory=${project.build.directory}/docs</arg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -9,8 +9,8 @@ revision='checkstyle-10.14.0'
|
||||
# XXX: Configure Renovate to manage the AssertJ version declared here.
|
||||
additional_build_flags='-Dassertj.version=3.24.2'
|
||||
additional_source_directories='${project.basedir}${file.separator}src${file.separator}it${file.separator}java,${project.basedir}${file.separator}src${file.separator}xdocs-examples${file.separator}java'
|
||||
patch_error_prone_flags='-XepOpt:Refaster:NamePattern=.*Workshop.*"'
|
||||
validation_error_prone_flags='-XepOpt:Refaster:NamePattern=.*Workshop.*"'
|
||||
patch_error_prone_flags=''
|
||||
validation_error_prone_flags=''
|
||||
# Validation skips some tests:
|
||||
# - The `metadataFilesGenerationAllFiles` test is skipped because it makes line
|
||||
# number assertions that will fail when the code is formatted or patched.
|
||||
|
||||
0
integration-tests/metrics-expected-changes.patch
Normal file
0
integration-tests/metrics-expected-changes.patch
Normal file
287
integration-tests/metrics-expected-warnings.txt
Normal file
287
integration-tests/metrics-expected-warnings.txt
Normal file
@@ -0,0 +1,287 @@
|
||||
metrics-annotation/src/main/java/com/codahale/metrics/annotation/CachedGauge.java:[32,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-annotation/src/main/java/com/codahale/metrics/annotation/CachedGauge.java:[37,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-annotation/src/main/java/com/codahale/metrics/annotation/CachedGauge.java:[43,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-annotation/src/main/java/com/codahale/metrics/annotation/CachedGauge.java:[48,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-annotation/src/main/java/com/codahale/metrics/annotation/Counted.java:[39,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-annotation/src/main/java/com/codahale/metrics/annotation/Counted.java:[44,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-annotation/src/main/java/com/codahale/metrics/annotation/Counted.java:[51,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-annotation/src/main/java/com/codahale/metrics/annotation/ExceptionMetered.java:[55,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-annotation/src/main/java/com/codahale/metrics/annotation/ExceptionMetered.java:[61,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-annotation/src/main/java/com/codahale/metrics/annotation/ExceptionMetered.java:[68,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-annotation/src/main/java/com/codahale/metrics/annotation/Gauge.java:[27,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-annotation/src/main/java/com/codahale/metrics/annotation/Gauge.java:[32,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-annotation/src/main/java/com/codahale/metrics/annotation/Metered.java:[36,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-annotation/src/main/java/com/codahale/metrics/annotation/Metered.java:[41,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-annotation/src/main/java/com/codahale/metrics/annotation/Metric.java:[39,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-annotation/src/main/java/com/codahale/metrics/annotation/Metric.java:[44,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-annotation/src/main/java/com/codahale/metrics/annotation/ResponseMetered.java:[37,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-annotation/src/main/java/com/codahale/metrics/annotation/ResponseMetered.java:[42,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-annotation/src/main/java/com/codahale/metrics/annotation/ResponseMetered.java:[49,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-annotation/src/main/java/com/codahale/metrics/annotation/Timed.java:[36,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-annotation/src/main/java/com/codahale/metrics/annotation/Timed.java:[41,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-benchmarks/src/main/java/com/codahale/metrics/benchmarks/SlidingTimeWindowReservoirsBenchmark.java:[21,3] [MissingSummary] A summary line is required on public/protected Javadocs.
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[3,15] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[3,21] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[3,27] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[3,33] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[3,39] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[3,45] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[3,51] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[3,57] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[3,63] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[3,69] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[3,75] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[3,81] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[3,87] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[3,93] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[3,99] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[3,9] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[4,15] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[4,21] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[4,27] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[4,33] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[4,39] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[4,45] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[4,51] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[4,57] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[4,63] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[4,69] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[4,75] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[4,81] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[4,87] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[4,93] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[4,99] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[4,9] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[5,15] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[5,21] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[5,27] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[5,33] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[5,39] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[5,45] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[5,51] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[5,57] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[5,63] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[5,69] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[5,75] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[5,81] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[5,87] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[5,93] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[5,99] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[5,9] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[6,15] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[6,21] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[6,27] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[6,33] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[6,39] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[6,45] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[6,51] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[6,57] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[6,63] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[6,69] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[6,75] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[6,81] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[6,87] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[6,93] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[6,99] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[6,9] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[7,15] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[7,21] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[7,27] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[7,33] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[7,39] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[7,45] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[7,51] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[7,57] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[7,63] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[7,69] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[7,75] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[7,81] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[7,87] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[7,93] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[7,99] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[7,9] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[8,15] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[8,21] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[8,27] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[8,33] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[8,39] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[8,45] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[8,51] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[8,57] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[8,63] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[8,69] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[8,75] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[8,81] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[8,87] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[8,93] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[8,99] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[8,9] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[9,15] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-benchmarks/target/generated-sources/annotations/com/codahale/metrics/benchmarks/jmh_generated/ReservoirBenchmark_jmhType_B3.java:[9,9] [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: ReservoirBenchmark_jmhType_B1
|
||||
metrics-caffeine/src/test/java/com/codahale/metrics/caffeine/MetricsStatsCounterTest.java:[89,9] [deprecation] recordEviction() in MetricsStatsCounter has been deprecated
|
||||
metrics-caffeine/src/test/java/com/codahale/metrics/caffeine/MetricsStatsCounterTest.java:[96,9] [deprecation] recordEviction(int) in MetricsStatsCounter has been deprecated
|
||||
metrics-collectd/src/main/java/com/codahale/metrics/collectd/CollectdReporter.java:[193,13] [InconsistentCapitalization] Found the field 'hostName' with the same name as the parameter 'hostname' but with different capitalization.
|
||||
metrics-collectd/src/main/java/com/codahale/metrics/collectd/CollectdReporter.java:[305,14] [FormatStringConcatenation] Defer string concatenation to the invoked method
|
||||
metrics-collectd/src/main/java/com/codahale/metrics/collectd/PacketWriter.java:[160,12] [cast] redundant cast to ByteBuffer
|
||||
metrics-collectd/src/main/java/com/codahale/metrics/collectd/PacketWriter.java:[165,11] [cast] redundant cast to ByteBuffer
|
||||
metrics-collectd/src/main/java/com/codahale/metrics/collectd/PacketWriter.java:[171,17] [cast] redundant cast to ByteBuffer
|
||||
metrics-collectd/src/main/java/com/codahale/metrics/collectd/PacketWriter.java:[196,8] [cast] redundant cast to ByteBuffer
|
||||
metrics-collectd/src/main/java/com/codahale/metrics/collectd/PacketWriter.java:[199,21] [cast] redundant cast to ByteBuffer
|
||||
metrics-collectd/src/main/java/com/codahale/metrics/collectd/PacketWriter.java:[202,11] [cast] redundant cast to ByteBuffer
|
||||
metrics-collectd/src/main/java/com/codahale/metrics/collectd/PacketWriter.java:[248,36] [cast] redundant cast to ByteBuffer
|
||||
metrics-collectd/src/main/java/com/codahale/metrics/collectd/Sanitize.java:[7,3] [MissingSummary] A summary fragment is required; consider using the value of the @see block as a summary fragment instead.
|
||||
metrics-collectd/src/test/java/com/codahale/metrics/collectd/Receiver.java:[51,16] [CatchAndPrintStackTrace] Logging or rethrowing exceptions should usually be preferred to catching and calling printStackTrace
|
||||
metrics-collectd/src/test/java/com/codahale/metrics/collectd/SanitizeTest.java:[26,41] [UnnecessaryParentheses] These grouping parentheses are unnecessary; it is unlikely the code will be misinterpreted without them
|
||||
metrics-core/src/main/java/com/codahale/metrics/ConsoleReporter.java:[239,46] [JavaUtilDate] Date has a bad API that leads to bugs; prefer java.time.Instant or LocalDate.
|
||||
metrics-core/src/main/java/com/codahale/metrics/ConsoleReporter.java:[406,43] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-core/src/main/java/com/codahale/metrics/ConsoleReporter.java:[413,43] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-core/src/main/java/com/codahale/metrics/CsvReporter.java:[310,39] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-core/src/main/java/com/codahale/metrics/CsvReporter.java:[312,39] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-core/src/main/java/com/codahale/metrics/CsvReporter.java:[382,35] [FormatStringConcatenation] Defer string concatenation to the invoked method
|
||||
metrics-core/src/main/java/com/codahale/metrics/InstrumentedExecutorService.java:[196,25] [try] auto-closeable resource durationContext is never referenced in body of corresponding try statement
|
||||
metrics-core/src/main/java/com/codahale/metrics/InstrumentedExecutorService.java:[218,25] [try] auto-closeable resource context is never referenced in body of corresponding try statement
|
||||
metrics-core/src/main/java/com/codahale/metrics/MetricRegistry.java:[329,29] [TypeParameterUnusedInFormals] Declaring a type parameter that is only used in the return type is a misuse of generics: operations on the type parameter are unchecked, it hides unsafe casts at invocations of the method, and it interacts badly with method overload resolution.
|
||||
metrics-core/src/main/java/com/codahale/metrics/MovingAverages.java:[26,5] [EmptyBlockTag] A block tag (@param, @return, @throws, @deprecated) has an empty description. Block tags without descriptions don't add much value for future readers of the code; consider removing the tag entirely or adding a description.
|
||||
metrics-core/src/main/java/com/codahale/metrics/NoopMetricRegistry.java:[102,29] [TypeParameterUnusedInFormals] Declaring a type parameter that is only used in the return type is a misuse of generics: operations on the type parameter are unchecked, it hides unsafe casts at invocations of the method, and it interacts badly with method overload resolution.
|
||||
metrics-core/src/main/java/com/codahale/metrics/ScheduledReporter.java:[37,12] [removal] SecurityManager in java.lang has been deprecated and marked for removal
|
||||
metrics-core/src/main/java/com/codahale/metrics/ScheduledReporter.java:[37,38] [removal] getSecurityManager() in System has been deprecated and marked for removal
|
||||
metrics-core/src/main/java/com/codahale/metrics/ScheduledReporter.java:[47,21] [ThreadPriorityCheck] Relying on the thread scheduler is discouraged.
|
||||
metrics-core/src/main/java/com/codahale/metrics/Slf4jReporter.java:[183,29] [InvalidInlineTag] Curly braces should be used for inline Javadoc tags: {@link ...}
|
||||
metrics-core/src/main/java/com/codahale/metrics/WeightedSnapshot.java:[76,26] [UnnecessaryParentheses] These grouping parentheses are unnecessary; it is unlikely the code will be misinterpreted without them
|
||||
metrics-core/src/test/java/com/codahale/metrics/ClockTest.java:[14,75] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-core/src/test/java/com/codahale/metrics/ClockTest.java:[16,66] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-core/src/test/java/com/codahale/metrics/MeterApproximationTest.java:[37,19] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-core/src/test/java/com/codahale/metrics/MeterApproximationTest.java:[48,19] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-core/src/test/java/com/codahale/metrics/MeterApproximationTest.java:[59,19] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-core/src/test/java/com/codahale/metrics/ScheduledReporterTest.java:[230,41] [DirectInvocationOnMock] Methods should not be directly invoked on the mock `mockExecutor`. Should this be part of a verify(..) call?
|
||||
metrics-core/src/test/java/com/codahale/metrics/ScheduledReporterTest.java:[231,39] [DirectInvocationOnMock] Methods should not be directly invoked on the mock `mockExecutor`. Should this be part of a verify(..) call?
|
||||
metrics-core/src/test/java/com/codahale/metrics/SharedMetricRegistriesTest.java:[12,62] [deprecation] none() in ExpectedException has been deprecated
|
||||
metrics-core/src/test/java/com/codahale/metrics/SlidingTimeWindowArrayReservoirTest.java:[88,15] [UnnecessaryAsync] Variables which are initialized and do not escape the current scope do not need to worry about concurrency. Using the non-concurrent type will reduce overhead and verbosity.
|
||||
metrics-core/src/test/java/com/codahale/metrics/UniformSnapshotTest.java:[128,30] [DefaultCharset] Implicit use of the platform default charset, which can result in differing behaviour between JVM executions or incorrect behavior if the encoding of the data source doesn't match expectations.
|
||||
metrics-core/src/test/java/com/codahale/metrics/WeightedSnapshotTest.java:[136,30] [DefaultCharset] Implicit use of the platform default charset, which can result in differing behaviour between JVM executions or incorrect behavior if the encoding of the data source doesn't match expectations.
|
||||
metrics-graphite/src/main/java/com/codahale/metrics/graphite/Graphite.java:[129,57] [OperatorPrecedence] Use grouping parenthesis to make the operator precedence explicit
|
||||
metrics-graphite/src/main/java/com/codahale/metrics/graphite/GraphiteReporter.java:[253,46] [UnnecessaryLambda] Returning a lambda from a helper method or saving it in a constant is unnecessary; prefer to implement the functional interface method directly and use a method reference instead.
|
||||
metrics-graphite/src/main/java/com/codahale/metrics/graphite/GraphiteReporter.java:[431,17] [Slf4jLogStatement] Log statement contains 0 placeholders, but specifies 1 matching argument(s)
|
||||
metrics-graphite/src/main/java/com/codahale/metrics/graphite/GraphiteReporter.java:[436,19] [Slf4jLogStatement] Log statement contains 0 placeholders, but specifies 1 matching argument(s)
|
||||
metrics-graphite/src/main/java/com/codahale/metrics/graphite/GraphiteReporter.java:[449,20] [Slf4jLogStatement] Log statement contains 0 placeholders, but specifies 1 matching argument(s)
|
||||
metrics-graphite/src/main/java/com/codahale/metrics/graphite/GraphiteReporter.java:[456,60] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-graphite/src/main/java/com/codahale/metrics/graphite/GraphiteReporter.java:[458,60] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-graphite/src/test/java/com/codahale/metrics/graphite/GraphiteTest.java:[140,65] [AddressSelection] Prefer InetAddress.getAllByName to APIs that convert a hostname to a single IP address
|
||||
metrics-graphite/src/test/java/com/codahale/metrics/graphite/GraphiteTest.java:[30,66] [AddressSelection] Prefer InetAddress.getAllByName to APIs that convert a hostname to a single IP address
|
||||
metrics-graphite/src/test/java/com/codahale/metrics/graphite/GraphiteTest.java:[59,26] [DirectInvocationOnMock] Methods should not be directly invoked on the mock `socket`. Should this be part of a verify(..) call?
|
||||
metrics-graphite/src/test/java/com/codahale/metrics/graphite/GraphiteUDPTest.java:[25,73] [AddressSelection] Prefer InetAddress.getAllByName to APIs that convert a hostname to a single IP address
|
||||
metrics-graphite/src/test/java/com/codahale/metrics/graphite/GraphiteUDPTest.java:[35,49] [AddressSelection] Prefer InetAddress.getAllByName to APIs that convert a hostname to a single IP address
|
||||
metrics-graphite/src/test/java/com/codahale/metrics/graphite/GraphiteUDPTest.java:[40,60] [StringCharset] StringCharset
|
||||
metrics-graphite/src/test/java/com/codahale/metrics/graphite/GraphiteUDPTest.java:[41,34] [AddressSelection] Prefer InetAddress.getAllByName to APIs that convert a hostname to a single IP address
|
||||
metrics-graphite/src/test/java/com/codahale/metrics/graphite/PickledGraphiteTest.java:[36,66] [AddressSelection] Prefer InetAddress.getAllByName to APIs that convert a hostname to a single IP address
|
||||
metrics-graphite/src/test/java/com/codahale/metrics/graphite/PickledGraphiteTest.java:[68,26] [DirectInvocationOnMock] Methods should not be directly invoked on the mock `socket`. Should this be part of a verify(..) call?
|
||||
metrics-healthchecks/src/main/java/com/codahale/metrics/health/HealthCheck.java:[203,19] [EqualsGetClass] Prefer instanceof to getClass when implementing Object#equals.
|
||||
metrics-healthchecks/src/main/java/com/codahale/metrics/health/HealthCheck.java:[222,32] [UnnecessaryParentheses] These grouping parentheses are unnecessary; it is unlikely the code will be misinterpreted without them
|
||||
metrics-healthchecks/src/main/java/com/codahale/metrics/health/HealthCheck.java:[318,25] [AnnotateFormatMethod] This method uses a pair of parameters as a format string and its arguments, but the enclosing method wasn't annotated @FormatMethod. Doing so gives compile-time rather than run-time protection against malformed format strings.
|
||||
metrics-healthchecks/src/main/java/com/codahale/metrics/health/HealthCheck.java:[55,25] [AnnotateFormatMethod] This method uses a pair of parameters as a format string and its arguments, but the enclosing method wasn't annotated @FormatMethod. Doing so gives compile-time rather than run-time protection against malformed format strings.
|
||||
metrics-healthchecks/src/main/java/com/codahale/metrics/health/HealthCheck.java:[79,25] [AnnotateFormatMethod] This method uses a pair of parameters as a format string and its arguments, but the enclosing method wasn't annotated @FormatMethod. Doing so gives compile-time rather than run-time protection against malformed format strings.
|
||||
metrics-healthchecks/src/main/java/com/codahale/metrics/health/HealthCheckRegistry.java:[269,32] [removal] getSecurityManager() in System has been deprecated and marked for removal
|
||||
metrics-healthchecks/src/main/java/com/codahale/metrics/health/HealthCheckRegistry.java:[269,6] [removal] SecurityManager in java.lang has been deprecated and marked for removal
|
||||
metrics-healthchecks/src/main/java/com/codahale/metrics/health/HealthCheckRegistry.java:[278,64] [ThreadPriorityCheck] Relying on the thread scheduler is discouraged.
|
||||
metrics-healthchecks/src/test/java/com/codahale/metrics/health/HealthCheckTest.java:[189,46] [JavaTimeDefaultTimeZone] ZonedDateTime.now() is not allowed because it silently uses the system default time-zone. You must pass an explicit time-zone (e.g., ZoneId.of("America/Los_Angeles")) to this method.
|
||||
metrics-healthchecks/src/test/java/com/codahale/metrics/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/com/codahale/metrics/health/HealthCheckTest.java:[203,46] [JavaTimeDefaultTimeZone] ZonedDateTime.now() is not allowed because it silently uses the system default time-zone. You must pass an explicit time-zone (e.g., ZoneId.of("America/Los_Angeles")) to this method.
|
||||
metrics-healthchecks/src/test/java/com/codahale/metrics/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/com/codahale/metrics/health/SharedHealthCheckRegistriesTest.java:[13,70] [deprecation] none() in ExpectedException has been deprecated
|
||||
metrics-httpasyncclient/src/test/java/com/codahale/metrics/httpasyncclient/HttpClientTestBase.java:[24,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-httpclient/src/main/java/com/codahale/metrics/httpclient/HttpClientMetricNameStrategies.java:[43,59] [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
|
||||
metrics-httpclient/src/test/java/com/codahale/metrics/httpclient/HttpClientMetricNameStrategiesTest.java:[101,4] [deprecation] <T>assertThat(T,Matcher<? super T>) in Assert has been deprecated
|
||||
metrics-httpclient/src/test/java/com/codahale/metrics/httpclient/HttpClientMetricNameStrategiesTest.java:[112,4] [deprecation] <T>assertThat(T,Matcher<? super T>) in Assert has been deprecated
|
||||
metrics-httpclient/src/test/java/com/codahale/metrics/httpclient/HttpClientMetricNameStrategiesTest.java:[120,22] [deprecation] rewriteURI(URI,HttpHost,boolean) in URIUtils has been deprecated
|
||||
metrics-httpclient/src/test/java/com/codahale/metrics/httpclient/HttpClientMetricNameStrategiesTest.java:[31,4] [deprecation] <T>assertThat(T,Matcher<? super T>) in Assert has been deprecated
|
||||
metrics-httpclient/src/test/java/com/codahale/metrics/httpclient/HttpClientMetricNameStrategiesTest.java:[38,4] [deprecation] <T>assertThat(T,Matcher<? super T>) in Assert has been deprecated
|
||||
metrics-httpclient/src/test/java/com/codahale/metrics/httpclient/HttpClientMetricNameStrategiesTest.java:[45,4] [deprecation] <T>assertThat(T,Matcher<? super T>) in Assert has been deprecated
|
||||
metrics-httpclient/src/test/java/com/codahale/metrics/httpclient/HttpClientMetricNameStrategiesTest.java:[54,4] [deprecation] <T>assertThat(T,Matcher<? super T>) in Assert has been deprecated
|
||||
metrics-httpclient/src/test/java/com/codahale/metrics/httpclient/HttpClientMetricNameStrategiesTest.java:[63,4] [deprecation] <T>assertThat(T,Matcher<? super T>) in Assert has been deprecated
|
||||
metrics-httpclient/src/test/java/com/codahale/metrics/httpclient/HttpClientMetricNameStrategiesTest.java:[70,4] [deprecation] <T>assertThat(T,Matcher<? super T>) in Assert has been deprecated
|
||||
metrics-httpclient/src/test/java/com/codahale/metrics/httpclient/HttpClientMetricNameStrategiesTest.java:[78,4] [deprecation] <T>assertThat(T,Matcher<? super T>) in Assert has been deprecated
|
||||
metrics-httpclient/src/test/java/com/codahale/metrics/httpclient/HttpClientMetricNameStrategiesTest.java:[86,4] [deprecation] <T>assertThat(T,Matcher<? super T>) in Assert has been deprecated
|
||||
metrics-httpclient/src/test/java/com/codahale/metrics/httpclient/HttpClientMetricNameStrategiesTest.java:[94,4] [deprecation] <T>assertThat(T,Matcher<? super T>) in Assert has been deprecated
|
||||
metrics-httpclient5/src/test/java/com/codahale/metrics/httpclient5/HttpClientMetricNameStrategiesTest.java:[23,4] [deprecation] <T>assertThat(T,Matcher<? super T>) in Assert has been deprecated
|
||||
metrics-httpclient5/src/test/java/com/codahale/metrics/httpclient5/HttpClientMetricNameStrategiesTest.java:[30,4] [deprecation] <T>assertThat(T,Matcher<? super T>) in Assert has been deprecated
|
||||
metrics-httpclient5/src/test/java/com/codahale/metrics/httpclient5/HttpClientMetricNameStrategiesTest.java:[37,4] [deprecation] <T>assertThat(T,Matcher<? super T>) in Assert has been deprecated
|
||||
metrics-httpclient5/src/test/java/com/codahale/metrics/httpclient5/HttpClientMetricNameStrategiesTest.java:[44,4] [deprecation] <T>assertThat(T,Matcher<? super T>) in Assert has been deprecated
|
||||
metrics-httpclient5/src/test/java/com/codahale/metrics/httpclient5/HttpClientMetricNameStrategiesTest.java:[53,4] [deprecation] <T>assertThat(T,Matcher<? super T>) in Assert has been deprecated
|
||||
metrics-httpclient5/src/test/java/com/codahale/metrics/httpclient5/HttpClientMetricNameStrategiesTest.java:[62,4] [deprecation] <T>assertThat(T,Matcher<? super T>) in Assert has been deprecated
|
||||
metrics-httpclient5/src/test/java/com/codahale/metrics/httpclient5/HttpClientMetricNameStrategiesTest.java:[69,4] [deprecation] <T>assertThat(T,Matcher<? super T>) in Assert has been deprecated
|
||||
metrics-httpclient5/src/test/java/com/codahale/metrics/httpclient5/HttpClientMetricNameStrategiesTest.java:[80,4] [deprecation] <T>assertThat(T,Matcher<? super T>) in Assert has been deprecated
|
||||
metrics-httpclient5/src/test/java/com/codahale/metrics/httpclient5/HttpClientMetricNameStrategiesTest.java:[88,22] [deprecation] rewriteURI(URI,HttpHost,boolean) in URIUtils has been deprecated
|
||||
metrics-httpclient5/src/test/java/com/codahale/metrics/httpclient5/InstrumentedHttpAsyncClientsTest.java:[126,8] [deprecation] SimpleHttpRequests in org.apache.hc.client5.http.async.methods has been deprecated
|
||||
metrics-httpclient5/src/test/java/com/codahale/metrics/httpclient5/InstrumentedHttpAsyncClientsTest.java:[182,10] [deprecation] SimpleHttpRequests in org.apache.hc.client5.http.async.methods has been deprecated
|
||||
metrics-httpclient5/src/test/java/com/codahale/metrics/httpclient5/InstrumentedHttpAsyncClientsTest.java:[26,47] [deprecation] SimpleHttpRequests in org.apache.hc.client5.http.async.methods has been deprecated
|
||||
metrics-httpclient5/src/test/java/com/codahale/metrics/httpclient5/InstrumentedHttpAsyncClientsTest.java:[77,8] [deprecation] SimpleHttpRequests in org.apache.hc.client5.http.async.methods has been deprecated
|
||||
metrics-httpclient5/src/test/java/com/codahale/metrics/httpclient5/InstrumentedHttpClientsTest.java:[68,12] [deprecation] execute(ClassicHttpRequest) in HttpClient has been deprecated
|
||||
metrics-jakarta-servlet/src/main/java/io/dropwizard/metrics/servlet/InstrumentedFilterContextListener.java:[14,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-jakarta-servlets/src/main/java/io/dropwizard/metrics/servlets/AdminServlet.java:[32,30] [InlineFormatString] Prefer to create format strings inline, instead of extracting them to a single-use constant
|
||||
metrics-jakarta-servlets/src/main/java/io/dropwizard/metrics/servlets/HealthCheckServlet.java:[26,7] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-jakarta-servlets/src/main/java/io/dropwizard/metrics/servlets/HealthCheckServlet.java:[31,7] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-jakarta-servlets/src/main/java/io/dropwizard/metrics/servlets/HealthCheckServlet.java:[40,7] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-jakarta-servlets/src/main/java/io/dropwizard/metrics/servlets/MetricsServlet.java:[32,7] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-jakarta-servlets/src/main/java/io/dropwizard/metrics/servlets/MetricsServlet.java:[37,7] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-jakarta-servlets/src/main/java/io/dropwizard/metrics/servlets/MetricsServlet.java:[46,7] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-jakarta-servlets/src/main/java/io/dropwizard/metrics/servlets/MetricsServlet.java:[55,7] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-jakarta-servlets/src/test/java/io/dropwizard/metrics/servlets/HealthCheckServletTest.java:[104,18] [FormatStringConcatenation] Defer string concatenation to the invoked method
|
||||
metrics-jakarta-servlets/src/test/java/io/dropwizard/metrics/servlets/HealthCheckServletTest.java:[145,18] [FormatStringConcatenation] Defer string concatenation to the invoked method
|
||||
metrics-jakarta-servlets/src/test/java/io/dropwizard/metrics/servlets/HealthCheckServletTest.java:[219,25] [FormatStringConcatenation] Defer string concatenation to the invoked method
|
||||
metrics-jakarta-servlets/src/test/java/io/dropwizard/metrics/servlets/HealthCheckServletTest.java:[30,67] [JavaTimeDefaultTimeZone] ZonedDateTime.now() is not allowed because it silently uses the system default time-zone. You must pass an explicit time-zone (e.g., ZoneId.of("America/Los_Angeles")) to this method.
|
||||
metrics-jakarta-servlets/src/test/java/io/dropwizard/metrics/servlets/HealthCheckServletTest.java:[30,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/metrics/servlets/MetricsServletTest.java:[130,18] [FormatStringConcatenation] Defer string concatenation to the invoked method
|
||||
metrics-jcache/src/test/java/JCacheGaugeSetTest.java:[1] [DefaultPackage] Java classes shouldn't use default package
|
||||
metrics-jdbi3/src/main/java/com/codahale/metrics/jdbi3/InstrumentedTimingCollector.java:[9,33] [deprecation] TimingCollector in org.jdbi.v3.core.statement has been deprecated
|
||||
metrics-jdbi3/src/test/java/com/codahale/metrics/jdbi3/strategies/SmartNameStrategyTest.java:[17,10] [deprecation] InstrumentedTimingCollector in com.codahale.metrics.jdbi3 has been deprecated
|
||||
metrics-jdbi3/src/test/java/com/codahale/metrics/jdbi3/strategies/SmartNameStrategyTest.java:[23,20] [deprecation] InstrumentedTimingCollector in com.codahale.metrics.jdbi3 has been deprecated
|
||||
metrics-jdbi3/src/test/java/com/codahale/metrics/jdbi3/strategies/SmartNameStrategyTest.java:[8,33] [deprecation] InstrumentedTimingCollector in com.codahale.metrics.jdbi3 has been deprecated
|
||||
metrics-jersey2/src/main/java/com/codahale/metrics/jersey2/InstrumentedResourceMethodApplicationListener.java:[582,19] [EqualsGetClass] Prefer instanceof to getClass when implementing Object#equals.
|
||||
metrics-jersey3/src/main/java/com/codahale/metrics/jersey3/InstrumentedResourceMethodApplicationListener.java:[582,19] [EqualsGetClass] Prefer instanceof to getClass when implementing Object#equals.
|
||||
metrics-jersey31/src/main/java/io/dropwizard/metrics/jersey31/InstrumentedResourceMethodApplicationListener.java:[582,19] [EqualsGetClass] Prefer instanceof to getClass when implementing Object#equals.
|
||||
metrics-jetty10/src/test/java/io/dropwizard/metrics/jetty10/InstrumentedHandlerTest.java:[134,44] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-jetty10/src/test/java/io/dropwizard/metrics/jetty10/InstrumentedHandlerTest.java:[138,44] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-jetty11/src/test/java/io/dropwizard/metrics/jetty11/InstrumentedHandlerTest.java:[136,44] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-jetty11/src/test/java/io/dropwizard/metrics/jetty11/InstrumentedHandlerTest.java:[140,44] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-jetty9/src/test/java/com/codahale/metrics/jetty9/InstrumentedHandlerTest.java:[136,44] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-jetty9/src/test/java/com/codahale/metrics/jetty9/InstrumentedHandlerTest.java:[140,44] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-jmx/src/main/java/com/codahale/metrics/jmx/DefaultObjectNameFactory.java:[18,45] [JdkObsolete] Hashtable performs synchronization this is usually unnecessary; prefer LinkedHashMap.
|
||||
metrics-json/src/test/java/com/codahale/metrics/json/HealthCheckModuleTest.java:[131,18] [FormatStringConcatenation] Defer string concatenation to the invoked method
|
||||
metrics-json/src/test/java/com/codahale/metrics/json/HealthCheckModuleTest.java:[20,18] [FormatStringConcatenation] Defer string concatenation to the invoked method
|
||||
metrics-json/src/test/java/com/codahale/metrics/json/HealthCheckModuleTest.java:[28,18] [FormatStringConcatenation] Defer string concatenation to the invoked method
|
||||
metrics-json/src/test/java/com/codahale/metrics/json/HealthCheckModuleTest.java:[43,18] [FormatStringConcatenation] Defer string concatenation to the invoked method
|
||||
metrics-json/src/test/java/com/codahale/metrics/json/HealthCheckModuleTest.java:[62,18] [FormatStringConcatenation] Defer string concatenation to the invoked method
|
||||
metrics-json/src/test/java/com/codahale/metrics/json/HealthCheckModuleTest.java:[90,18] [FormatStringConcatenation] Defer string concatenation to the invoked method
|
||||
metrics-jvm/src/main/java/com/codahale/metrics/jvm/FileDescriptorRatioGauge.java:[42,55] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-jvm/src/main/java/com/codahale/metrics/jvm/FileDescriptorRatioGauge.java:[42,91] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-jvm/src/main/java/com/codahale/metrics/jvm/MemoryUsageGaugeSet.java:[107,31] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-jvm/src/main/java/com/codahale/metrics/jvm/MemoryUsageGaugeSet.java:[107,56] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-jvm/src/main/java/com/codahale/metrics/jvm/MemoryUsageGaugeSet.java:[77,41] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-jvm/src/main/java/com/codahale/metrics/jvm/MemoryUsageGaugeSet.java:[77,57] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-jvm/src/main/java/com/codahale/metrics/jvm/MemoryUsageGaugeSet.java:[93,29] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-jvm/src/main/java/com/codahale/metrics/jvm/MemoryUsageGaugeSet.java:[93,54] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-jvm/src/main/java/com/codahale/metrics/jvm/ThreadStatesGaugeSet.java:[47,43] [StringCaseLocaleUsage] Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)
|
||||
metrics-jvm/src/test/java/com/codahale/metrics/jvm/CpuTimeClockTest.java:[15,75] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-jvm/src/test/java/com/codahale/metrics/jvm/CpuTimeClockTest.java:[19,71] [LongDoubleConversion] Conversion from long to double may lose precision; use an explicit cast to double if this was intentional
|
||||
metrics-jvm/src/test/java/com/codahale/metrics/jvm/FileDescriptorRatioGaugeSunManagementNotExistsTest.java:[55,10] [removal] AccessController in java.security has been deprecated and marked for removal
|
||||
metrics-jvm/src/test/java/com/codahale/metrics/jvm/FileDescriptorRatioGaugeSunManagementNotExistsTest.java:[67,36] [URLEqualsHashCode] Avoid hash-based containers of java.net.URL--the containers rely on equals() and hashCode(), which cause java.net.URL to make blocking internet connections.
|
||||
metrics-jvm/src/test/java/com/codahale/metrics/jvm/FileDescriptorRatioGaugeSunManagementNotExistsTest.java:[9,20] [removal] AccessController in java.security has been deprecated and marked for removal
|
||||
metrics-jvm/src/test/java/com/codahale/metrics/jvm/ThreadDumpTest.java:[42,30] [DefaultCharset] Implicit use of the platform default charset, which can result in differing behaviour between JVM executions or incorrect behavior if the encoding of the data source doesn't match expectations.
|
||||
metrics-log4j2/src/main/java/com/codahale/metrics/log4j2/InstrumentedAppender.java:[85,4] [deprecation] AbstractAppender(String,Filter,Layout<? extends Serializable>,boolean) in AbstractAppender has been deprecated
|
||||
metrics-log4j2/src/main/java/com/codahale/metrics/log4j2/InstrumentedAppender.java:[96,4] [deprecation] AbstractAppender(String,Filter,Layout<? extends Serializable>,boolean) in AbstractAppender has been deprecated
|
||||
metrics-servlet/src/main/java/com/codahale/metrics/servlet/InstrumentedFilterContextListener.java:[14,5] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-servlets/src/main/java/com/codahale/metrics/servlets/AdminServlet.java:[32,30] [InlineFormatString] Prefer to create format strings inline, instead of extracting them to a single-use constant
|
||||
metrics-servlets/src/main/java/com/codahale/metrics/servlets/HealthCheckServlet.java:[26,7] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-servlets/src/main/java/com/codahale/metrics/servlets/HealthCheckServlet.java:[31,7] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-servlets/src/main/java/com/codahale/metrics/servlets/HealthCheckServlet.java:[40,7] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-servlets/src/main/java/com/codahale/metrics/servlets/HealthCheckServlet.java:[48,7] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-servlets/src/main/java/com/codahale/metrics/servlets/MetricsServlet.java:[32,7] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-servlets/src/main/java/com/codahale/metrics/servlets/MetricsServlet.java:[37,7] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-servlets/src/main/java/com/codahale/metrics/servlets/MetricsServlet.java:[46,7] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-servlets/src/main/java/com/codahale/metrics/servlets/MetricsServlet.java:[55,7] [MissingSummary] A summary fragment is required; consider using the value of the @return block as a summary fragment instead.
|
||||
metrics-servlets/src/test/java/com/codahale/metrics/servlets/HealthCheckServletTest.java:[112,18] [FormatStringConcatenation] Defer string concatenation to the invoked method
|
||||
metrics-servlets/src/test/java/com/codahale/metrics/servlets/HealthCheckServletTest.java:[170,25] [FormatStringConcatenation] Defer string concatenation to the invoked method
|
||||
metrics-servlets/src/test/java/com/codahale/metrics/servlets/HealthCheckServletTest.java:[31,67] [JavaTimeDefaultTimeZone] ZonedDateTime.now() is not allowed because it silently uses the system default time-zone. You must pass an explicit time-zone (e.g., ZoneId.of("America/Los_Angeles")) to this method.
|
||||
metrics-servlets/src/test/java/com/codahale/metrics/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-servlets/src/test/java/com/codahale/metrics/servlets/HealthCheckServletTest.java:[96,18] [FormatStringConcatenation] Defer string concatenation to the invoked method
|
||||
metrics-servlets/src/test/java/com/codahale/metrics/servlets/MetricsServletTest.java:[130,18] [FormatStringConcatenation] Defer string concatenation to the invoked method
|
||||
203
integration-tests/metrics-init.patch
Normal file
203
integration-tests/metrics-init.patch
Normal file
@@ -0,0 +1,203 @@
|
||||
diff --git a/metrics-jakarta-servlets/src/main/java/io/dropwizard/metrics/servlets/MetricsServlet.java b/metrics-jakarta-servlets/src/main/java/io/dropwizard/metrics/servlets/MetricsServlet.java
|
||||
index a248dd8..4e7f053 100644
|
||||
--- a/metrics-jakarta-servlets/src/main/java/io/dropwizard/metrics/servlets/MetricsServlet.java
|
||||
+++ b/metrics-jakarta-servlets/src/main/java/io/dropwizard/metrics/servlets/MetricsServlet.java
|
||||
@@ -188,6 +188,7 @@ public class MetricsServlet extends HttpServlet {
|
||||
return mapper.writer();
|
||||
}
|
||||
|
||||
+ @SuppressWarnings("IdentityConversion")
|
||||
protected TimeUnit parseTimeUnit(String value, TimeUnit defaultValue) {
|
||||
try {
|
||||
return TimeUnit.valueOf(String.valueOf(value).toUpperCase(Locale.US));
|
||||
diff --git a/metrics-servlets/src/main/java/com/codahale/metrics/servlets/MetricsServlet.java b/metrics-servlets/src/main/java/com/codahale/metrics/servlets/MetricsServlet.java
|
||||
index 0bd1297..7c69a08 100644
|
||||
--- a/metrics-servlets/src/main/java/com/codahale/metrics/servlets/MetricsServlet.java
|
||||
+++ b/metrics-servlets/src/main/java/com/codahale/metrics/servlets/MetricsServlet.java
|
||||
@@ -189,6 +189,7 @@ public class MetricsServlet extends HttpServlet {
|
||||
return mapper.writer();
|
||||
}
|
||||
|
||||
+ @SuppressWarnings("IdentityConversion")
|
||||
protected TimeUnit parseTimeUnit(String value, TimeUnit defaultValue) {
|
||||
try {
|
||||
return TimeUnit.valueOf(String.valueOf(value).toUpperCase(Locale.US));
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index 6192b52..8c312b6 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -68,7 +68,8 @@
|
||||
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
|
||||
<errorprone.version>2.19.1</errorprone.version>
|
||||
<errorprone.javac.version>9+181-r4173-1</errorprone.javac.version>
|
||||
-
|
||||
+ <error-prone-support.flags>-Xplugin:ErrorProne -XepDisableWarningsInGeneratedCode ${error-prone.configuration-args}</error-prone-support.flags>
|
||||
+ <java.version>8</java.version>
|
||||
<sonar.projectKey>dropwizard_metrics</sonar.projectKey>
|
||||
<sonar.organization>dropwizard</sonar.organization>
|
||||
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
|
||||
@@ -166,10 +167,9 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
- <compilerArgs>
|
||||
+ <compilerArgs combine.children="append">
|
||||
<arg>-Xlint:all</arg>
|
||||
<arg>-XDcompilePolicy=simple</arg>
|
||||
- <arg>-Xplugin:ErrorProne -XepExcludedPaths:.*/target/generated-sources/.*</arg>
|
||||
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
|
||||
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
|
||||
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
|
||||
@@ -181,18 +181,129 @@
|
||||
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
|
||||
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
|
||||
</compilerArgs>
|
||||
- <annotationProcessorPaths>
|
||||
- <path>
|
||||
- <groupId>com.google.errorprone</groupId>
|
||||
- <artifactId>error_prone_core</artifactId>
|
||||
- <version>${errorprone.version}</version>
|
||||
- </path>
|
||||
- </annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
+ <profile>
|
||||
+ <id>error-prone-compile</id>
|
||||
+ <build>
|
||||
+ <plugins>
|
||||
+ <plugin>
|
||||
+ <groupId>org.apache.maven.plugins</groupId>
|
||||
+ <artifactId>maven-compiler-plugin</artifactId>
|
||||
+ <version>${maven-compiler-plugin.version}</version>
|
||||
+ <executions>
|
||||
+ <!-- Skip the `default-compile` execution as we don't want to execute the compile goal twice -->
|
||||
+ <execution>
|
||||
+ <id>default-compile</id>
|
||||
+ <phase>compile</phase>
|
||||
+ <goals>
|
||||
+ <goal>compile</goal>
|
||||
+ </goals>
|
||||
+ <configuration>
|
||||
+ <skipMain>true</skipMain>
|
||||
+ </configuration>
|
||||
+ </execution>
|
||||
+ <execution>
|
||||
+ <id>error-prone-compile</id>
|
||||
+ <phase>compile</phase>
|
||||
+ <goals>
|
||||
+ <goal>compile</goal>
|
||||
+ </goals>
|
||||
+ <configuration>
|
||||
+ <failOnError>true</failOnError>
|
||||
+ <source>${java.version}</source>
|
||||
+ <target>${java.version}</target>
|
||||
+ <compilerArgs combine.children="append">
|
||||
+ <arg>-Xpkginfo:always</arg>
|
||||
+ <arg>-XDcompilePolicy=simple</arg>
|
||||
+ <arg>${error-prone-support.flags}</arg>
|
||||
+ </compilerArgs>
|
||||
+ <annotationProcessorPaths combine.children="append">
|
||||
+ <path>
|
||||
+ <groupId>com.google.errorprone</groupId>
|
||||
+ <artifactId>error_prone_core</artifactId>
|
||||
+ <version>${error-prone.version}</version>
|
||||
+ </path>
|
||||
+ <path>
|
||||
+ <groupId>tech.picnic.error-prone-support</groupId>
|
||||
+ <artifactId>error-prone-contrib</artifactId>
|
||||
+ <version>${error-prone-support.version}</version>
|
||||
+ </path>
|
||||
+ <path>
|
||||
+ <groupId>tech.picnic.error-prone-support</groupId>
|
||||
+ <artifactId>refaster-runner</artifactId>
|
||||
+ <version>${error-prone-support.version}</version>
|
||||
+ </path>
|
||||
+ </annotationProcessorPaths>
|
||||
+ </configuration>
|
||||
+ </execution>
|
||||
+ </executions>
|
||||
+ </plugin>
|
||||
+ </plugins>
|
||||
+ </build>
|
||||
+ </profile>
|
||||
+ <profile>
|
||||
+ <id>error-prone-test-compile</id>
|
||||
+ <build>
|
||||
+ <plugins>
|
||||
+ <plugin>
|
||||
+ <groupId>org.apache.maven.plugins</groupId>
|
||||
+ <artifactId>maven-compiler-plugin</artifactId>
|
||||
+ <version>${maven-compiler-plugin.version}</version>
|
||||
+ <executions>
|
||||
+ <!-- Skip the `default-testCompile` execution as we don't want to execute the compile goal twice -->
|
||||
+ <execution>
|
||||
+ <id>default-testCompile</id>
|
||||
+ <phase>test-compile</phase>
|
||||
+ <goals>
|
||||
+ <goal>testCompile</goal>
|
||||
+ </goals>
|
||||
+ <configuration>
|
||||
+ <skip>true</skip>
|
||||
+ </configuration>
|
||||
+ </execution>
|
||||
+ <execution>
|
||||
+ <id>error-prone-test-compile</id>
|
||||
+ <phase>test-compile</phase>
|
||||
+ <goals>
|
||||
+ <goal>testCompile</goal>
|
||||
+ </goals>
|
||||
+ <configuration>
|
||||
+ <failOnError>true</failOnError>
|
||||
+ <source>${java.version}</source>
|
||||
+ <target>${java.version}</target>
|
||||
+ <compilerArgs combine.children="append">
|
||||
+ <arg>-Xpkginfo:always</arg>
|
||||
+ <arg>-XDcompilePolicy=simple</arg>
|
||||
+ <arg>${error-prone-support.flags}</arg>
|
||||
+ </compilerArgs>
|
||||
+ <annotationProcessorPaths combine.children="append">
|
||||
+ <path>
|
||||
+ <groupId>com.google.errorprone</groupId>
|
||||
+ <artifactId>error_prone_core</artifactId>
|
||||
+ <version>${error-prone.version}</version>
|
||||
+ </path>
|
||||
+ <path>
|
||||
+ <groupId>tech.picnic.error-prone-support</groupId>
|
||||
+ <artifactId>error-prone-contrib</artifactId>
|
||||
+ <version>${error-prone-support.version}</version>
|
||||
+ </path>
|
||||
+ <path>
|
||||
+ <groupId>tech.picnic.error-prone-support</groupId>
|
||||
+ <artifactId>refaster-runner</artifactId>
|
||||
+ <version>${error-prone-support.version}</version>
|
||||
+ </path>
|
||||
+ </annotationProcessorPaths>
|
||||
+ </configuration>
|
||||
+ </execution>
|
||||
+ </executions>
|
||||
+ </plugin>
|
||||
+ </plugins>
|
||||
+ </build>
|
||||
+ </profile>
|
||||
<profile>
|
||||
<id>release-sign-artifacts</id>
|
||||
<activation>
|
||||
@@ -323,15 +434,7 @@
|
||||
<compilerArgs>
|
||||
<arg>-Xlint:all</arg>
|
||||
<arg>-XDcompilePolicy=simple</arg>
|
||||
- <arg>-Xplugin:ErrorProne -XepExcludedPaths:.*/target/generated-sources/.*</arg>
|
||||
</compilerArgs>
|
||||
- <annotationProcessorPaths>
|
||||
- <path>
|
||||
- <groupId>com.google.errorprone</groupId>
|
||||
- <artifactId>error_prone_core</artifactId>
|
||||
- <version>${errorprone.version}</version>
|
||||
- </path>
|
||||
- </annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
32
integration-tests/metrics.sh
Executable file
32
integration-tests/metrics.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e -u -o pipefail
|
||||
|
||||
test_name="$(basename "${0}" .sh)"
|
||||
project=metrics
|
||||
repository=https://github.com/dropwizard/metrics.git
|
||||
revision=v4.2.19
|
||||
|
||||
if [ "${#}" -gt 2 ] || ([ "${#}" = 2 ] && [ "${1:---sync}" != '--sync' ]); then
|
||||
echo "Usage: ${0} [--sync] [<report_directory>]"
|
||||
exit 1
|
||||
fi
|
||||
do_sync="$([ "${#}" = 0 ] || [ "${1:-}" != '--sync' ] || echo 1)"
|
||||
report_directory="$([ "${#}" = 0 ] || ([ -z "${do_sync}" ] && echo "${1}") || ([ "${#}" = 1 ] || echo "${2}"))"
|
||||
|
||||
# XXX: We exclude the `CollectorMutability` and the `Immutable*|Preconditions*|StringRules.StringIsNullOrEmpty` Refaster rules
|
||||
# as they introduce changes that expect Guava to be on the classpath.
|
||||
patch_flags="-Xep:CollectorMutability:OFF -XepOpt:Refaster:NamePattern=^(?!ImmutableSetRules\$ImmutableSetOf).*"
|
||||
|
||||
"$(dirname "${0}")"/run-integration-test.sh \
|
||||
"${test_name}" \
|
||||
"${project}" \
|
||||
"${repository}" \
|
||||
"${revision}" \
|
||||
"" \
|
||||
"" \
|
||||
"${patch_flags}" \
|
||||
"" \
|
||||
"" \
|
||||
"${do_sync}" \
|
||||
"${report_directory}"
|
||||
308
mvnw
vendored
308
mvnw
vendored
@@ -1,308 +0,0 @@
|
||||
#!/bin/sh
|
||||
# ----------------------------------------------------------------------------
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Apache Maven Wrapper startup batch script, version 3.2.0
|
||||
#
|
||||
# Required ENV vars:
|
||||
# ------------------
|
||||
# JAVA_HOME - location of a JDK home dir
|
||||
#
|
||||
# Optional ENV vars
|
||||
# -----------------
|
||||
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
# e.g. to debug Maven itself, use
|
||||
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
||||
|
||||
if [ -f /usr/local/etc/mavenrc ] ; then
|
||||
. /usr/local/etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f /etc/mavenrc ] ; then
|
||||
. /etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f "$HOME/.mavenrc" ] ; then
|
||||
. "$HOME/.mavenrc"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# OS specific support. $var _must_ be set to either true or false.
|
||||
cygwin=false;
|
||||
darwin=false;
|
||||
mingw=false
|
||||
case "$(uname)" in
|
||||
CYGWIN*) cygwin=true ;;
|
||||
MINGW*) mingw=true;;
|
||||
Darwin*) darwin=true
|
||||
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
||||
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
if [ -x "/usr/libexec/java_home" ]; then
|
||||
JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME
|
||||
else
|
||||
JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
if [ -r /etc/gentoo-release ] ; then
|
||||
JAVA_HOME=$(java-config --jre-home)
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
|
||||
fi
|
||||
|
||||
# For Mingw, ensure paths are in UNIX format before anything is touched
|
||||
if $mingw ; then
|
||||
[ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] &&
|
||||
JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)"
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
javaExecutable="$(which javac)"
|
||||
if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then
|
||||
# readlink(1) is not available as standard on Solaris 10.
|
||||
readLink=$(which readlink)
|
||||
if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then
|
||||
if $darwin ; then
|
||||
javaHome="$(dirname "\"$javaExecutable\"")"
|
||||
javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac"
|
||||
else
|
||||
javaExecutable="$(readlink -f "\"$javaExecutable\"")"
|
||||
fi
|
||||
javaHome="$(dirname "\"$javaExecutable\"")"
|
||||
javaHome=$(expr "$javaHome" : '\(.*\)/bin')
|
||||
JAVA_HOME="$javaHome"
|
||||
export JAVA_HOME
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$JAVACMD" ] ; then
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
else
|
||||
JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
echo "Error: JAVA_HOME is not defined correctly." >&2
|
||||
echo " We cannot execute $JAVACMD" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
echo "Warning: JAVA_HOME environment variable is not set."
|
||||
fi
|
||||
|
||||
# traverses directory structure from process work directory to filesystem root
|
||||
# first directory with .mvn subdirectory is considered project base directory
|
||||
find_maven_basedir() {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Path not specified to find_maven_basedir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
basedir="$1"
|
||||
wdir="$1"
|
||||
while [ "$wdir" != '/' ] ; do
|
||||
if [ -d "$wdir"/.mvn ] ; then
|
||||
basedir=$wdir
|
||||
break
|
||||
fi
|
||||
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
||||
if [ -d "${wdir}" ]; then
|
||||
wdir=$(cd "$wdir/.." || exit 1; pwd)
|
||||
fi
|
||||
# end of workaround
|
||||
done
|
||||
printf '%s' "$(cd "$basedir" || exit 1; pwd)"
|
||||
}
|
||||
|
||||
# concatenates all lines of a file
|
||||
concat_lines() {
|
||||
if [ -f "$1" ]; then
|
||||
# Remove \r in case we run on Windows within Git Bash
|
||||
# and check out the repository with auto CRLF management
|
||||
# enabled. Otherwise, we may read lines that are delimited with
|
||||
# \r\n and produce $'-Xarg\r' rather than -Xarg due to word
|
||||
# splitting rules.
|
||||
tr -s '\r\n' ' ' < "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
log() {
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
printf '%s\n' "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
BASE_DIR=$(find_maven_basedir "$(dirname "$0")")
|
||||
if [ -z "$BASE_DIR" ]; then
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
|
||||
log "$MAVEN_PROJECTBASEDIR"
|
||||
|
||||
##########################################################################################
|
||||
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||
##########################################################################################
|
||||
wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar"
|
||||
if [ -r "$wrapperJarPath" ]; then
|
||||
log "Found $wrapperJarPath"
|
||||
else
|
||||
log "Couldn't find $wrapperJarPath, downloading it ..."
|
||||
|
||||
if [ -n "$MVNW_REPOURL" ]; then
|
||||
wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
else
|
||||
wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
fi
|
||||
while IFS="=" read -r key value; do
|
||||
# Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' )
|
||||
safeValue=$(echo "$value" | tr -d '\r')
|
||||
case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;;
|
||||
esac
|
||||
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
|
||||
log "Downloading from: $wrapperUrl"
|
||||
|
||||
if $cygwin; then
|
||||
wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
|
||||
fi
|
||||
|
||||
if command -v wget > /dev/null; then
|
||||
log "Found wget ... using wget"
|
||||
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet"
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||
else
|
||||
wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||
fi
|
||||
elif command -v curl > /dev/null; then
|
||||
log "Found curl ... using curl"
|
||||
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent"
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
|
||||
else
|
||||
curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
|
||||
fi
|
||||
else
|
||||
log "Falling back to using Java to download"
|
||||
javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
||||
javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class"
|
||||
# For Cygwin, switch paths to Windows format before running javac
|
||||
if $cygwin; then
|
||||
javaSource=$(cygpath --path --windows "$javaSource")
|
||||
javaClass=$(cygpath --path --windows "$javaClass")
|
||||
fi
|
||||
if [ -e "$javaSource" ]; then
|
||||
if [ ! -e "$javaClass" ]; then
|
||||
log " - Compiling MavenWrapperDownloader.java ..."
|
||||
("$JAVA_HOME/bin/javac" "$javaSource")
|
||||
fi
|
||||
if [ -e "$javaClass" ]; then
|
||||
log " - Running MavenWrapperDownloader.java ..."
|
||||
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
##########################################################################################
|
||||
# End of extension
|
||||
##########################################################################################
|
||||
|
||||
# If specified, validate the SHA-256 sum of the Maven wrapper jar file
|
||||
wrapperSha256Sum=""
|
||||
while IFS="=" read -r key value; do
|
||||
case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;;
|
||||
esac
|
||||
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
|
||||
if [ -n "$wrapperSha256Sum" ]; then
|
||||
wrapperSha256Result=false
|
||||
if command -v sha256sum > /dev/null; then
|
||||
if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then
|
||||
wrapperSha256Result=true
|
||||
fi
|
||||
elif command -v shasum > /dev/null; then
|
||||
if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then
|
||||
wrapperSha256Result=true
|
||||
fi
|
||||
else
|
||||
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available."
|
||||
echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties."
|
||||
exit 1
|
||||
fi
|
||||
if [ $wrapperSha256Result = false ]; then
|
||||
echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2
|
||||
echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2
|
||||
echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin; then
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
|
||||
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
||||
MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
|
||||
fi
|
||||
|
||||
# Provide a "standardized" way to retrieve the CLI args that will
|
||||
# work with both Windows and non-Windows executions.
|
||||
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*"
|
||||
export MAVEN_CMD_LINE_ARGS
|
||||
|
||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
# shellcheck disable=SC2086 # safe args
|
||||
exec "$JAVACMD" \
|
||||
$MAVEN_OPTS \
|
||||
$MAVEN_DEBUG_OPTS \
|
||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
||||
205
mvnw.cmd
vendored
205
mvnw.cmd
vendored
@@ -1,205 +0,0 @@
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||
@REM or more contributor license agreements. See the NOTICE file
|
||||
@REM distributed with this work for additional information
|
||||
@REM regarding copyright ownership. The ASF licenses this file
|
||||
@REM to you under the Apache License, Version 2.0 (the
|
||||
@REM "License"); you may not use this file except in compliance
|
||||
@REM with the License. You may obtain a copy of the License at
|
||||
@REM
|
||||
@REM http://www.apache.org/licenses/LICENSE-2.0
|
||||
@REM
|
||||
@REM Unless required by applicable law or agreed to in writing,
|
||||
@REM software distributed under the License is distributed on an
|
||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@REM KIND, either express or implied. See the License for the
|
||||
@REM specific language governing permissions and limitations
|
||||
@REM under the License.
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Apache Maven Wrapper startup batch script, version 3.2.0
|
||||
@REM
|
||||
@REM Required ENV vars:
|
||||
@REM JAVA_HOME - location of a JDK home dir
|
||||
@REM
|
||||
@REM Optional ENV vars
|
||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
|
||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
@REM e.g. to debug Maven itself, use
|
||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
||||
@echo off
|
||||
@REM set title of command window
|
||||
title %0
|
||||
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
|
||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||
|
||||
@REM set %HOME% to equivalent of $HOME
|
||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||
|
||||
@REM Execute a user defined script before this one
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
|
||||
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
|
||||
:skipRcPre
|
||||
|
||||
@setlocal
|
||||
|
||||
set ERROR_CODE=0
|
||||
|
||||
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
||||
@setlocal
|
||||
|
||||
@REM ==== START VALIDATION ====
|
||||
if not "%JAVA_HOME%" == "" goto OkJHome
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME not found in your environment. >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
:OkJHome
|
||||
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
||||
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
@REM ==== END VALIDATION ====
|
||||
|
||||
:init
|
||||
|
||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
||||
@REM Fallback to current working directory if not found.
|
||||
|
||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
||||
|
||||
set EXEC_DIR=%CD%
|
||||
set WDIR=%EXEC_DIR%
|
||||
:findBaseDir
|
||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
||||
cd ..
|
||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
||||
set WDIR=%CD%
|
||||
goto findBaseDir
|
||||
|
||||
:baseDirFound
|
||||
set MAVEN_PROJECTBASEDIR=%WDIR%
|
||||
cd "%EXEC_DIR%"
|
||||
goto endDetectBaseDir
|
||||
|
||||
:baseDirNotFound
|
||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
||||
cd "%EXEC_DIR%"
|
||||
|
||||
:endDetectBaseDir
|
||||
|
||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
||||
|
||||
@setlocal EnableExtensions EnableDelayedExpansion
|
||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
||||
|
||||
:endReadAdditionalConfig
|
||||
|
||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
||||
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
|
||||
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||
IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
|
||||
)
|
||||
|
||||
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||
if exist %WRAPPER_JAR% (
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Found %WRAPPER_JAR%
|
||||
)
|
||||
) else (
|
||||
if not "%MVNW_REPOURL%" == "" (
|
||||
SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
)
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||
echo Downloading from: %WRAPPER_URL%
|
||||
)
|
||||
|
||||
powershell -Command "&{"^
|
||||
"$webclient = new-object System.Net.WebClient;"^
|
||||
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
||||
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
||||
"}"^
|
||||
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
|
||||
"}"
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Finished downloading %WRAPPER_JAR%
|
||||
)
|
||||
)
|
||||
@REM End of extension
|
||||
|
||||
@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file
|
||||
SET WRAPPER_SHA_256_SUM=""
|
||||
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||
IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
|
||||
)
|
||||
IF NOT %WRAPPER_SHA_256_SUM%=="" (
|
||||
powershell -Command "&{"^
|
||||
"$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
|
||||
"If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
|
||||
" Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
|
||||
" Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
|
||||
" Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
|
||||
" exit 1;"^
|
||||
"}"^
|
||||
"}"
|
||||
if ERRORLEVEL 1 goto error
|
||||
)
|
||||
|
||||
@REM Provide a "standardized" way to retrieve the CLI args that will
|
||||
@REM work with both Windows and non-Windows executions.
|
||||
set MAVEN_CMD_LINE_ARGS=%*
|
||||
|
||||
%MAVEN_JAVA_EXE% ^
|
||||
%JVM_CONFIG_MAVEN_PROPS% ^
|
||||
%MAVEN_OPTS% ^
|
||||
%MAVEN_DEBUG_OPTS% ^
|
||||
-classpath %WRAPPER_JAR% ^
|
||||
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
|
||||
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
||||
if ERRORLEVEL 1 goto error
|
||||
goto end
|
||||
|
||||
:error
|
||||
set ERROR_CODE=1
|
||||
|
||||
:end
|
||||
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||
|
||||
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
|
||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
|
||||
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
|
||||
:skipRcPost
|
||||
|
||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
||||
if "%MAVEN_BATCH_PAUSE%"=="on" pause
|
||||
|
||||
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
|
||||
|
||||
cmd /C exit /B %ERROR_CODE%
|
||||
108
pom.xml
108
pom.xml
@@ -48,7 +48,6 @@
|
||||
<module>refaster-runner</module>
|
||||
<module>refaster-support</module>
|
||||
<module>refaster-test-support</module>
|
||||
<module>workshop</module>
|
||||
</modules>
|
||||
|
||||
<scm child.scm.developerConnection.inherit.append.path="false" child.scm.url.inherit.append.path="false">
|
||||
@@ -221,7 +220,7 @@
|
||||
<version.nopen-checker>1.0.1</version.nopen-checker>
|
||||
<version.nullaway>0.12.1</version.nullaway>
|
||||
<version.pitest-git>1.1.4</version.pitest-git>
|
||||
<version.rewrite-templating>1.16.3</version.rewrite-templating>
|
||||
<version.rewrite-templating>1.17.0</version.rewrite-templating>
|
||||
<version.surefire>3.2.3</version.surefire>
|
||||
</properties>
|
||||
|
||||
@@ -428,6 +427,14 @@
|
||||
<artifactId>byte-buddy</artifactId>
|
||||
<version>1.15.10</version>
|
||||
</dependency>
|
||||
<!-- Specified so that Renovate will file Maven upgrade PRs, which
|
||||
subsequently will cause `maven-enforcer-plugin` to require that
|
||||
developers build the project using the latest Maven release. -->
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>${version.maven}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
@@ -484,7 +491,7 @@
|
||||
<dependency>
|
||||
<groupId>org.openrewrite</groupId>
|
||||
<artifactId>rewrite-java-17</artifactId>
|
||||
<version>8.38.1</version>
|
||||
<version>8.40.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openrewrite</groupId>
|
||||
@@ -921,7 +928,7 @@
|
||||
<dependency>
|
||||
<groupId>com.puppycrawl.tools</groupId>
|
||||
<artifactId>checkstyle</artifactId>
|
||||
<version>10.20.0</version>
|
||||
<version>10.20.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.spring.nohttp</groupId>
|
||||
@@ -1114,6 +1121,9 @@
|
||||
<requireMatchingCoordinates>
|
||||
<moduleNameMustMatchArtifactId>true</moduleNameMustMatchArtifactId>
|
||||
</requireMatchingCoordinates>
|
||||
<requireMavenVersion>
|
||||
<version>${version.maven}</version>
|
||||
</requireMavenVersion>
|
||||
<requireNoRepositories />
|
||||
<requirePluginVersions />
|
||||
<requireUpperBoundDeps />
|
||||
@@ -1217,7 +1227,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.10.1</version>
|
||||
<version>3.11.1</version>
|
||||
<configuration>
|
||||
<additionalJOptions>
|
||||
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</additionalJOption>
|
||||
@@ -1300,11 +1310,6 @@
|
||||
<redirectTestOutputToFile>true</redirectTestOutputToFile>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>license-maven-plugin</artifactId>
|
||||
@@ -1452,6 +1457,37 @@
|
||||
<updateBuildOutputTimestampPolicy>never</updateBuildOutputTimestampPolicy>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.gaul</groupId>
|
||||
<artifactId>modernizer-maven-plugin</artifactId>
|
||||
<version>2.9.0</version>
|
||||
<configuration>
|
||||
<exclusionPatterns>
|
||||
<!-- The plugin suggests replacing usages of
|
||||
Guava's `Iterables` class with
|
||||
`java.util.stream.Stream` equivalents, but the
|
||||
alternative is often more verbose, requiring
|
||||
unnecessary conversions to and from streams. -->
|
||||
<exclusionPattern>com/google/common/collect/Iterables\..*</exclusionPattern>
|
||||
</exclusionPatterns>
|
||||
<failOnViolations>false</failOnViolations>
|
||||
<ignorePackages>
|
||||
<!-- Some Refaster rules purposefully use outdated
|
||||
patterns in their `@BeforeTemplate` methods. -->
|
||||
<ignorePackage>tech.picnic.errorprone.refasterrules</ignorePackage>
|
||||
</ignorePackages>
|
||||
<javaVersion>${version.jdk}</javaVersion>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>run-modernizer</id>
|
||||
<goals>
|
||||
<goal>modernizer</goal>
|
||||
</goals>
|
||||
<phase>process-test-classes</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
@@ -1464,10 +1500,28 @@
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.kordamp.maven</groupId>
|
||||
<artifactId>pomchecker-maven-plugin</artifactId>
|
||||
<version>1.14.0</version>
|
||||
<configuration>
|
||||
<failOnError>false</failOnError>
|
||||
<release>false</release>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>check-maven-central-compliance</id>
|
||||
<goals>
|
||||
<goal>check-maven-central</goal>
|
||||
</goals>
|
||||
<phase>verify</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.pitest</groupId>
|
||||
<artifactId>pitest-maven</artifactId>
|
||||
<version>1.17.0</version>
|
||||
<version>1.17.1</version>
|
||||
<configuration>
|
||||
<excludedClasses>
|
||||
<!-- AutoValue generated classes. -->
|
||||
@@ -1521,7 +1575,7 @@
|
||||
<plugin>
|
||||
<groupId>org.sonarsource.scanner.maven</groupId>
|
||||
<artifactId>sonar-maven-plugin</artifactId>
|
||||
<version>4.0.0.4121</version>
|
||||
<version>5.0.0.4389</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
@@ -1818,6 +1872,14 @@
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>tidy-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.gaul</groupId>
|
||||
<artifactId>modernizer-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.kordamp.maven</groupId>
|
||||
<artifactId>pomchecker-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
@@ -2044,6 +2106,21 @@
|
||||
<failOnMissing>true</failOnMissing>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.gaul</groupId>
|
||||
<artifactId>modernizer-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<failOnViolations>true</failOnViolations>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.kordamp.maven</groupId>
|
||||
<artifactId>pomchecker-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<failOnError>true</failOnError>
|
||||
<failOnWarning>true</failOnWarning>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
@@ -2115,6 +2192,13 @@
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
</plugin>
|
||||
<?SORTPOM RESUME?>
|
||||
<plugin>
|
||||
<groupId>org.kordamp.maven</groupId>
|
||||
<artifactId>pomchecker-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<release>true</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
|
||||
@@ -1,8 +1,29 @@
|
||||
# An overview of Error Prone Support releases, along with compatible Error
|
||||
# Prone releases. This data was generated by `generate-version-compatibility-overview.sh`.
|
||||
releases:
|
||||
- version: 0.19.1
|
||||
compatible:
|
||||
- "2.35.1"
|
||||
- "2.35.0"
|
||||
- "2.34.0"
|
||||
- "2.33.0"
|
||||
- "2.32.0"
|
||||
- "2.31.0"
|
||||
- "2.30.0"
|
||||
- version: 0.19.0
|
||||
compatible:
|
||||
- "2.35.1"
|
||||
- "2.35.0"
|
||||
- "2.34.0"
|
||||
- "2.33.0"
|
||||
- "2.32.0"
|
||||
- "2.31.0"
|
||||
- "2.30.0"
|
||||
- version: 0.18.0
|
||||
compatible:
|
||||
- "2.35.1"
|
||||
- "2.35.0"
|
||||
- "2.34.0"
|
||||
- "2.33.0"
|
||||
- "2.32.0"
|
||||
- "2.31.0"
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
# Error Prone Workshop
|
||||
|
||||
Download the slides [here][eps-workshop-slides].
|
||||
|
||||
## Initial setup of the workshop
|
||||
|
||||
1. Start by cloning this repository locally from GitHub.
|
||||
2. Checkout the `workshop` branch.
|
||||
3. Make sure to run `mvn clean install` in the root of this repository.
|
||||
4. Open your code editor and familiarize yourself with the project structure.
|
||||
|
||||
In IntelliJ IDEA (or your preferred editor), try to run the
|
||||
`WorkshopRefasterRulesTest` test. You might see the following error:
|
||||
|
||||
```
|
||||
java: exporting a package from system module jdk.compiler is not allowed with --release
|
||||
```
|
||||
|
||||
If this happens, go to _File -> Settings... -> Build, Execution, Deployment ->
|
||||
Compiler -> Java Compiler_ and deselect the option _Use '--release' option for
|
||||
cross-compilation (Java 9 and later)_.
|
||||
|
||||
If you encounter any other bugs when running `mvn clean install`, make sure you
|
||||
are using a recent release of JDK 17.
|
||||
|
||||
Now the project is ready for the workshop.
|
||||
|
||||
## Part 1: Writing Refaster rules
|
||||
|
||||
During this part of the workshop we will implement multiple Refaster rules.
|
||||
|
||||
Go to the `workshop` module and navigate to the
|
||||
`tech.picnic.errorprone.workshop.refasterrules` package. There you can find one
|
||||
example and five different exercises to do. Make sure to open the
|
||||
`WorkshopRefasterRulesTest` class where you can enable tests. Per assignment
|
||||
there is a test in this class that you can enable (by dropping the `@Disabled`
|
||||
annotation) to validate your changes. The goal is to implement or improve the
|
||||
Refaster rules such that the enabled tests pass.
|
||||
|
||||
Tips:
|
||||
|
||||
* Go through the exercises in the proposed order.
|
||||
* The `XXX:` comments explain what needs to happen.
|
||||
* Find the test case for each Refaster rule by looking for the name of the
|
||||
Refaster rule, prefixed with `test`. For example, the
|
||||
`WorkshopAssignment0Rules.java` rule collection has a Refaster rule named
|
||||
`ExampleStringIsEmpty`. In the `WorkshopAssignment0RulesTestInput.java` and
|
||||
`WorkshopAssignment0RulesTestOutput.java` files there is a
|
||||
`testExampleStringIsEmpty` method that shows the input and output to test the
|
||||
Refaster rule.
|
||||
|
||||
## Part 2: Writing Error Prone checks
|
||||
|
||||
During this part of the workshop we will implement parts of multiple Error
|
||||
Prone `BugChecker`s. Each of these classes contain `XXX` comments explaining
|
||||
what needs to be implemented. However, before diving in, make sure to first
|
||||
navigate to a check's associated test class to drop the class-level `@Disabled`
|
||||
annotation. Upon initial execution the tests will fail; the goal is to get then
|
||||
to pass.
|
||||
|
||||
Some utility classes that you can use:
|
||||
|
||||
* `com.google.errorprone.util.ASTHelpers`: contains many common operations on
|
||||
the Abstract Syntax Tree.
|
||||
* `com.google.errorprone.fixes.SuggestedFixes`: contains helper methods for
|
||||
creating `Fix`es.
|
||||
|
||||
### Tips and tricks
|
||||
|
||||
If you are working from the command line, it is suggested to run commands in
|
||||
the `workshop` directory. To do this, navigate to the root of the repository
|
||||
and run:
|
||||
|
||||
```bash
|
||||
cd workshop
|
||||
```
|
||||
|
||||
In case you want to do a fast build to just compile the project, run:
|
||||
|
||||
```bash
|
||||
mvn clean install -DskipTests -Dverification.skip
|
||||
```
|
||||
|
||||
In case you want to run one test from the command line, run the following
|
||||
commands:
|
||||
|
||||
```bash
|
||||
mvn clean install -Dtest=WorkshopRefasterRulesTest -Dverification.skip
|
||||
```
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
Make sure to use the latest version of JDK 21 or 17.
|
||||
|
||||
In some specific cases the `-Dverification.skip` is not correctly processed. In
|
||||
that case, use `-D"verification.skip"`.
|
||||
|
||||
In case there is an error mentioning the `BetaApi` check, please rebuild or try
|
||||
to `Reload All Maven projects`.
|
||||
|
||||
|
||||
[eps-github]: https://github.com/PicnicSupermarket/error-prone-support
|
||||
|
||||
[eps-workshop-slides]: https://docs.google.com/presentation/d/1XQJohAUGSmDyOywJCZWZBjmsRRt1FQ5ykE0F-NaY6Lo/edit?usp=sharing
|
||||
160
workshop/pom.xml
160
workshop/pom.xml
@@ -1,160 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>tech.picnic.error-prone-support</groupId>
|
||||
<artifactId>error-prone-support</artifactId>
|
||||
<version>0.19.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>workshop</artifactId>
|
||||
|
||||
<name>Picnic :: Error Prone Support :: Workshop</name>
|
||||
<description>Project for the Error Prone Workshop.</description>
|
||||
<url>https://error-prone.picnic.tech</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${groupId.error-prone}</groupId>
|
||||
<artifactId>error_prone_annotation</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${groupId.error-prone}</groupId>
|
||||
<artifactId>error_prone_annotations</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${groupId.error-prone}</groupId>
|
||||
<artifactId>error_prone_check_api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${groupId.error-prone}</groupId>
|
||||
<artifactId>error_prone_core</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${groupId.error-prone}</groupId>
|
||||
<artifactId>error_prone_test_helpers</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>error-prone-utils</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>refaster-compiler</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>refaster-support</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>refaster-test-support</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.auto.service</groupId>
|
||||
<artifactId>auto-service-annotations</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jspecify</groupId>
|
||||
<artifactId>jspecify</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-params</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openrewrite</groupId>
|
||||
<artifactId>rewrite-core</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openrewrite</groupId>
|
||||
<artifactId>rewrite-java</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openrewrite</groupId>
|
||||
<artifactId>rewrite-java-11</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openrewrite</groupId>
|
||||
<artifactId>rewrite-templating</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<annotationProcessorPaths combine.children="append">
|
||||
<path>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>refaster-compiler</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</path>
|
||||
<path>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>refaster-support</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
<compilerArgs combine.children="append">
|
||||
<arg>-Xplugin:RefasterRuleCompiler</arg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,38 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.bugpatterns;
|
||||
|
||||
import static com.google.errorprone.BugPattern.SeverityLevel.WARNING;
|
||||
import static com.google.errorprone.BugPattern.StandardTags.SIMPLIFICATION;
|
||||
|
||||
import com.google.auto.service.AutoService;
|
||||
import com.google.errorprone.BugPattern;
|
||||
import com.google.errorprone.VisitorState;
|
||||
import com.google.errorprone.bugpatterns.BugChecker;
|
||||
import com.google.errorprone.bugpatterns.BugChecker.MethodTreeMatcher;
|
||||
import com.google.errorprone.fixes.SuggestedFix;
|
||||
import com.google.errorprone.matchers.Description;
|
||||
import com.google.errorprone.util.ASTHelpers;
|
||||
import com.sun.source.tree.MethodTree;
|
||||
|
||||
/** A {@link BugChecker} that flags empty methods that seemingly can simply be deleted. */
|
||||
@AutoService(BugChecker.class)
|
||||
@BugPattern(
|
||||
summary = "Empty method can likely be deleted",
|
||||
severity = WARNING,
|
||||
tags = SIMPLIFICATION)
|
||||
public final class Assignment0DeleteEmptyMethod extends BugChecker implements MethodTreeMatcher {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** Instantiates a new {@link Assignment0DeleteEmptyMethod} instance. */
|
||||
public Assignment0DeleteEmptyMethod() {}
|
||||
|
||||
@Override
|
||||
public Description matchMethod(MethodTree tree, VisitorState state) {
|
||||
if (tree.getBody() == null
|
||||
|| !tree.getBody().getStatements().isEmpty()
|
||||
|| ASTHelpers.hasAnnotation(tree, Override.class.getName(), state)) {
|
||||
return Description.NO_MATCH;
|
||||
}
|
||||
|
||||
return describeMatch(tree, SuggestedFix.delete(tree));
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.bugpatterns;
|
||||
|
||||
import static com.google.errorprone.BugPattern.SeverityLevel.SUGGESTION;
|
||||
import static com.google.errorprone.BugPattern.StandardTags.SIMPLIFICATION;
|
||||
import static com.google.errorprone.matchers.Matchers.allOf;
|
||||
import static com.google.errorprone.matchers.Matchers.argument;
|
||||
import static com.google.errorprone.matchers.Matchers.argumentCount;
|
||||
import static com.google.errorprone.matchers.Matchers.instanceMethod;
|
||||
import static com.google.errorprone.matchers.Matchers.nullLiteral;
|
||||
|
||||
import com.google.errorprone.BugPattern;
|
||||
import com.google.errorprone.VisitorState;
|
||||
import com.google.errorprone.bugpatterns.BugChecker;
|
||||
import com.google.errorprone.bugpatterns.BugChecker.MethodInvocationTreeMatcher;
|
||||
import com.google.errorprone.fixes.SuggestedFix;
|
||||
import com.google.errorprone.fixes.SuggestedFixes;
|
||||
import com.google.errorprone.matchers.Description;
|
||||
import com.google.errorprone.matchers.Matcher;
|
||||
import com.sun.source.tree.MethodInvocationTree;
|
||||
|
||||
/**
|
||||
* A {@link BugChecker} that flags AssertJ {@code isEqualTo(null)} checks for simplification.
|
||||
*
|
||||
* <p>This bug checker cannot be replaced with a simple Refaster rule, as the Refaster approach
|
||||
* would require that all overloads of {@link org.assertj.core.api.Assert#isEqualTo(Object)} (such
|
||||
* as {@link org.assertj.core.api.AbstractStringAssert#isEqualTo(String)}) are explicitly
|
||||
* enumerated. This bug checker generically matches all such current and future overloads.
|
||||
*/
|
||||
@BugPattern(
|
||||
summary = "Prefer `.isNull()` over `.isEqualTo(null)`",
|
||||
severity = SUGGESTION,
|
||||
tags = SIMPLIFICATION)
|
||||
public final class Assignment1AssertJIsNullMethod extends BugChecker
|
||||
implements MethodInvocationTreeMatcher {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Matcher<MethodInvocationTree> ASSERT_IS_EQUAL_TO_NULL =
|
||||
allOf(
|
||||
instanceMethod().onDescendantOf("org.assertj.core.api.Assert").named("isEqualTo"),
|
||||
argumentCount(1),
|
||||
argument(0, nullLiteral()));
|
||||
|
||||
/** Instantiates a new {@link Assignment1AssertJIsNullMethod} instance. */
|
||||
public Assignment1AssertJIsNullMethod() {}
|
||||
|
||||
@Override
|
||||
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) {
|
||||
// This statement filters out `MethodInvocation`s that are *not* `assertThat().isEqualTo(null)`
|
||||
// statements.
|
||||
if (!ASSERT_IS_EQUAL_TO_NULL.matches(tree, state)) {
|
||||
return Description.NO_MATCH;
|
||||
}
|
||||
|
||||
SuggestedFix.Builder fix =
|
||||
SuggestedFix.builder().merge(SuggestedFixes.renameMethodInvocation(tree, "isNull", state));
|
||||
tree.getArguments().forEach(arg -> fix.merge(SuggestedFix.delete(arg)));
|
||||
|
||||
return describeMatch(tree, fix.build());
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.bugpatterns;
|
||||
|
||||
import static com.google.errorprone.BugPattern.SeverityLevel.SUGGESTION;
|
||||
import static com.google.errorprone.BugPattern.StandardTags.SIMPLIFICATION;
|
||||
import static com.google.errorprone.matchers.Matchers.staticMethod;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.errorprone.BugPattern;
|
||||
import com.google.errorprone.VisitorState;
|
||||
import com.google.errorprone.bugpatterns.BugChecker;
|
||||
import com.google.errorprone.bugpatterns.BugChecker.MethodInvocationTreeMatcher;
|
||||
import com.google.errorprone.fixes.SuggestedFix;
|
||||
import com.google.errorprone.matchers.Description;
|
||||
import com.google.errorprone.matchers.Matcher;
|
||||
import com.sun.source.tree.ExpressionTree;
|
||||
import com.sun.source.tree.MethodInvocationTree;
|
||||
import java.util.List;
|
||||
import tech.picnic.errorprone.utils.SourceCode;
|
||||
|
||||
/**
|
||||
* A {@link BugChecker} that flags method invocations for which all arguments are wrapped using
|
||||
* {@link org.mockito.Mockito#eq}; this is redundant.
|
||||
*/
|
||||
@BugPattern(
|
||||
summary = "Don't unnecessarily use Mockito's `eq(...)`",
|
||||
severity = SUGGESTION,
|
||||
tags = SIMPLIFICATION)
|
||||
public final class Assignment2DropMockitoEq extends BugChecker
|
||||
implements MethodInvocationTreeMatcher {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Matcher<ExpressionTree> MOCKITO_EQ_METHOD =
|
||||
staticMethod().onClass("org.mockito.ArgumentMatchers").named("eq");
|
||||
|
||||
/** Instantiates a new {@link Assignment2DropMockitoEq} instance. */
|
||||
public Assignment2DropMockitoEq() {}
|
||||
|
||||
@Override
|
||||
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) {
|
||||
// XXX: Make sure to return `Description.NO_MATCH` if the `tree` doesn't have arguments, or if
|
||||
// the `isEqInvocation` method below returns `false` for at least one of the arguments.
|
||||
List<? extends ExpressionTree> arguments = tree.getArguments();
|
||||
if (arguments.isEmpty() || !arguments.stream().allMatch(arg -> isEqInvocation(arg, state))) {
|
||||
return Description.NO_MATCH;
|
||||
}
|
||||
|
||||
SuggestedFix.Builder suggestedFix = SuggestedFix.builder();
|
||||
for (ExpressionTree arg : arguments) {
|
||||
suggestedFix.replace(
|
||||
arg,
|
||||
SourceCode.treeToString(
|
||||
Iterables.getOnlyElement(((MethodInvocationTree) arg).getArguments()), state));
|
||||
}
|
||||
|
||||
return describeMatch(tree, suggestedFix.build());
|
||||
}
|
||||
|
||||
private static boolean isEqInvocation(ExpressionTree tree, VisitorState state) {
|
||||
return tree instanceof MethodInvocationTree && MOCKITO_EQ_METHOD.matches(tree, state);
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.bugpatterns;
|
||||
|
||||
import static com.google.errorprone.BugPattern.SeverityLevel.SUGGESTION;
|
||||
import static com.google.errorprone.BugPattern.StandardTags.SIMPLIFICATION;
|
||||
import static com.google.errorprone.matchers.ChildMultiMatcher.MatchType.AT_LEAST_ONE;
|
||||
import static com.google.errorprone.matchers.Matchers.annotations;
|
||||
import static com.google.errorprone.matchers.Matchers.isType;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.errorprone.BugPattern;
|
||||
import com.google.errorprone.VisitorState;
|
||||
import com.google.errorprone.bugpatterns.BugChecker;
|
||||
import com.google.errorprone.bugpatterns.BugChecker.ClassTreeMatcher;
|
||||
import com.google.errorprone.matchers.Description;
|
||||
import com.google.errorprone.matchers.MultiMatcher;
|
||||
import com.google.errorprone.matchers.MultiMatcher.MultiMatchResult;
|
||||
import com.google.errorprone.util.ASTHelpers;
|
||||
import com.sun.source.tree.AnnotationTree;
|
||||
import com.sun.source.tree.ClassTree;
|
||||
import com.sun.source.tree.MethodTree;
|
||||
import com.sun.source.tree.Tree;
|
||||
import java.util.List;
|
||||
import tech.picnic.errorprone.utils.SourceCode;
|
||||
|
||||
/** A {@link BugChecker} that flags redundant {@code @Autowired} constructor annotations. */
|
||||
@BugPattern(
|
||||
summary = "Omit `@Autowired` on a class' sole constructor, as it is redundant",
|
||||
severity = SUGGESTION,
|
||||
tags = SIMPLIFICATION)
|
||||
public final class Assignment3DropAutowiredConstructorAnnotation extends BugChecker
|
||||
implements ClassTreeMatcher {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final MultiMatcher<Tree, AnnotationTree> AUTOWIRED_ANNOTATION =
|
||||
annotations(AT_LEAST_ONE, isType("org.springframework.beans.factory.annotation.Autowired"));
|
||||
|
||||
/** Instantiates a new {@link Assignment3DropAutowiredConstructorAnnotation} instance. */
|
||||
public Assignment3DropAutowiredConstructorAnnotation() {}
|
||||
|
||||
@Override
|
||||
public Description matchClass(ClassTree tree, VisitorState state) {
|
||||
// XXX: Using the `ASTHelpers#getConstructors` method, return `Description.NO_MATCH` if we do
|
||||
// not have exactly 1 constructor (start by dropping `new ArrayList<>()` on the next line).
|
||||
List<MethodTree> constructors = ASTHelpers.getConstructors(tree);
|
||||
if (constructors.size() != 1) {
|
||||
return Description.NO_MATCH;
|
||||
}
|
||||
|
||||
MultiMatchResult<AnnotationTree> hasAutowiredAnnotation =
|
||||
AUTOWIRED_ANNOTATION.multiMatchResult(Iterables.getOnlyElement(constructors), state);
|
||||
if (!hasAutowiredAnnotation.matches()) {
|
||||
return Description.NO_MATCH;
|
||||
}
|
||||
|
||||
AnnotationTree annotation = hasAutowiredAnnotation.onlyMatchingNode();
|
||||
return describeMatch(annotation, SourceCode.deleteWithTrailingWhitespace(annotation, state));
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.bugpatterns;
|
||||
|
||||
import static com.google.errorprone.BugPattern.SeverityLevel.WARNING;
|
||||
import static com.google.errorprone.BugPattern.StandardTags.SIMPLIFICATION;
|
||||
import static com.google.errorprone.matchers.ChildMultiMatcher.MatchType.AT_LEAST_ONE;
|
||||
import static com.google.errorprone.matchers.Matchers.annotations;
|
||||
import static com.google.errorprone.matchers.Matchers.anyOf;
|
||||
import static com.google.errorprone.matchers.Matchers.isType;
|
||||
|
||||
import com.google.auto.service.AutoService;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.errorprone.BugPattern;
|
||||
import com.google.errorprone.VisitorState;
|
||||
import com.google.errorprone.bugpatterns.BugChecker;
|
||||
import com.google.errorprone.bugpatterns.BugChecker.MethodTreeMatcher;
|
||||
import com.google.errorprone.fixes.SuggestedFix;
|
||||
import com.google.errorprone.fixes.SuggestedFixes;
|
||||
import com.google.errorprone.matchers.Description;
|
||||
import com.google.errorprone.matchers.MultiMatcher;
|
||||
import com.sun.source.tree.AnnotationTree;
|
||||
import com.sun.source.tree.MethodTree;
|
||||
import javax.lang.model.element.Modifier;
|
||||
|
||||
/** A {@link BugChecker} that flags non-canonical JUnit method declarations. */
|
||||
@AutoService(BugChecker.class)
|
||||
@BugPattern(
|
||||
summary = "JUnit method declaration can likely be improved",
|
||||
severity = WARNING,
|
||||
tags = SIMPLIFICATION)
|
||||
@SuppressWarnings({
|
||||
"UnusedMethod",
|
||||
"UnusedVariable"
|
||||
} /* This check is yet to be implemented as part of the demo. */)
|
||||
public final class Assignment4JUnitTestMethodDeclaration extends BugChecker
|
||||
implements MethodTreeMatcher {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final ImmutableSet<Modifier> ILLEGAL_MODIFIERS =
|
||||
Sets.immutableEnumSet(Modifier.PRIVATE, Modifier.PROTECTED, Modifier.PUBLIC);
|
||||
private static final MultiMatcher<MethodTree, AnnotationTree> TEST_METHOD =
|
||||
annotations(AT_LEAST_ONE, anyOf(isType("org.junit.jupiter.api.Test")));
|
||||
|
||||
/** Instantiates a new {@link Assignment4JUnitTestMethodDeclaration} instance. */
|
||||
public Assignment4JUnitTestMethodDeclaration() {}
|
||||
|
||||
@Override
|
||||
public Description matchMethod(MethodTree tree, VisitorState state) {
|
||||
if (!TEST_METHOD.matches(tree, state)) {
|
||||
return Description.NO_MATCH;
|
||||
}
|
||||
|
||||
SuggestedFix.Builder fixBuilder = SuggestedFix.builder();
|
||||
|
||||
// XXX: Part 2: Make sure that JUnit test methods don't use any of the modifiers from the
|
||||
// `ILLEGAL_MODIFIERS` field, by using `SuggestedFixes#removeModifiers` and
|
||||
// `SuggestedFix.Builder#merge`.
|
||||
SuggestedFixes.removeModifiers(tree.getModifiers(), state, ILLEGAL_MODIFIERS)
|
||||
.ifPresent(fixBuilder::merge);
|
||||
|
||||
if (fixBuilder.isEmpty()) {
|
||||
return Description.NO_MATCH;
|
||||
}
|
||||
|
||||
return describeMatch(tree, fixBuilder.build());
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.bugpatterns;
|
||||
|
||||
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
||||
import static com.google.errorprone.BugPattern.SeverityLevel.WARNING;
|
||||
import static com.google.errorprone.BugPattern.StandardTags.SIMPLIFICATION;
|
||||
import static com.google.errorprone.matchers.Matchers.anyOf;
|
||||
import static com.google.errorprone.matchers.Matchers.staticMethod;
|
||||
import static com.google.errorprone.suppliers.Suppliers.OBJECT_TYPE;
|
||||
|
||||
import com.google.common.primitives.Primitives;
|
||||
import com.google.errorprone.BugPattern;
|
||||
import com.google.errorprone.VisitorState;
|
||||
import com.google.errorprone.bugpatterns.BugChecker;
|
||||
import com.google.errorprone.bugpatterns.BugChecker.MethodInvocationTreeMatcher;
|
||||
import com.google.errorprone.bugpatterns.TypesWithUndefinedEquality;
|
||||
import com.google.errorprone.fixes.SuggestedFix;
|
||||
import com.google.errorprone.matchers.Description;
|
||||
import com.google.errorprone.matchers.Matcher;
|
||||
import com.google.errorprone.util.ASTHelpers;
|
||||
import com.google.errorprone.util.ASTHelpers.TargetType;
|
||||
import com.sun.source.tree.ExpressionTree;
|
||||
import com.sun.source.tree.MemberSelectTree;
|
||||
import com.sun.source.tree.MethodInvocationTree;
|
||||
import com.sun.tools.javac.code.Type;
|
||||
import com.sun.tools.javac.code.Types;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import tech.picnic.errorprone.utils.SourceCode;
|
||||
|
||||
/** A {@link BugChecker} that flags redundant identity conversions. */
|
||||
@BugPattern(
|
||||
summary = "Avoid or clarify identity conversions",
|
||||
severity = WARNING,
|
||||
tags = SIMPLIFICATION)
|
||||
public final class Assignment5DeleteIdentityConversion extends BugChecker
|
||||
implements MethodInvocationTreeMatcher {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Matcher<ExpressionTree> IS_CONVERSION_METHOD =
|
||||
anyOf(
|
||||
staticMethod()
|
||||
.onClassAny(
|
||||
Primitives.allWrapperTypes().stream()
|
||||
.map(Class::getName)
|
||||
.collect(toImmutableSet()))
|
||||
.named("valueOf"),
|
||||
staticMethod().onClass(String.class.getName()).named("valueOf"),
|
||||
staticMethod()
|
||||
.onClassAny(
|
||||
"com.google.common.collect.ImmutableBiMap",
|
||||
"com.google.common.collect.ImmutableList",
|
||||
"com.google.common.collect.ImmutableListMultimap",
|
||||
"com.google.common.collect.ImmutableMap",
|
||||
"com.google.common.collect.ImmutableMultimap",
|
||||
"com.google.common.collect.ImmutableMultiset",
|
||||
"com.google.common.collect.ImmutableRangeMap",
|
||||
"com.google.common.collect.ImmutableRangeSet",
|
||||
"com.google.common.collect.ImmutableSet",
|
||||
"com.google.common.collect.ImmutableSetMultimap",
|
||||
"com.google.common.collect.ImmutableTable")
|
||||
.named("copyOf"),
|
||||
staticMethod()
|
||||
.onClass("com.google.errorprone.matchers.Matchers")
|
||||
.namedAnyOf("allOf", "anyOf"));
|
||||
|
||||
/** Instantiates a new {@link Assignment5DeleteIdentityConversion} instance. */
|
||||
public Assignment5DeleteIdentityConversion() {}
|
||||
|
||||
@Override
|
||||
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) {
|
||||
List<? extends ExpressionTree> arguments = tree.getArguments();
|
||||
if (arguments.size() != 1 || !IS_CONVERSION_METHOD.matches(tree, state)) {
|
||||
return Description.NO_MATCH;
|
||||
}
|
||||
|
||||
ExpressionTree sourceTree = arguments.get(0);
|
||||
Type sourceType = ASTHelpers.getType(sourceTree);
|
||||
Type resultType = ASTHelpers.getType(tree);
|
||||
TargetType targetType = ASTHelpers.targetType(state);
|
||||
if (sourceType == null || resultType == null || targetType == null) {
|
||||
return Description.NO_MATCH;
|
||||
}
|
||||
|
||||
if (!state.getTypes().isSameType(sourceType, resultType)
|
||||
&& !isConvertibleWithWellDefinedEquality(sourceType, targetType.type(), state)) {
|
||||
return Description.NO_MATCH;
|
||||
}
|
||||
|
||||
if (sourceType.isPrimitive()
|
||||
&& state.getPath().getParentPath().getLeaf() instanceof MemberSelectTree) {
|
||||
return Description.NO_MATCH;
|
||||
}
|
||||
|
||||
return buildDescription(tree)
|
||||
.addFix(SuggestedFix.replace(tree, SourceCode.treeToString(sourceTree, state)))
|
||||
.build();
|
||||
}
|
||||
|
||||
private static boolean isConvertibleWithWellDefinedEquality(
|
||||
Type sourceType, Type targetType, VisitorState state) {
|
||||
Types types = state.getTypes();
|
||||
return !types.isSameType(targetType, OBJECT_TYPE.get(state))
|
||||
&& types.isConvertible(sourceType, targetType)
|
||||
&& Arrays.stream(TypesWithUndefinedEquality.values())
|
||||
.noneMatch(b -> b.matchesType(sourceType, state) || b.matchesType(targetType, state));
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.refasterrules;
|
||||
|
||||
import com.google.errorprone.refaster.annotation.AfterTemplate;
|
||||
import com.google.errorprone.refaster.annotation.BeforeTemplate;
|
||||
|
||||
/** Refaster rule used as example for the assignments of the workshop. */
|
||||
final class WorkshopAssignment0Rules {
|
||||
private WorkshopAssignment0Rules() {}
|
||||
|
||||
/** Prefer {@link String#isEmpty()} over alternatives that consult the string's length. */
|
||||
static final class ExampleStringIsEmpty {
|
||||
@BeforeTemplate
|
||||
boolean before(String s) {
|
||||
return s.length() == 0;
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
boolean after(String s) {
|
||||
return s.isEmpty();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.refasterrules;
|
||||
|
||||
import com.google.errorprone.refaster.annotation.AfterTemplate;
|
||||
import com.google.errorprone.refaster.annotation.BeforeTemplate;
|
||||
|
||||
/** Refaster rules for the first assignment of the workshop. */
|
||||
final class WorkshopAssignment1Rules {
|
||||
private WorkshopAssignment1Rules() {}
|
||||
|
||||
/** Prefer {@link String#String(char[])} over {@link String#copyValueOf(char[])}. */
|
||||
static final class NewStringCharArray {
|
||||
@BeforeTemplate
|
||||
String before(char[] chars) {
|
||||
return String.copyValueOf(chars);
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
String after(char[] chars) {
|
||||
return new String(chars);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.refasterrules;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.errorprone.refaster.Refaster;
|
||||
import com.google.errorprone.refaster.annotation.AfterTemplate;
|
||||
import com.google.errorprone.refaster.annotation.BeforeTemplate;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/** Refaster rules for the second assignment of the workshop. */
|
||||
final class WorkshopAssignment2Rules {
|
||||
private WorkshopAssignment2Rules() {}
|
||||
|
||||
/**
|
||||
* Prefer {@link ImmutableList#of(Object)} over alternatives that don't communicate the
|
||||
* immutability of the resulting list at the type level.
|
||||
*/
|
||||
static final class ImmutableListOfOne<T> {
|
||||
@BeforeTemplate
|
||||
List<T> before(T element) {
|
||||
return Refaster.anyOf(Collections.singletonList(element), List.of(element));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
ImmutableList<T> after(T element) {
|
||||
return ImmutableList.of(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.refasterrules;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.errorprone.refaster.annotation.AfterTemplate;
|
||||
import com.google.errorprone.refaster.annotation.BeforeTemplate;
|
||||
import com.google.errorprone.refaster.annotation.UseImportPolicy;
|
||||
|
||||
/** Refaster rules for the third assignment of the workshop. */
|
||||
final class WorkshopAssignment3Rules {
|
||||
private WorkshopAssignment3Rules() {}
|
||||
|
||||
/** Prefer {@link Preconditions#checkArgument(boolean)} over if statements. */
|
||||
static final class CheckArgumentWithoutMessage {
|
||||
@BeforeTemplate
|
||||
void before(boolean expression) {
|
||||
if (expression) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@UseImportPolicy(STATIC_IMPORT_ALWAYS)
|
||||
void after(boolean expression) {
|
||||
checkArgument(!expression);
|
||||
}
|
||||
}
|
||||
|
||||
/** Prefer {@link Preconditions#checkArgument(boolean, Object)} over if statements. */
|
||||
static final class CheckArgumentWithMessage {
|
||||
@BeforeTemplate
|
||||
void before(boolean expression, String message) {
|
||||
if (expression) {
|
||||
throw new IllegalArgumentException(message);
|
||||
}
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@UseImportPolicy(STATIC_IMPORT_ALWAYS)
|
||||
void after(boolean expression, String message) {
|
||||
checkArgument(!expression, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.refasterrules;
|
||||
|
||||
import com.google.errorprone.refaster.Refaster;
|
||||
import com.google.errorprone.refaster.annotation.AfterTemplate;
|
||||
import com.google.errorprone.refaster.annotation.AlsoNegation;
|
||||
import com.google.errorprone.refaster.annotation.BeforeTemplate;
|
||||
import java.util.Objects;
|
||||
|
||||
/** Refaster rules for the fourth assignment of the workshop. */
|
||||
@SuppressWarnings("java:S1698" /* Reference comparison is valid for enums. */)
|
||||
final class WorkshopAssignment4Rules {
|
||||
private WorkshopAssignment4Rules() {}
|
||||
|
||||
static final class PrimitiveOrReferenceEqualityEnum<T extends Enum<T>> {
|
||||
@BeforeTemplate
|
||||
boolean before(T a, T b) {
|
||||
return Refaster.anyOf(a.equals(b), Objects.equals(a, b));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@AlsoNegation
|
||||
boolean after(T a, T b) {
|
||||
return a == b;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.refasterrules;
|
||||
|
||||
import com.google.errorprone.refaster.annotation.AfterTemplate;
|
||||
import com.google.errorprone.refaster.annotation.BeforeTemplate;
|
||||
import com.google.errorprone.refaster.annotation.MayOptionallyUse;
|
||||
import com.google.errorprone.refaster.annotation.Placeholder;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/** Refaster rules for the fifth assignment of the workshop. */
|
||||
final class WorkshopAssignment5Rules {
|
||||
private WorkshopAssignment5Rules() {}
|
||||
|
||||
abstract static class StreamDoAllMatch<T> {
|
||||
@Placeholder
|
||||
abstract boolean test(@MayOptionallyUse T element);
|
||||
|
||||
@BeforeTemplate
|
||||
boolean before(Stream<T> stream) {
|
||||
return stream.noneMatch(v -> !test(v));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
boolean after(Stream<T> stream) {
|
||||
return stream.allMatch(v -> test(v));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.bugpatterns;
|
||||
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper;
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;
|
||||
import com.google.errorprone.CompilationTestHelper;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@Disabled("Enable this when implementing the BugChecker.")
|
||||
final class Assignment0DeleteEmptyMethodTest {
|
||||
@Test
|
||||
void identification() {
|
||||
CompilationTestHelper.newInstance(Assignment0DeleteEmptyMethod.class, getClass())
|
||||
.addSourceLines(
|
||||
"A.java",
|
||||
"class A {",
|
||||
" Object m1() {",
|
||||
" return null;",
|
||||
" }",
|
||||
"",
|
||||
" void m2() {",
|
||||
" System.out.println(42);",
|
||||
" }",
|
||||
"",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" static void m3() {}",
|
||||
"",
|
||||
" interface F {",
|
||||
" void fun();",
|
||||
" }",
|
||||
"}")
|
||||
.addSourceLines(
|
||||
"B.java",
|
||||
"final class B implements A.F {",
|
||||
" @Override",
|
||||
" public void fun() {}",
|
||||
"",
|
||||
" /** Javadoc. */",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" void m4() {}",
|
||||
"}")
|
||||
.doTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
void replacement() {
|
||||
BugCheckerRefactoringTestHelper.newInstance(Assignment0DeleteEmptyMethod.class, getClass())
|
||||
.addInputLines(
|
||||
"A.java",
|
||||
"final class A {",
|
||||
"",
|
||||
" void instanceMethod() {}",
|
||||
"",
|
||||
" static void staticMethod() {}",
|
||||
"",
|
||||
" static void staticMethodWithComment() {",
|
||||
" System.out.println(42);",
|
||||
" }",
|
||||
"}")
|
||||
.addOutputLines(
|
||||
"A.java",
|
||||
"final class A {",
|
||||
"",
|
||||
" static void staticMethodWithComment() {",
|
||||
" System.out.println(42);",
|
||||
" }",
|
||||
"}")
|
||||
.doTest(TestMode.TEXT_MATCH);
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.bugpatterns;
|
||||
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper;
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;
|
||||
import com.google.errorprone.CompilationTestHelper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
final class Assignment1AssertJIsNullMethodTest {
|
||||
@Test
|
||||
void identification() {
|
||||
CompilationTestHelper.newInstance(Assignment1AssertJIsNullMethod.class, getClass())
|
||||
.addSourceLines(
|
||||
"A.java",
|
||||
"import static org.assertj.core.api.Assertions.assertThat;",
|
||||
"",
|
||||
"class A {",
|
||||
" void m() {",
|
||||
" assertThat(1).isEqualTo(1);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" assertThat(1).isEqualTo(null);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" assertThat(\"foo\").isEqualTo(null);",
|
||||
" isEqualTo(null);",
|
||||
" }",
|
||||
"",
|
||||
" private boolean isEqualTo(Object value) {",
|
||||
" return value.equals(\"bar\");",
|
||||
" }",
|
||||
"}")
|
||||
.doTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
void replacement() {
|
||||
BugCheckerRefactoringTestHelper.newInstance(Assignment1AssertJIsNullMethod.class, getClass())
|
||||
.addInputLines(
|
||||
"A.java",
|
||||
"import static org.assertj.core.api.Assertions.assertThat;",
|
||||
"",
|
||||
"class A {",
|
||||
" void m() {",
|
||||
" assertThat(1).isEqualTo(null);",
|
||||
" assertThat(\"foo\").isEqualTo(null);",
|
||||
" }",
|
||||
"}")
|
||||
.addOutputLines(
|
||||
"A.java",
|
||||
"import static org.assertj.core.api.Assertions.assertThat;",
|
||||
"",
|
||||
"class A {",
|
||||
" void m() {",
|
||||
" assertThat(1).isNull();",
|
||||
" assertThat(\"foo\").isNull();",
|
||||
" }",
|
||||
"}")
|
||||
.doTest(TestMode.TEXT_MATCH);
|
||||
}
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.bugpatterns;
|
||||
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper;
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;
|
||||
import com.google.errorprone.CompilationTestHelper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
final class Assignment2DropMockitoEqTest {
|
||||
@Test
|
||||
void identification() {
|
||||
CompilationTestHelper.newInstance(Assignment2DropMockitoEq.class, getClass())
|
||||
.addSourceLines(
|
||||
"A.java",
|
||||
"import static org.mockito.ArgumentMatchers.eq;",
|
||||
"import static org.mockito.ArgumentMatchers.notNull;",
|
||||
"import static org.mockito.Mockito.doAnswer;",
|
||||
"import static org.mockito.Mockito.mock;",
|
||||
"",
|
||||
"import java.util.function.BiConsumer;",
|
||||
"import java.util.function.Consumer;",
|
||||
"import org.mockito.ArgumentMatchers;",
|
||||
"",
|
||||
"class A {",
|
||||
" void m() {",
|
||||
" Runnable runnable = mock(Runnable.class);",
|
||||
" doAnswer(inv -> null).when(runnable).run();",
|
||||
"",
|
||||
" Consumer<String> consumer = mock(Consumer.class);",
|
||||
" doAnswer(inv -> null).when(consumer).accept(\"foo\");",
|
||||
" doAnswer(inv -> null).when(consumer).accept(notNull());",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" doAnswer(inv -> null).when(consumer).accept(ArgumentMatchers.eq(\"foo\"));",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" doAnswer(inv -> null).when(consumer).accept(eq(toString()));",
|
||||
"",
|
||||
" BiConsumer<Integer, String> biConsumer = mock(BiConsumer.class);",
|
||||
" doAnswer(inv -> null).when(biConsumer).accept(0, \"foo\");",
|
||||
" doAnswer(inv -> null).when(biConsumer).accept(eq(0), notNull());",
|
||||
" doAnswer(inv -> null).when(biConsumer).accept(notNull(), eq(\"foo\"));",
|
||||
" doAnswer(inv -> null)",
|
||||
" .when(biConsumer)",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" .accept(ArgumentMatchers.eq(0), ArgumentMatchers.eq(\"foo\"));",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" doAnswer(inv -> null).when(biConsumer).accept(eq(hashCode()), eq(toString()));",
|
||||
" }",
|
||||
"}")
|
||||
.doTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
void replacement() {
|
||||
BugCheckerRefactoringTestHelper.newInstance(Assignment2DropMockitoEq.class, getClass())
|
||||
.addInputLines(
|
||||
"A.java",
|
||||
"import static org.mockito.ArgumentMatchers.eq;",
|
||||
"import static org.mockito.Mockito.doAnswer;",
|
||||
"import static org.mockito.Mockito.mock;",
|
||||
"",
|
||||
"import java.util.function.BiConsumer;",
|
||||
"import java.util.function.Consumer;",
|
||||
"import org.mockito.ArgumentMatchers;",
|
||||
"",
|
||||
"class A {",
|
||||
" void m() {",
|
||||
" Consumer<String> consumer = mock(Consumer.class);",
|
||||
" doAnswer(inv -> null).when(consumer).accept(ArgumentMatchers.eq(\"foo\"));",
|
||||
" doAnswer(inv -> null).when(consumer).accept(eq(toString()));",
|
||||
"",
|
||||
" BiConsumer<Integer, String> biConsumer = mock(BiConsumer.class);",
|
||||
" doAnswer(inv -> null)",
|
||||
" .when(biConsumer)",
|
||||
" .accept(ArgumentMatchers.eq(0), ArgumentMatchers.eq(\"foo\"));",
|
||||
" doAnswer(inv -> null).when(biConsumer).accept(eq(hashCode()), eq(toString()));",
|
||||
" }",
|
||||
"}")
|
||||
.addOutputLines(
|
||||
"A.java",
|
||||
"import static org.mockito.ArgumentMatchers.eq;",
|
||||
"import static org.mockito.Mockito.doAnswer;",
|
||||
"import static org.mockito.Mockito.mock;",
|
||||
"",
|
||||
"import java.util.function.BiConsumer;",
|
||||
"import java.util.function.Consumer;",
|
||||
"import org.mockito.ArgumentMatchers;",
|
||||
"",
|
||||
"class A {",
|
||||
" void m() {",
|
||||
" Consumer<String> consumer = mock(Consumer.class);",
|
||||
" doAnswer(inv -> null).when(consumer).accept(\"foo\");",
|
||||
" doAnswer(inv -> null).when(consumer).accept(toString());",
|
||||
"",
|
||||
" BiConsumer<Integer, String> biConsumer = mock(BiConsumer.class);",
|
||||
" doAnswer(inv -> null).when(biConsumer).accept(0, \"foo\");",
|
||||
" doAnswer(inv -> null).when(biConsumer).accept(hashCode(), toString());",
|
||||
" }",
|
||||
"}")
|
||||
.doTest(TestMode.TEXT_MATCH);
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.bugpatterns;
|
||||
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper;
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;
|
||||
import com.google.errorprone.CompilationTestHelper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
final class Assignment3DropAutowiredConstructorAnnotationTest {
|
||||
@Test
|
||||
void identification() {
|
||||
CompilationTestHelper.newInstance(
|
||||
Assignment3DropAutowiredConstructorAnnotation.class, getClass())
|
||||
.addSourceLines(
|
||||
"Container.java",
|
||||
"import com.google.errorprone.annotations.Immutable;",
|
||||
"import java.util.List;",
|
||||
"import org.springframework.beans.factory.annotation.Autowired;",
|
||||
"",
|
||||
"interface Container {",
|
||||
" @Immutable",
|
||||
" class A {",
|
||||
" A() {}",
|
||||
" }",
|
||||
"",
|
||||
" class B {",
|
||||
" @Autowired",
|
||||
" void setProperty(Object o) {}",
|
||||
" }",
|
||||
"",
|
||||
" class C {",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" @Autowired",
|
||||
" C() {}",
|
||||
" }",
|
||||
"",
|
||||
" class D {",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" @Autowired",
|
||||
" D(String x) {}",
|
||||
" }",
|
||||
"",
|
||||
" class E {",
|
||||
" @Autowired",
|
||||
" E() {}",
|
||||
"",
|
||||
" E(String x) {}",
|
||||
" }",
|
||||
"",
|
||||
" class F {",
|
||||
" F() {}",
|
||||
"",
|
||||
" @Autowired",
|
||||
" F(String x) {}",
|
||||
" }",
|
||||
"",
|
||||
" class G {",
|
||||
" @Autowired private Object o;",
|
||||
" }",
|
||||
"",
|
||||
" class H {",
|
||||
" @SafeVarargs",
|
||||
" H(List<String>... lists) {}",
|
||||
" }",
|
||||
"}")
|
||||
.doTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
void replacement() {
|
||||
BugCheckerRefactoringTestHelper.newInstance(
|
||||
Assignment3DropAutowiredConstructorAnnotation.class, getClass())
|
||||
.addInputLines(
|
||||
"Container.java",
|
||||
"import org.springframework.beans.factory.annotation.Autowired;",
|
||||
"",
|
||||
"interface Container {",
|
||||
" class A {",
|
||||
" @Autowired",
|
||||
" @Deprecated",
|
||||
" A() {}",
|
||||
" }",
|
||||
"",
|
||||
" class B {",
|
||||
" @Autowired",
|
||||
" B(String x) {}",
|
||||
" }",
|
||||
"}")
|
||||
.addOutputLines(
|
||||
"Container.java",
|
||||
"import org.springframework.beans.factory.annotation.Autowired;",
|
||||
"",
|
||||
"interface Container {",
|
||||
" class A {",
|
||||
" @Deprecated",
|
||||
" A() {}",
|
||||
" }",
|
||||
"",
|
||||
" class B {",
|
||||
" B(String x) {}",
|
||||
" }",
|
||||
"}")
|
||||
.doTest(TestMode.TEXT_MATCH);
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.bugpatterns;
|
||||
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper;
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;
|
||||
import com.google.errorprone.CompilationTestHelper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
final class Assignment4JUnitTestMethodDeclarationTest {
|
||||
@Test
|
||||
void identificationIllegalModifiers() {
|
||||
CompilationTestHelper.newInstance(Assignment4JUnitTestMethodDeclaration.class, getClass())
|
||||
.addSourceLines(
|
||||
"A.java",
|
||||
"import org.junit.jupiter.api.Test;",
|
||||
"",
|
||||
"class A {",
|
||||
" @Test",
|
||||
" void method1() {}",
|
||||
"",
|
||||
" @Test",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" public void method2() {}",
|
||||
"",
|
||||
" @Test",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" protected void method3() {}",
|
||||
"",
|
||||
" @Test",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" private void method4() {}",
|
||||
"",
|
||||
" public void method5() {}",
|
||||
"",
|
||||
" protected void method6() {}",
|
||||
"",
|
||||
" private void method7() {}",
|
||||
"}")
|
||||
.doTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
void replacementIllegalModifiers() {
|
||||
BugCheckerRefactoringTestHelper.newInstance(
|
||||
Assignment4JUnitTestMethodDeclaration.class, getClass())
|
||||
.addInputLines(
|
||||
"A.java",
|
||||
"import org.junit.jupiter.api.Test;",
|
||||
"",
|
||||
"class A {",
|
||||
" @Test",
|
||||
" void foo() {}",
|
||||
"",
|
||||
" @Test",
|
||||
" public void bar() {}",
|
||||
"",
|
||||
" @Test",
|
||||
" protected void baz() {}",
|
||||
"",
|
||||
" @Test",
|
||||
" private void qux() {}",
|
||||
"",
|
||||
" public void quux() {}",
|
||||
"",
|
||||
" private void quuz() {}",
|
||||
"}")
|
||||
.addOutputLines(
|
||||
"A.java",
|
||||
"import org.junit.jupiter.api.Test;",
|
||||
"",
|
||||
"class A {",
|
||||
" @Test",
|
||||
" void foo() {}",
|
||||
"",
|
||||
" @Test",
|
||||
" void bar() {}",
|
||||
"",
|
||||
" @Test",
|
||||
" void baz() {}",
|
||||
"",
|
||||
" @Test",
|
||||
" void qux() {}",
|
||||
"",
|
||||
" public void quux() {}",
|
||||
"",
|
||||
" private void quuz() {}",
|
||||
"}")
|
||||
.doTest(TestMode.TEXT_MATCH);
|
||||
}
|
||||
}
|
||||
@@ -1,221 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.bugpatterns;
|
||||
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper;
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;
|
||||
import com.google.errorprone.CompilationTestHelper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
final class Assignment5DeleteIdentityConversionTest {
|
||||
@Test
|
||||
void identification() {
|
||||
CompilationTestHelper.newInstance(Assignment5DeleteIdentityConversion.class, getClass())
|
||||
.addSourceLines(
|
||||
"A.java",
|
||||
"import static com.google.errorprone.matchers.Matchers.instanceMethod;",
|
||||
"import static com.google.errorprone.matchers.Matchers.staticMethod;",
|
||||
"",
|
||||
"import com.google.common.collect.ImmutableBiMap;",
|
||||
"import com.google.common.collect.ImmutableList;",
|
||||
"import com.google.common.collect.ImmutableListMultimap;",
|
||||
"import com.google.common.collect.ImmutableMap;",
|
||||
"import com.google.common.collect.ImmutableMultimap;",
|
||||
"import com.google.common.collect.ImmutableMultiset;",
|
||||
"import com.google.common.collect.ImmutableRangeMap;",
|
||||
"import com.google.common.collect.ImmutableRangeSet;",
|
||||
"import com.google.common.collect.ImmutableSet;",
|
||||
"import com.google.common.collect.ImmutableSetMultimap;",
|
||||
"import com.google.common.collect.ImmutableTable;",
|
||||
"import com.google.errorprone.matchers.Matcher;",
|
||||
"import com.google.errorprone.matchers.Matchers;",
|
||||
"",
|
||||
"public final class A {",
|
||||
" public void m() {",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" Matcher allOf1 = Matchers.allOf(instanceMethod());",
|
||||
" Matcher allOf2 = Matchers.allOf(instanceMethod(), staticMethod());",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" Matcher anyOf1 = Matchers.anyOf(staticMethod());",
|
||||
" Matcher anyOf2 = Matchers.anyOf(instanceMethod(), staticMethod());",
|
||||
"",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" Boolean b1 = Boolean.valueOf(Boolean.FALSE);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" Boolean b2 = Boolean.valueOf(false);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" boolean b3 = Boolean.valueOf(Boolean.FALSE);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" boolean b4 = Boolean.valueOf(false);",
|
||||
"",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" Byte byte1 = Byte.valueOf((Byte) Byte.MIN_VALUE);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" Byte byte2 = Byte.valueOf(Byte.MIN_VALUE);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" byte byte3 = Byte.valueOf((Byte) Byte.MIN_VALUE);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" byte byte4 = Byte.valueOf(Byte.MIN_VALUE);",
|
||||
"",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" Character c1 = Character.valueOf((Character) 'a');",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" Character c2 = Character.valueOf('a');",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" char c3 = Character.valueOf((Character) 'a');",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" char c4 = Character.valueOf('a');",
|
||||
"",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" Double d1 = Double.valueOf((Double) 0.0);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" Double d2 = Double.valueOf(0.0);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" double d3 = Double.valueOf((Double) 0.0);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" double d4 = Double.valueOf(0.0);",
|
||||
"",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" Float f1 = Float.valueOf((Float) 0.0F);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" Float f2 = Float.valueOf(0.0F);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" float f3 = Float.valueOf((Float) 0.0F);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" float f4 = Float.valueOf(0.0F);",
|
||||
"",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" Integer i1 = Integer.valueOf((Integer) 1);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" Integer i2 = Integer.valueOf(1);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" int i3 = Integer.valueOf((Integer) 1);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" int i4 = Integer.valueOf(1);",
|
||||
"",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" Long l1 = Long.valueOf((Long) 1L);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" Long l2 = Long.valueOf(1L);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" long l3 = Long.valueOf((Long) 1L);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" long l4 = Long.valueOf(1L);",
|
||||
"",
|
||||
" Long l5 = Long.valueOf((Integer) 1);",
|
||||
" Long l6 = Long.valueOf(1);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" long l7 = Long.valueOf((Integer) 1);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" long l8 = Long.valueOf(1);",
|
||||
"",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" Short s1 = Short.valueOf((Short) Short.MIN_VALUE);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" Short s2 = Short.valueOf(Short.MIN_VALUE);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" short s3 = Short.valueOf((Short) Short.MIN_VALUE);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" short s4 = Short.valueOf(Short.MIN_VALUE);",
|
||||
"",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" String boolStr = Boolean.valueOf(Boolean.FALSE).toString();",
|
||||
" int boolHash = Boolean.valueOf(false).hashCode();",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" int byteHash = Byte.valueOf((Byte) Byte.MIN_VALUE).hashCode();",
|
||||
" String byteStr = Byte.valueOf(Byte.MIN_VALUE).toString();",
|
||||
"",
|
||||
" String str1 = String.valueOf(0);",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" String str2 = String.valueOf(\"1\");",
|
||||
"",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" ImmutableBiMap<Object, Object> o1 = ImmutableBiMap.copyOf(ImmutableBiMap.of());",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" ImmutableList<Object> o2 = ImmutableList.copyOf(ImmutableList.of());",
|
||||
" ImmutableListMultimap<Object, Object> o3 =",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" ImmutableListMultimap.copyOf(ImmutableListMultimap.of());",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" ImmutableMap<Object, Object> o4 = ImmutableMap.copyOf(ImmutableMap.of());",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" ImmutableMultimap<Object, Object> o5 = ImmutableMultimap.copyOf(ImmutableMultimap.of());",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" ImmutableMultiset<Object> o6 = ImmutableMultiset.copyOf(ImmutableMultiset.of());",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" ImmutableRangeMap<String, Object> o7 = ImmutableRangeMap.copyOf(ImmutableRangeMap.of());",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" ImmutableRangeSet<String> o8 = ImmutableRangeSet.copyOf(ImmutableRangeSet.of());",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" ImmutableSet<Object> o9 = ImmutableSet.copyOf(ImmutableSet.of());",
|
||||
" ImmutableSetMultimap<Object, Object> o10 =",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" ImmutableSetMultimap.copyOf(ImmutableSetMultimap.of());",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" ImmutableTable<Object, Object, Object> o11 = ImmutableTable.copyOf(ImmutableTable.of());",
|
||||
" }",
|
||||
"}")
|
||||
.doTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
void replacement() {
|
||||
BugCheckerRefactoringTestHelper.newInstance(
|
||||
Assignment5DeleteIdentityConversion.class, getClass())
|
||||
.addInputLines(
|
||||
"A.java",
|
||||
"import static com.google.errorprone.matchers.Matchers.staticMethod;",
|
||||
"import static org.mockito.Mockito.when;",
|
||||
"",
|
||||
"import com.google.common.collect.ImmutableCollection;",
|
||||
"import com.google.common.collect.ImmutableList;",
|
||||
"import com.google.common.collect.ImmutableSet;",
|
||||
"import java.util.ArrayList;",
|
||||
"import java.util.Collection;",
|
||||
"",
|
||||
"public final class A {",
|
||||
" public void m() {",
|
||||
" ImmutableSet<Object> set1 = ImmutableSet.copyOf(ImmutableSet.of());",
|
||||
" ImmutableSet<Object> set2 = ImmutableSet.copyOf(ImmutableList.of());",
|
||||
"",
|
||||
" ImmutableCollection<Integer> list1 = ImmutableList.copyOf(ImmutableList.of(1));",
|
||||
" ImmutableCollection<Integer> list2 = ImmutableList.copyOf(new ArrayList<>(ImmutableList.of(1)));",
|
||||
"",
|
||||
" Collection<Integer> c1 = ImmutableSet.copyOf(ImmutableSet.of(1));",
|
||||
" Collection<Integer> c2 = ImmutableList.copyOf(new ArrayList<>(ImmutableList.of(1)));",
|
||||
"",
|
||||
" Object o1 = ImmutableSet.copyOf(ImmutableList.of());",
|
||||
" Object o2 = ImmutableSet.copyOf(ImmutableSet.of());",
|
||||
"",
|
||||
" when(\"foo\".contains(\"f\")).thenAnswer(inv -> ImmutableSet.copyOf(ImmutableList.of(1)));",
|
||||
" }",
|
||||
"}")
|
||||
.addOutputLines(
|
||||
"A.java",
|
||||
"import static com.google.errorprone.matchers.Matchers.staticMethod;",
|
||||
"import static org.mockito.Mockito.when;",
|
||||
"",
|
||||
"import com.google.common.collect.ImmutableCollection;",
|
||||
"import com.google.common.collect.ImmutableList;",
|
||||
"import com.google.common.collect.ImmutableSet;",
|
||||
"import java.util.ArrayList;",
|
||||
"import java.util.Collection;",
|
||||
"",
|
||||
"public final class A {",
|
||||
" public void m() {",
|
||||
" ImmutableSet<Object> set1 = ImmutableSet.of();",
|
||||
" ImmutableSet<Object> set2 = ImmutableSet.copyOf(ImmutableList.of());",
|
||||
"",
|
||||
" ImmutableCollection<Integer> list1 = ImmutableList.of(1);",
|
||||
" ImmutableCollection<Integer> list2 = ImmutableList.copyOf(new ArrayList<>(ImmutableList.of(1)));",
|
||||
"",
|
||||
" Collection<Integer> c1 = ImmutableSet.of(1);",
|
||||
" Collection<Integer> c2 = ImmutableList.copyOf(new ArrayList<>(ImmutableList.of(1)));",
|
||||
"",
|
||||
" Object o1 = ImmutableSet.copyOf(ImmutableList.of());",
|
||||
" Object o2 = ImmutableSet.of();",
|
||||
"",
|
||||
" when(\"foo\".contains(\"f\")).thenAnswer(inv -> ImmutableSet.copyOf(ImmutableList.of(1)));",
|
||||
" }",
|
||||
"}")
|
||||
.doTest(TestMode.TEXT_MATCH);
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.refasterrules;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import tech.picnic.errorprone.refaster.test.RefasterRuleCollection;
|
||||
|
||||
final class WorkshopRefasterRulesTest {
|
||||
@Test
|
||||
void validateExampleRuleCollection() {
|
||||
RefasterRuleCollection.validate(WorkshopAssignment0Rules.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void validateFirstWorkshopAssignment() {
|
||||
RefasterRuleCollection.validate(WorkshopAssignment1Rules.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void validateSecondWorkshopAssignment() {
|
||||
RefasterRuleCollection.validate(WorkshopAssignment2Rules.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void validateThirdWorkshopAssignment() {
|
||||
RefasterRuleCollection.validate(WorkshopAssignment3Rules.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void validateFourthWorkshopAssignment() {
|
||||
RefasterRuleCollection.validate(WorkshopAssignment4Rules.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void validateFifthWorkshopAssignment() {
|
||||
RefasterRuleCollection.validate(WorkshopAssignment5Rules.class);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.refasterrules;
|
||||
|
||||
import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
|
||||
|
||||
final class WorkshopAssignment0RulesTest implements RefasterRuleCollectionTestCase {
|
||||
boolean testExampleStringIsEmpty() {
|
||||
boolean b = "foo".length() == 0;
|
||||
return "bar".length() == 0;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.refasterrules;
|
||||
|
||||
import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
|
||||
|
||||
final class WorkshopAssignment0RulesTest implements RefasterRuleCollectionTestCase {
|
||||
boolean testExampleStringIsEmpty() {
|
||||
boolean b = "foo".isEmpty();
|
||||
return "bar".isEmpty();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.refasterrules;
|
||||
|
||||
import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
|
||||
|
||||
final class WorkshopAssignment1RulesTest implements RefasterRuleCollectionTestCase {
|
||||
String testNewStringCharArray() {
|
||||
String.copyValueOf(new char[] {});
|
||||
String.copyValueOf(new char[] {'f', 'o', 'o'});
|
||||
return String.copyValueOf(new char[] {'b', 'a', 'r'});
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.refasterrules;
|
||||
|
||||
import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
|
||||
|
||||
final class WorkshopAssignment1RulesTest implements RefasterRuleCollectionTestCase {
|
||||
String testNewStringCharArray() {
|
||||
new String(new char[] {});
|
||||
new String(new char[] {'f', 'o', 'o'});
|
||||
return new String(new char[] {'b', 'a', 'r'});
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.refasterrules;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
|
||||
|
||||
final class WorkshopAssignment2RulesTest implements RefasterRuleCollectionTestCase {
|
||||
@Override
|
||||
public ImmutableSet<Object> elidedTypesAndStaticImports() {
|
||||
return ImmutableSet.of(Collections.class);
|
||||
}
|
||||
|
||||
List<Object> testImmutableListOfOne() {
|
||||
Collections.singletonList(1);
|
||||
Collections.singletonList("foo");
|
||||
List.of(1);
|
||||
return List.of("bar");
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.refasterrules;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
|
||||
|
||||
final class WorkshopAssignment2RulesTest implements RefasterRuleCollectionTestCase {
|
||||
@Override
|
||||
public ImmutableSet<Object> elidedTypesAndStaticImports() {
|
||||
return ImmutableSet.of(Collections.class);
|
||||
}
|
||||
|
||||
List<Object> testImmutableListOfOne() {
|
||||
ImmutableList.of(1);
|
||||
ImmutableList.of("foo");
|
||||
ImmutableList.of(1);
|
||||
return ImmutableList.of("bar");
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.refasterrules;
|
||||
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
|
||||
|
||||
final class WorkshopAssignment3RulesTest implements RefasterRuleCollectionTestCase {
|
||||
void testCheckArgumentWithoutMessage() {
|
||||
if (!"foo".isEmpty()) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (!ThreadLocalRandom.current().nextBoolean()) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
|
||||
void testCheckArgumentWithMessage() {
|
||||
if (!"foo".isEmpty()) {
|
||||
throw new IllegalArgumentException("The string is not empty");
|
||||
}
|
||||
if (!ThreadLocalRandom.current().nextBoolean()) {
|
||||
throw new IllegalArgumentException(
|
||||
"The rule should be able rewrite all kinds of messages ;).");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.refasterrules;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
|
||||
|
||||
final class WorkshopAssignment3RulesTest implements RefasterRuleCollectionTestCase {
|
||||
void testCheckArgumentWithoutMessage() {
|
||||
checkArgument("foo".isEmpty());
|
||||
checkArgument(ThreadLocalRandom.current().nextBoolean());
|
||||
}
|
||||
|
||||
void testCheckArgumentWithMessage() {
|
||||
checkArgument("foo".isEmpty(), "The string is not empty");
|
||||
checkArgument(
|
||||
ThreadLocalRandom.current().nextBoolean(),
|
||||
"The rule should be able rewrite all kinds of messages ;).");
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.refasterrules;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Objects;
|
||||
import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
|
||||
|
||||
final class WorkshopAssignment4RulesTest implements RefasterRuleCollectionTestCase {
|
||||
@Override
|
||||
public ImmutableSet<Object> elidedTypesAndStaticImports() {
|
||||
return ImmutableSet.of(Objects.class);
|
||||
}
|
||||
|
||||
ImmutableSet<Boolean> testPrimitiveOrReferenceEqualityEnum() {
|
||||
// Don't pay attention to the `ImmutableSet#of` here, it's just syntactical sugar for the
|
||||
// testing framework.
|
||||
return ImmutableSet.of(
|
||||
"foo".equals("bar"),
|
||||
Integer.valueOf(1).equals(2),
|
||||
RoundingMode.UP.equals(RoundingMode.DOWN),
|
||||
Objects.equals(RoundingMode.UP, RoundingMode.DOWN),
|
||||
!RoundingMode.UP.equals(RoundingMode.DOWN),
|
||||
!Objects.equals(RoundingMode.UP, RoundingMode.DOWN));
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.refasterrules;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Objects;
|
||||
import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
|
||||
|
||||
final class WorkshopAssignment4RulesTest implements RefasterRuleCollectionTestCase {
|
||||
@Override
|
||||
public ImmutableSet<Object> elidedTypesAndStaticImports() {
|
||||
return ImmutableSet.of(Objects.class);
|
||||
}
|
||||
|
||||
ImmutableSet<Boolean> testPrimitiveOrReferenceEqualityEnum() {
|
||||
// Don't pay attention to the `ImmutableSet#of` here, it's just syntactical sugar for the
|
||||
// testing framework.
|
||||
return ImmutableSet.of(
|
||||
"foo".equals("bar"),
|
||||
Integer.valueOf(1).equals(2),
|
||||
RoundingMode.UP == RoundingMode.DOWN,
|
||||
RoundingMode.UP == RoundingMode.DOWN,
|
||||
RoundingMode.UP != RoundingMode.DOWN,
|
||||
RoundingMode.UP != RoundingMode.DOWN);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.refasterrules;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
|
||||
|
||||
final class WorkshopAssignment5RulesTest implements RefasterRuleCollectionTestCase {
|
||||
boolean testStreamDoAllMatch() {
|
||||
boolean example = Stream.of("foo").noneMatch(s -> !s.isBlank());
|
||||
return Stream.of("bar").noneMatch(b -> !b.startsWith("b"));
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package tech.picnic.errorprone.workshop.refasterrules;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
|
||||
|
||||
final class WorkshopAssignment5RulesTest implements RefasterRuleCollectionTestCase {
|
||||
boolean testStreamDoAllMatch() {
|
||||
boolean example = Stream.of("foo").allMatch(s -> s.isBlank());
|
||||
return Stream.of("bar").allMatch(b -> b.startsWith("b"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user