mirror of
https://github.com/jlengrand/error-prone-support.git
synced 2026-03-10 08:11:25 +00:00
Compare commits
28 Commits
sschroever
...
rossendrij
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ac65e9f53 | ||
|
|
f793c73bba | ||
|
|
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 |
4
.github/workflows/build.yml
vendored
4
.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@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
||||
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@9a27433d289dd99d73851f653607c39d3444e8ba # v1.17.0
|
||||
uses: s4u/setup-maven-action@382542f77617f34e56bf83868920a4d45b7451e7 # v1.16.0
|
||||
with:
|
||||
java-version: ${{ matrix.jdk }}
|
||||
java-distribution: ${{ matrix.distribution }}
|
||||
|
||||
8
.github/workflows/codeql.yml
vendored
8
.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@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
||||
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
|
||||
with:
|
||||
disable-sudo: true
|
||||
egress-policy: block
|
||||
@@ -34,19 +34,19 @@ 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@9a27433d289dd99d73851f653607c39d3444e8ba # v1.17.0
|
||||
uses: s4u/setup-maven-action@382542f77617f34e56bf83868920a4d45b7451e7 # v1.16.0
|
||||
with:
|
||||
java-version: 17.0.13
|
||||
java-distribution: temurin
|
||||
maven-version: 3.9.9
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
|
||||
uses: github/codeql-action/init@c7f9125735019aa87cfc361530512d50ea439c71 # v3.25.1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
- name: Perform minimal build
|
||||
if: matrix.language == 'java'
|
||||
run: mvn -T1C clean package -DskipTests -Dverification.skip
|
||||
- name: Perform CodeQL analysis
|
||||
uses: github/codeql-action/analyze@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
|
||||
uses: github/codeql-action/analyze@c7f9125735019aa87cfc361530512d50ea439c71 # v3.25.1
|
||||
with:
|
||||
category: /language:${{ matrix.language }}
|
||||
|
||||
6
.github/workflows/deploy-website.yml
vendored
6
.github/workflows/deploy-website.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Install Harden-Runner
|
||||
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
||||
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
|
||||
with:
|
||||
disable-sudo: true
|
||||
egress-policy: block
|
||||
@@ -42,7 +42,7 @@ jobs:
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: ruby/setup-ruby@a2bbe5b1b236842c1cb7dd11e8e3b51e0a616acc # v1.202.0
|
||||
- uses: ruby/setup-ruby@7d3497fd78c07c0d84ebafa58d8dac60cd1f0763 # v1.199.0
|
||||
with:
|
||||
working-directory: ./website
|
||||
bundler-cache: true
|
||||
@@ -74,7 +74,7 @@ jobs:
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
steps:
|
||||
- name: Install Harden-Runner
|
||||
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
||||
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
|
||||
with:
|
||||
disable-sudo: true
|
||||
egress-policy: block
|
||||
|
||||
4
.github/workflows/openssf-scorecard.yml
vendored
4
.github/workflows/openssf-scorecard.yml
vendored
@@ -21,7 +21,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Install Harden-Runner
|
||||
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
||||
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
|
||||
with:
|
||||
disable-sudo: true
|
||||
egress-policy: block
|
||||
@@ -48,6 +48,6 @@ jobs:
|
||||
results_format: sarif
|
||||
publish_results: ${{ github.ref == 'refs/heads/master' }}
|
||||
- name: Update GitHub's code scanning dashboard
|
||||
uses: github/codeql-action/upload-sarif@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
|
||||
uses: github/codeql-action/upload-sarif@c7f9125735019aa87cfc361530512d50ea439c71 # v3.25.1
|
||||
with:
|
||||
sarif_file: results.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@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
||||
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@9a27433d289dd99d73851f653607c39d3444e8ba # v1.17.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@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
|
||||
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@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
||||
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@9a27433d289dd99d73851f653607c39d3444e8ba # v1.17.0
|
||||
uses: s4u/setup-maven-action@382542f77617f34e56bf83868920a4d45b7451e7 # v1.16.0
|
||||
with:
|
||||
java-version: 17.0.13
|
||||
java-distribution: temurin
|
||||
|
||||
30
.github/workflows/run-integration-tests.yml
vendored
30
.github/workflows/run-integration-tests.yml
vendored
@@ -1,50 +1,46 @@
|
||||
# If requested by means of a pull request comment, runs integration tests
|
||||
# against the project, using the code found on the pull request branch.
|
||||
# XXX: Review whether then build matrix should also vary JDK or OS versions.
|
||||
# XXX: Support `/integration-test [name...]` comment syntax to specify the
|
||||
# subset of integration tests to run.
|
||||
# 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.
|
||||
# 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: [ "checkstyle", "metrics", "prometheus-java-client" ]
|
||||
integration-test: [ "metrics", "checkstyle" ]
|
||||
name: On-demand integration test
|
||||
steps:
|
||||
- name: Install Harden-Runner
|
||||
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
||||
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
|
||||
with:
|
||||
disable-sudo: true
|
||||
egress-policy: block
|
||||
allowed-endpoints: >
|
||||
# XXX: After updating the validation build flags in
|
||||
# `integration-tests/prometheus-java-client.sh`, review whether the
|
||||
# Docker domains specified here can be dropped.
|
||||
api.adoptium.net:443
|
||||
auth.docker.io:443
|
||||
checkstyle.org:443
|
||||
example.com:80
|
||||
github.com:443
|
||||
objects.githubusercontent.com:443
|
||||
oss.sonatype.org:443
|
||||
production.cloudflare.docker.com:443
|
||||
raw.githubusercontent.com:443
|
||||
registry-1.docker.io:443
|
||||
repo.maven.apache.org:443
|
||||
repository.sonatype.org:443
|
||||
- name: Check out code and set up JDK and Maven
|
||||
uses: s4u/setup-maven-action@9a27433d289dd99d73851f653607c39d3444e8ba # v1.17.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
|
||||
@@ -55,7 +51,7 @@ jobs:
|
||||
run: xvfb-run "./integration-tests/${{ matrix.integration-test }}.sh" "${{ runner.temp }}/artifacts"
|
||||
- name: Upload artifacts on failure
|
||||
if: ${{ failure() }}
|
||||
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
|
||||
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
|
||||
with:
|
||||
name: "integration-test-${{ matrix.integration-test }}"
|
||||
path: "${{ runner.temp }}/artifacts"
|
||||
|
||||
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@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
||||
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@9a27433d289dd99d73851f653607c39d3444e8ba # v1.17.0
|
||||
uses: s4u/setup-maven-action@382542f77617f34e56bf83868920a4d45b7451e7 # v1.16.0
|
||||
with:
|
||||
checkout-fetch-depth: 0
|
||||
java-version: 17.0.13
|
||||
|
||||
@@ -3,24 +3,11 @@
|
||||
"extends": [
|
||||
"helpers:pinGitHubActionDigests"
|
||||
],
|
||||
"customManagers": [
|
||||
{
|
||||
"customType": "regex",
|
||||
"fileMatch": [
|
||||
"^integration-tests/.*(-init\\.patch|\\.sh)$"
|
||||
],
|
||||
"matchStrings": [
|
||||
"\\b(?<packageName>[a-z0-9_.-]+?:[a-z0-9_.-]+?):(?<currentValue>[^:]+?):[a-zA-Z0-9_-]+\\b",
|
||||
"<version>(?<currentValue>.*?)<!-- Renovate: (?<packageName>.*?) --></version>"
|
||||
],
|
||||
"datasourceTemplate": "maven"
|
||||
}
|
||||
],
|
||||
"packageRules": [
|
||||
{
|
||||
"matchPackageNames": [
|
||||
"/^org\\.springframework:spring-framework-bom$/",
|
||||
"/^org\\.springframework\\.boot:spring-boot[a-z-]*$/"
|
||||
"matchPackagePatterns": [
|
||||
"^org\\.springframework:spring-framework-bom$",
|
||||
"^org\\.springframework\\.boot:spring-boot[a-z-]*$"
|
||||
],
|
||||
"separateMinorPatch": true
|
||||
},
|
||||
|
||||
@@ -217,7 +217,7 @@ Other highly relevant commands:
|
||||
- `mvn fmt:format` formats the code using
|
||||
[`google-java-format`][google-java-format].
|
||||
- [`./run-full-build.sh`][script-run-full-build] builds the project twice,
|
||||
where the second pass validates compatibility with Picnic's [Error Prone
|
||||
where the second pass validates compatbility with Picnic's [Error Prone
|
||||
fork][error-prone-fork-repo] and compliance of the code with any rules
|
||||
defined within this project. (Consider running this before [opening a pull
|
||||
request][contributing-pull-request], as the PR checks also perform this
|
||||
|
||||
@@ -167,11 +167,6 @@
|
||||
<artifactId>value-annotations</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jooq</groupId>
|
||||
<artifactId>jooq</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jspecify</groupId>
|
||||
<artifactId>jspecify</artifactId>
|
||||
|
||||
@@ -18,7 +18,6 @@ import com.sun.source.tree.LambdaExpressionTree;
|
||||
import com.sun.source.tree.TypeCastTree;
|
||||
import com.sun.source.tree.VariableTree;
|
||||
import com.sun.tools.javac.code.Type;
|
||||
import javax.lang.model.type.TypeKind;
|
||||
import tech.picnic.errorprone.utils.SourceCode;
|
||||
|
||||
/**
|
||||
@@ -49,14 +48,11 @@ public final class ClassCastLambdaUsage extends BugChecker implements LambdaExpr
|
||||
}
|
||||
|
||||
Type type = ASTHelpers.getType(typeCast);
|
||||
if (type == null
|
||||
|| type.isParameterized()
|
||||
|| type.isPrimitive()
|
||||
|| type.getKind() == TypeKind.TYPEVAR) {
|
||||
if (type == null || type.isParameterized() || type.isPrimitive()) {
|
||||
/*
|
||||
* The method reference syntax does not support casting to parameterized types, and type
|
||||
* variables aren't supported either. Additionally, `Class#cast` does not support the same
|
||||
* range of type conversions between (boxed) primitive types as the cast operator.
|
||||
* The method reference syntax does not support casting to parameterized types. Additionally,
|
||||
* `Class#cast` does not support the same range of type conversions between (boxed) primitive
|
||||
* types as the cast operator.
|
||||
*/
|
||||
// XXX: Depending on the declared type of the value being cast, in some cases we _can_ rewrite
|
||||
// primitive casts. Add support for this.
|
||||
|
||||
@@ -1,233 +0,0 @@
|
||||
package tech.picnic.errorprone.bugpatterns;
|
||||
|
||||
import static com.google.common.collect.ImmutableList.toImmutableList;
|
||||
import static com.google.errorprone.BugPattern.LinkType.CUSTOM;
|
||||
import static com.google.errorprone.BugPattern.SeverityLevel.SUGGESTION;
|
||||
import static com.google.errorprone.BugPattern.StandardTags.PERFORMANCE;
|
||||
import static com.google.errorprone.BugPattern.StandardTags.SIMPLIFICATION;
|
||||
import static com.google.errorprone.matchers.Matchers.allOf;
|
||||
import static com.google.errorprone.matchers.Matchers.anyOf;
|
||||
import static com.google.errorprone.matchers.Matchers.instanceMethod;
|
||||
import static com.google.errorprone.matchers.Matchers.staticMethod;
|
||||
import static com.google.errorprone.matchers.Matchers.symbolMatcher;
|
||||
import static tech.picnic.errorprone.utils.Documentation.BUG_PATTERNS_BASE_URL;
|
||||
|
||||
import com.google.auto.service.AutoService;
|
||||
import com.google.common.collect.ImmutableCollection;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMultiset;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableTable;
|
||||
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.google.errorprone.util.ASTHelpers;
|
||||
import com.google.errorprone.util.Visibility;
|
||||
import com.sun.source.tree.ExpressionTree;
|
||||
import com.sun.source.tree.MethodInvocationTree;
|
||||
import com.sun.source.tree.MethodTree;
|
||||
import com.sun.tools.javac.code.Symbol.MethodSymbol;
|
||||
import com.sun.tools.javac.code.Symbol.VarSymbol;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import javax.lang.model.element.Element;
|
||||
import tech.picnic.errorprone.utils.SourceCode;
|
||||
|
||||
/**
|
||||
* A {@link BugChecker} that flags single-argument method invocations with an iterable of explicitly
|
||||
* enumerated values, for which a semantically equivalent varargs variant (appears to) exists as
|
||||
* well.
|
||||
*
|
||||
* <p>This check drops selected {@link ImmutableSet#of} and {@link Set#of} invocations, with the
|
||||
* assumption that these operations do not deduplicate the collection of explicitly enumerated
|
||||
* values. It also drops {@link ImmutableMultiset#of} and {@link Set#of} invocations, with the
|
||||
* assumption that these do not materially impact iteration order.
|
||||
*
|
||||
* <p>This checker attempts to identify {@link Iterable}-accepting methods for which a varargs
|
||||
* overload exists, and suggests calling the varargs overload instead. This is an imperfect
|
||||
* heuristic, but it e.g. allows invocations of <a
|
||||
* href="https://immutables.github.io/immutable.html#copy-methods">Immutables-generated {@code
|
||||
* with*}</a> methods to be simplified.
|
||||
*/
|
||||
@AutoService(BugChecker.class)
|
||||
@BugPattern(
|
||||
summary = "Iterable creation can be avoided by using a varargs alternative method",
|
||||
link = BUG_PATTERNS_BASE_URL + "ExplicitArgumentEnumeration",
|
||||
linkType = CUSTOM,
|
||||
severity = SUGGESTION,
|
||||
tags = {PERFORMANCE, SIMPLIFICATION})
|
||||
public final class ExplicitArgumentEnumeration extends BugChecker
|
||||
implements MethodInvocationTreeMatcher {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Matcher<ExpressionTree> EXPLICIT_ITERABLE_CREATOR =
|
||||
anyOf(
|
||||
staticMethod()
|
||||
.onClassAny(
|
||||
ImmutableList.class.getCanonicalName(),
|
||||
ImmutableMultiset.class.getCanonicalName(),
|
||||
ImmutableSet.class.getCanonicalName(),
|
||||
List.class.getCanonicalName(),
|
||||
Set.class.getCanonicalName())
|
||||
.named("of"),
|
||||
allOf(
|
||||
staticMethod()
|
||||
.onClassAny(
|
||||
ImmutableList.class.getCanonicalName(),
|
||||
ImmutableMultiset.class.getCanonicalName(),
|
||||
ImmutableSet.class.getCanonicalName())
|
||||
.named("copyOf"),
|
||||
symbolMatcher(
|
||||
(symbol, state) ->
|
||||
state
|
||||
.getSymtab()
|
||||
.arrayClass
|
||||
.equals(((MethodSymbol) symbol).params().get(0).type.tsym))),
|
||||
staticMethod().onClass(Arrays.class.getCanonicalName()).named("asList"));
|
||||
private static final Matcher<ExpressionTree> IMMUTABLE_COLLECTION_BUILDER =
|
||||
instanceMethod().onDescendantOf(ImmutableCollection.Builder.class.getCanonicalName());
|
||||
private static final Matcher<ExpressionTree> OBJECT_ENUMERABLE_ASSERT =
|
||||
instanceMethod().onDescendantOf("org.assertj.core.api.ObjectEnumerableAssert");
|
||||
private static final Matcher<ExpressionTree> STEP_VERIFIER_STEP =
|
||||
instanceMethod().onDescendantOf("reactor.test.StepVerifier.Step");
|
||||
private static final ImmutableTable<Matcher<ExpressionTree>, String, String> ALTERNATIVE_METHODS =
|
||||
ImmutableTable.<Matcher<ExpressionTree>, String, String>builder()
|
||||
.put(IMMUTABLE_COLLECTION_BUILDER, "addAll", "add")
|
||||
.put(OBJECT_ENUMERABLE_ASSERT, "containsAnyElementsOf", "containsAnyOf")
|
||||
.put(OBJECT_ENUMERABLE_ASSERT, "containsAll", "contains")
|
||||
.put(OBJECT_ENUMERABLE_ASSERT, "containsExactlyElementsOf", "containsExactly")
|
||||
.put(
|
||||
OBJECT_ENUMERABLE_ASSERT,
|
||||
"containsExactlyInAnyOrderElementsOf",
|
||||
"containsExactlyInAnyOrder")
|
||||
.put(OBJECT_ENUMERABLE_ASSERT, "containsOnlyElementsOf", "containsOnly")
|
||||
.put(OBJECT_ENUMERABLE_ASSERT, "containsOnlyOnceElementsOf", "containsOnlyOnce")
|
||||
.put(OBJECT_ENUMERABLE_ASSERT, "doesNotContainAnyElementsOf", "doesNotContain")
|
||||
.put(OBJECT_ENUMERABLE_ASSERT, "hasSameElementsAs", "containsOnly")
|
||||
.put(STEP_VERIFIER_STEP, "expectNextSequence", "expectNext")
|
||||
.build();
|
||||
|
||||
/** Instantiates a new {@link ExplicitArgumentEnumeration} instance. */
|
||||
public ExplicitArgumentEnumeration() {}
|
||||
|
||||
@Override
|
||||
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) {
|
||||
if (tree.getArguments().size() != 1) {
|
||||
/* Performance optimization: non-unary method invocations cannot be simplified. */
|
||||
return Description.NO_MATCH;
|
||||
}
|
||||
|
||||
MethodSymbol method = ASTHelpers.getSymbol(tree);
|
||||
if (!isUnaryIterableAcceptingMethod(method, state) || isLocalOverload(method, state)) {
|
||||
/*
|
||||
* This isn't a method invocation we can simplify, or it's an invocation of a local overload.
|
||||
* The latter type of invocation we do not suggest replacing, as this is fairly likely to
|
||||
* introduce an unbounded recursive call chain.
|
||||
*/
|
||||
return Description.NO_MATCH;
|
||||
}
|
||||
|
||||
ExpressionTree argument = tree.getArguments().get(0);
|
||||
if (!EXPLICIT_ITERABLE_CREATOR.matches(argument, state)) {
|
||||
return Description.NO_MATCH;
|
||||
}
|
||||
|
||||
return trySuggestCallingVarargsOverload(method, (MethodInvocationTree) argument, state)
|
||||
.or(() -> trySuggestCallingCustomAlternative(tree, (MethodInvocationTree) argument, state))
|
||||
.map(fix -> describeMatch(tree, fix))
|
||||
.orElse(Description.NO_MATCH);
|
||||
}
|
||||
|
||||
private static boolean isUnaryIterableAcceptingMethod(MethodSymbol method, VisitorState state) {
|
||||
List<VarSymbol> params = method.params();
|
||||
return !method.isVarArgs()
|
||||
&& params.size() == 1
|
||||
&& ASTHelpers.isSubtype(params.get(0).type, state.getSymtab().iterableType, state);
|
||||
}
|
||||
|
||||
private static boolean isLocalOverload(MethodSymbol calledMethod, VisitorState state) {
|
||||
MethodTree enclosingMethod = state.findEnclosing(MethodTree.class);
|
||||
if (enclosingMethod == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MethodSymbol callingMethod = ASTHelpers.getSymbol(enclosingMethod);
|
||||
return Objects.equals(callingMethod.getEnclosingElement(), calledMethod.getEnclosingElement())
|
||||
&& callingMethod.getSimpleName().equals(calledMethod.getSimpleName());
|
||||
}
|
||||
|
||||
private static Optional<SuggestedFix> trySuggestCallingVarargsOverload(
|
||||
MethodSymbol method, MethodInvocationTree argument, VisitorState state) {
|
||||
/*
|
||||
* Collect all overloads of the given method that we are sure to be able to call. Note that the
|
||||
* `isAtLeastAsVisible` check is conservative heuristic.
|
||||
*/
|
||||
ImmutableList<MethodSymbol> overloads =
|
||||
ASTHelpers.matchingMethods(
|
||||
method.getSimpleName(),
|
||||
m -> isAtLeastAsVisible(m, method),
|
||||
method.enclClass().type,
|
||||
state.getTypes())
|
||||
.collect(toImmutableList());
|
||||
|
||||
/*
|
||||
* If all overloads have a single parameter, and at least one of them is a varargs method, then
|
||||
* we assume that unwrapping the iterable argument will cause a suitable overload to be invoked.
|
||||
* (Note that there may be multiple varargs overloads, either with different parameter types, or
|
||||
* due to method overriding; this check does not attempt to determine which exact method or
|
||||
* overload will be invoked as a result of the suggested simplification.)
|
||||
*
|
||||
* Note that this is a (highly!) imperfect heuristic, but it is sufficient to prevent e.g.
|
||||
* unwrapping of arguments to `org.jooq.impl.DSL#row`, which can cause the expression's return
|
||||
* type to change from `RowN` to (e.g.) `Row2`.
|
||||
*/
|
||||
// XXX: There are certainly cases where it _would_ be nice to unwrap the arguments to
|
||||
// `org.jooq.impl.DSL#row(Collection<?>)`. Look into this.
|
||||
// XXX: Ideally we do check that one of the overloads accepts the unwrapped arguments.
|
||||
// XXX: Ideally we validate that eligible overloads have compatible return types.
|
||||
boolean hasLikelySuitableVarargsOverload =
|
||||
overloads.stream().allMatch(m -> m.params().size() == 1)
|
||||
&& overloads.stream().anyMatch(MethodSymbol::isVarArgs);
|
||||
|
||||
return hasLikelySuitableVarargsOverload
|
||||
? Optional.of(SourceCode.unwrapMethodInvocation(argument, state))
|
||||
: Optional.empty();
|
||||
}
|
||||
|
||||
private static Optional<SuggestedFix> trySuggestCallingCustomAlternative(
|
||||
MethodInvocationTree tree, MethodInvocationTree argument, VisitorState state) {
|
||||
return ALTERNATIVE_METHODS.rowMap().entrySet().stream()
|
||||
.filter(e -> e.getKey().matches(tree, state))
|
||||
.findFirst()
|
||||
.flatMap(e -> trySuggestCallingCustomAlternative(tree, argument, state, e.getValue()));
|
||||
}
|
||||
|
||||
private static Optional<SuggestedFix> trySuggestCallingCustomAlternative(
|
||||
MethodInvocationTree tree,
|
||||
MethodInvocationTree argument,
|
||||
VisitorState state,
|
||||
Map<String, String> alternatives) {
|
||||
return Optional.ofNullable(
|
||||
alternatives.get(ASTHelpers.getSymbol(tree).getSimpleName().toString()))
|
||||
.map(
|
||||
replacement ->
|
||||
SuggestedFix.builder()
|
||||
.merge(SuggestedFixes.renameMethodInvocation(tree, replacement, state))
|
||||
.merge(SourceCode.unwrapMethodInvocation(argument, state))
|
||||
.build());
|
||||
}
|
||||
|
||||
private static boolean isAtLeastAsVisible(Element symbol, Element reference) {
|
||||
return Visibility.fromModifiers(symbol.getModifiers())
|
||||
.compareTo(Visibility.fromModifiers(reference.getModifiers()))
|
||||
>= 0;
|
||||
}
|
||||
}
|
||||
@@ -101,8 +101,6 @@ public final class JUnitMethodDeclaration extends BugChecker implements MethodTr
|
||||
.build());
|
||||
}
|
||||
|
||||
// XXX: Consider dropping leading underscores that otherwise result when canonicalizing
|
||||
// `test_some_method_name`.
|
||||
private static Optional<String> tryCanonicalizeMethodName(MethodSymbol symbol) {
|
||||
return Optional.of(symbol.getQualifiedName().toString())
|
||||
.filter(name -> name.startsWith(TEST_PREFIX))
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
package tech.picnic.errorprone.bugpatterns;
|
||||
|
||||
import static com.google.errorprone.BugPattern.LinkType.CUSTOM;
|
||||
import static com.google.errorprone.BugPattern.SeverityLevel.SUGGESTION;
|
||||
import static com.google.errorprone.BugPattern.StandardTags.SIMPLIFICATION;
|
||||
import static tech.picnic.errorprone.utils.Documentation.BUG_PATTERNS_BASE_URL;
|
||||
|
||||
import com.google.auto.service.AutoService;
|
||||
import com.google.errorprone.BugPattern;
|
||||
import com.google.errorprone.VisitorState;
|
||||
import com.google.errorprone.bugpatterns.BugChecker;
|
||||
import com.google.errorprone.bugpatterns.BugChecker.LiteralTreeMatcher;
|
||||
import com.google.errorprone.fixes.SuggestedFix;
|
||||
import com.google.errorprone.matchers.Description;
|
||||
import com.google.errorprone.util.ASTHelpers;
|
||||
import com.sun.source.tree.LiteralTree;
|
||||
import tech.picnic.errorprone.utils.SourceCode;
|
||||
|
||||
/** A {@link BugChecker} that flags string constants with extraneous escaping. */
|
||||
// XXX: Also cover `\"` sequences inside text blocks. Note that this requires a more subtle
|
||||
// approach, as double-quote characters will need to remain escaped if removing the backslash would
|
||||
// create a new sequence of three or more double-quotes. (TBD whether we'd like to enforce a
|
||||
// "preferred" approach to escaping, e.g. by always escaping the last of a triplet, such that the
|
||||
// over-all number of escaped characters is minimized.)
|
||||
// XXX: Also flag `'\"'` char literals.
|
||||
@AutoService(BugChecker.class)
|
||||
@BugPattern(
|
||||
summary = "Inside string expressions single quotes do not need to be escaped",
|
||||
link = BUG_PATTERNS_BASE_URL + "RedundantStringEscape",
|
||||
linkType = CUSTOM,
|
||||
severity = SUGGESTION,
|
||||
tags = SIMPLIFICATION)
|
||||
public final class RedundantStringEscape extends BugChecker implements LiteralTreeMatcher {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** Instantiates a new {@link RedundantStringEscape} instance. */
|
||||
public RedundantStringEscape() {}
|
||||
|
||||
@Override
|
||||
public Description matchLiteral(LiteralTree tree, VisitorState state) {
|
||||
String constant = ASTHelpers.constValue(tree, String.class);
|
||||
if (constant == null || constant.indexOf('\'') < 0) {
|
||||
/* Fast path: this isn't a string constant with a single quote. */
|
||||
return Description.NO_MATCH;
|
||||
}
|
||||
|
||||
String source = SourceCode.treeToString(tree, state);
|
||||
if (!containsBannedEscapeSequence(source)) {
|
||||
/* Semi-fast path: this expression doesn't contain an escaped single quote. */
|
||||
return Description.NO_MATCH;
|
||||
}
|
||||
|
||||
/* Slow path: suggest dropping the escape characters. */
|
||||
return describeMatch(tree, SuggestedFix.replace(tree, dropRedundantEscapeSequences(source)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells whether the given string constant source expression contains an escaped single quote.
|
||||
*
|
||||
* @implNote As the input is a literal Java string expression, it will start and end with a double
|
||||
* quote; as such any found backslash will not be the string's final character.
|
||||
*/
|
||||
private static boolean containsBannedEscapeSequence(String source) {
|
||||
for (int p = source.indexOf('\\'); p != -1; p = source.indexOf('\\', p + 2)) {
|
||||
if (source.charAt(p + 1) == '\'') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simplifies the given string constant source expression by dropping the backslash preceding an
|
||||
* escaped single quote.
|
||||
*
|
||||
* @implNote Note that this method does not delegate to {@link
|
||||
* SourceCode#toStringConstantExpression}, as that operation may replace other Unicode
|
||||
* characters with their associated escape sequence.
|
||||
* @implNote As the input is a literal Java string expression, it will start and end with a double
|
||||
* quote; as such any found backslash will not be the string's final character.
|
||||
*/
|
||||
private static String dropRedundantEscapeSequences(String source) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
||||
for (int p = 0; p < source.length(); p++) {
|
||||
char c = source.charAt(p);
|
||||
if (c != '\\' || source.charAt(p + 1) != '\'') {
|
||||
result.append(c);
|
||||
}
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ import tech.picnic.errorprone.utils.SourceCode;
|
||||
tags = LIKELY_ERROR)
|
||||
public final class Slf4jLogStatement extends BugChecker implements MethodInvocationTreeMatcher {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Matcher<ExpressionTree> SLF4J_MARKER = isSubtypeOf("org.slf4j.Marker");
|
||||
private static final Matcher<ExpressionTree> MARKER = isSubtypeOf("org.slf4j.Marker");
|
||||
private static final Matcher<ExpressionTree> THROWABLE = isSubtypeOf(Throwable.class);
|
||||
private static final Matcher<ExpressionTree> SLF4J_LOGGER_INVOCATION =
|
||||
instanceMethod()
|
||||
@@ -71,7 +71,7 @@ public final class Slf4jLogStatement extends BugChecker implements MethodInvocat
|
||||
* SLF4J log statements may accept a "marker" as a first argument, before the format string.
|
||||
* We ignore such markers.
|
||||
*/
|
||||
int lTrim = SLF4J_MARKER.matches(args.get(0), state) ? 1 : 0;
|
||||
int lTrim = MARKER.matches(args.get(0), state) ? 1 : 0;
|
||||
/*
|
||||
* SLF4J treats the final argument to a log statement specially if it is a `Throwabe`: it
|
||||
* will always choose to render the associated stacktrace, even if the argument has a
|
||||
|
||||
@@ -53,7 +53,7 @@ public final class Slf4jLoggerDeclaration extends BugChecker implements Variable
|
||||
private static final Matcher<ExpressionTree> IS_GET_LOGGER =
|
||||
staticMethod().onDescendantOf("org.slf4j.LoggerFactory").named("getLogger");
|
||||
private static final String CANONICAL_STATIC_LOGGER_NAME_FLAG =
|
||||
"Slf4jLoggerDeclaration:CanonicalStaticLoggerName";
|
||||
"Slf4jLogDeclaration:CanonicalStaticLoggerName";
|
||||
private static final String DEFAULT_CANONICAL_LOGGER_NAME = "LOG";
|
||||
private static final Matcher<ExpressionTree> IS_STATIC_ENCLOSING_CLASS_REFERENCE =
|
||||
classLiteral(Slf4jLoggerDeclaration::isEnclosingClassReference);
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.google.errorprone.util.ASTHelpers;
|
||||
import com.sun.source.tree.ExpressionTree;
|
||||
import com.sun.source.tree.MethodInvocationTree;
|
||||
import com.sun.tools.javac.code.Type;
|
||||
import com.sun.tools.javac.util.Constants;
|
||||
import java.util.Formattable;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -36,9 +37,7 @@ import tech.picnic.errorprone.utils.SourceCode;
|
||||
*/
|
||||
// XXX: What about `v1 + "sep" + v2` and similar expressions? Do we want to rewrite those to
|
||||
// `String.join`, or should some `String.join` invocations be rewritten to use the `+` operator?
|
||||
// (The latter suggestion would conflict with the `FormatStringConcatenation` check, but does make
|
||||
// more sense when `"sep"` is a long string. Similarly for `String.format("%s some long text %s",
|
||||
// arg1, arg2)`.)
|
||||
// (The latter suggestion would conflict with the `FormatStringConcatenation` check.)
|
||||
@AutoService(BugChecker.class)
|
||||
@BugPattern(
|
||||
summary = "Prefer `String#join` over `String#format`",
|
||||
@@ -151,7 +150,7 @@ public final class StringJoin extends BugChecker implements MethodInvocationTree
|
||||
SuggestedFix.Builder fix =
|
||||
SuggestedFix.builder()
|
||||
.replace(tree.getMethodSelect(), "String.join")
|
||||
.replace(arguments.next(), SourceCode.toStringConstantExpression(separator, state));
|
||||
.replace(arguments.next(), Constants.format(separator));
|
||||
|
||||
while (arguments.hasNext()) {
|
||||
ExpressionTree argument = arguments.next();
|
||||
|
||||
@@ -3,6 +3,9 @@ package tech.picnic.errorprone.refasterrules;
|
||||
import static com.google.errorprone.refaster.ImportPolicy.STATIC_IMPORT_ALWAYS;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMultiset;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Multiset;
|
||||
import com.google.errorprone.refaster.Refaster;
|
||||
@@ -12,6 +15,7 @@ import com.google.errorprone.refaster.annotation.Matches;
|
||||
import com.google.errorprone.refaster.annotation.NotMatches;
|
||||
import com.google.errorprone.refaster.annotation.Repeated;
|
||||
import com.google.errorprone.refaster.annotation.UseImportPolicy;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -200,8 +204,32 @@ final class AssertJRules {
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T element) {
|
||||
return Refaster.anyOf(
|
||||
iterAssert.containsAnyElementsOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(element),
|
||||
Arrays.asList(element),
|
||||
ImmutableSet.of(element),
|
||||
ImmutableMultiset.of(element))),
|
||||
iterAssert.containsAnyOf(element),
|
||||
iterAssert.containsAll(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(element),
|
||||
Arrays.asList(element),
|
||||
ImmutableSet.of(element),
|
||||
ImmutableMultiset.of(element))),
|
||||
iterAssert.containsSequence(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(element),
|
||||
Arrays.asList(element),
|
||||
ImmutableSet.of(element),
|
||||
ImmutableMultiset.of(element))),
|
||||
iterAssert.containsSequence(element),
|
||||
iterAssert.containsSubsequence(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(element),
|
||||
Arrays.asList(element),
|
||||
ImmutableSet.of(element),
|
||||
ImmutableMultiset.of(element))),
|
||||
iterAssert.containsSubsequence(element));
|
||||
}
|
||||
|
||||
@@ -216,7 +244,20 @@ final class AssertJRules {
|
||||
@BeforeTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T element) {
|
||||
return iterAssert.doesNotContainSequence(element);
|
||||
return Refaster.anyOf(
|
||||
iterAssert.doesNotContainAnyElementsOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(element),
|
||||
Arrays.asList(element),
|
||||
ImmutableSet.of(element),
|
||||
ImmutableMultiset.of(element))),
|
||||
iterAssert.doesNotContainSequence(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(element),
|
||||
Arrays.asList(element),
|
||||
ImmutableSet.of(element),
|
||||
ImmutableMultiset.of(element))),
|
||||
iterAssert.doesNotContainSequence(element));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@@ -229,7 +270,25 @@ final class AssertJRules {
|
||||
static final class ObjectEnumerableContainsExactlyOneElement<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> before(
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T element) {
|
||||
return Refaster.anyOf(
|
||||
iterAssert.containsExactlyElementsOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(element),
|
||||
Arrays.asList(element),
|
||||
ImmutableSet.of(element),
|
||||
ImmutableMultiset.of(element))),
|
||||
iterAssert.containsExactlyInAnyOrderElementsOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(element),
|
||||
Arrays.asList(element),
|
||||
ImmutableSet.of(element),
|
||||
ImmutableMultiset.of(element))));
|
||||
}
|
||||
|
||||
@BeforeTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> before2(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, @NotMatches(IsArray.class) T element) {
|
||||
return iterAssert.containsExactlyInAnyOrder(element);
|
||||
}
|
||||
@@ -254,6 +313,42 @@ final class AssertJRules {
|
||||
}
|
||||
}
|
||||
|
||||
static final class ObjectEnumerableContainsOneDistinctElement<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T element) {
|
||||
return iterAssert.hasSameElementsAs(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(element),
|
||||
Arrays.asList(element),
|
||||
ImmutableSet.of(element),
|
||||
ImmutableMultiset.of(element)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T element) {
|
||||
return iterAssert.containsOnly(element);
|
||||
}
|
||||
}
|
||||
|
||||
static final class ObjectEnumerableIsSubsetOfOneElement<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T element) {
|
||||
return iterAssert.isSubsetOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(element),
|
||||
Arrays.asList(element),
|
||||
ImmutableSet.of(element),
|
||||
ImmutableMultiset.of(element)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T element) {
|
||||
return iterAssert.isSubsetOf(element);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Iterable
|
||||
//
|
||||
@@ -264,7 +359,6 @@ final class AssertJRules {
|
||||
Refaster.anyOf(
|
||||
assertThat(iterable).hasSize(0),
|
||||
assertThat(iterable.iterator().hasNext()).isFalse(),
|
||||
assertThat(iterable.iterator()).isExhausted(),
|
||||
assertThat(Iterables.size(iterable)).isEqualTo(0L),
|
||||
assertThat(Iterables.size(iterable)).isNotPositive());
|
||||
}
|
||||
@@ -1061,6 +1155,824 @@ final class AssertJRules {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// BELOW: Generated code.
|
||||
|
||||
//
|
||||
// ObjectEnumerableAssert: containsAnyOf
|
||||
//
|
||||
|
||||
static final class ObjectEnumerableContainsAnyOfTwoElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2) {
|
||||
return iterAssert.containsAnyElementsOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2),
|
||||
Arrays.asList(e1, e2),
|
||||
ImmutableSet.of(e1, e2),
|
||||
ImmutableMultiset.of(e1, e2)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2) {
|
||||
return iterAssert.containsAnyOf(e1, e2);
|
||||
}
|
||||
}
|
||||
|
||||
static final class ObjectEnumerableContainsAnyOfThreeElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3) {
|
||||
return iterAssert.containsAnyElementsOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3),
|
||||
Arrays.asList(e1, e2, e3),
|
||||
ImmutableSet.of(e1, e2, e3),
|
||||
ImmutableMultiset.of(e1, e2, e3)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3) {
|
||||
return iterAssert.containsAnyOf(e1, e2, e3);
|
||||
}
|
||||
}
|
||||
|
||||
static final class ObjectEnumerableContainsAnyOfFourElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4) {
|
||||
return iterAssert.containsAnyElementsOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3, e4),
|
||||
Arrays.asList(e1, e2, e3, e4),
|
||||
ImmutableSet.of(e1, e2, e3, e4),
|
||||
ImmutableMultiset.of(e1, e2, e3, e4)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4) {
|
||||
return iterAssert.containsAnyOf(e1, e2, e3, e4);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX: Add variants for 6+ elements?
|
||||
static final class ObjectEnumerableContainsAnyOfFiveElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4, T e5) {
|
||||
return iterAssert.containsAnyElementsOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3, e4, e5),
|
||||
Arrays.asList(e1, e2, e3, e4, e5),
|
||||
ImmutableSet.of(e1, e2, e3, e4, e5),
|
||||
ImmutableMultiset.of(e1, e2, e3, e4, e5)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4, T e5) {
|
||||
return iterAssert.containsAnyOf(e1, e2, e3, e4, e5);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// ObjectEnumerableAssert: contains
|
||||
//
|
||||
|
||||
static final class ObjectEnumerableContainsTwoElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2) {
|
||||
return iterAssert.containsAll(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2),
|
||||
Arrays.asList(e1, e2),
|
||||
ImmutableSet.of(e1, e2),
|
||||
ImmutableMultiset.of(e1, e2)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2) {
|
||||
return iterAssert.contains(e1, e2);
|
||||
}
|
||||
}
|
||||
|
||||
static final class ObjectEnumerableContainsThreeElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3) {
|
||||
return iterAssert.containsAll(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3),
|
||||
Arrays.asList(e1, e2, e3),
|
||||
ImmutableSet.of(e1, e2, e3),
|
||||
ImmutableMultiset.of(e1, e2, e3)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3) {
|
||||
return iterAssert.contains(e1, e2, e3);
|
||||
}
|
||||
}
|
||||
|
||||
static final class ObjectEnumerableContainsFourElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4) {
|
||||
return iterAssert.containsAll(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3, e4),
|
||||
Arrays.asList(e1, e2, e3, e4),
|
||||
ImmutableSet.of(e1, e2, e3, e4),
|
||||
ImmutableMultiset.of(e1, e2, e3, e4)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4) {
|
||||
return iterAssert.contains(e1, e2, e3, e4);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX: Add variants for 6+ elements?
|
||||
static final class ObjectEnumerableContainsFiveElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4, T e5) {
|
||||
return iterAssert.containsAll(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3, e4, e5),
|
||||
Arrays.asList(e1, e2, e3, e4, e5),
|
||||
ImmutableSet.of(e1, e2, e3, e4, e5),
|
||||
ImmutableMultiset.of(e1, e2, e3, e4, e5)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4, T e5) {
|
||||
return iterAssert.contains(e1, e2, e3, e4, e5);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// ObjectEnumerableAssert: containsExactly
|
||||
//
|
||||
|
||||
static final class ObjectEnumerableContainsExactlyTwoElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2) {
|
||||
return iterAssert.containsExactlyElementsOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2),
|
||||
Arrays.asList(e1, e2),
|
||||
ImmutableSet.of(e1, e2),
|
||||
ImmutableMultiset.of(e1, e2)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2) {
|
||||
return iterAssert.containsExactly(e1, e2);
|
||||
}
|
||||
}
|
||||
|
||||
static final class ObjectEnumerableContainsExactlyThreeElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3) {
|
||||
return iterAssert.containsExactlyElementsOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3),
|
||||
Arrays.asList(e1, e2, e3),
|
||||
ImmutableSet.of(e1, e2, e3),
|
||||
ImmutableMultiset.of(e1, e2, e3)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3) {
|
||||
return iterAssert.containsExactly(e1, e2, e3);
|
||||
}
|
||||
}
|
||||
|
||||
static final class ObjectEnumerableContainsExactlyFourElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4) {
|
||||
return iterAssert.containsExactlyElementsOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3, e4),
|
||||
Arrays.asList(e1, e2, e3, e4),
|
||||
ImmutableSet.of(e1, e2, e3, e4),
|
||||
ImmutableMultiset.of(e1, e2, e3, e4)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4) {
|
||||
return iterAssert.containsExactly(e1, e2, e3, e4);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX: Add variants for 6+ elements?
|
||||
static final class ObjectEnumerableContainsExactlyFiveElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4, T e5) {
|
||||
return iterAssert.containsExactlyElementsOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3, e4, e5),
|
||||
Arrays.asList(e1, e2, e3, e4, e5),
|
||||
ImmutableSet.of(e1, e2, e3, e4, e5),
|
||||
ImmutableMultiset.of(e1, e2, e3, e4, e5)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4, T e5) {
|
||||
return iterAssert.containsExactly(e1, e2, e3, e4, e5);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// ObjectEnumerableAssert: containsExactlyInAnyOrder
|
||||
//
|
||||
|
||||
static final class ObjectEnumerableContainsExactlyInAnyOrderTwoElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2) {
|
||||
return iterAssert.containsExactlyInAnyOrderElementsOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2),
|
||||
Arrays.asList(e1, e2),
|
||||
ImmutableSet.of(e1, e2),
|
||||
ImmutableMultiset.of(e1, e2)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2) {
|
||||
return iterAssert.containsExactlyInAnyOrder(e1, e2);
|
||||
}
|
||||
}
|
||||
|
||||
static final class ObjectEnumerableContainsExactlyInAnyOrderThreeElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3) {
|
||||
return iterAssert.containsExactlyInAnyOrderElementsOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3),
|
||||
Arrays.asList(e1, e2, e3),
|
||||
ImmutableSet.of(e1, e2, e3),
|
||||
ImmutableMultiset.of(e1, e2, e3)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3) {
|
||||
return iterAssert.containsExactlyInAnyOrder(e1, e2, e3);
|
||||
}
|
||||
}
|
||||
|
||||
static final class ObjectEnumerableContainsExactlyInAnyOrderFourElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4) {
|
||||
return iterAssert.containsExactlyInAnyOrderElementsOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3, e4),
|
||||
Arrays.asList(e1, e2, e3, e4),
|
||||
ImmutableSet.of(e1, e2, e3, e4),
|
||||
ImmutableMultiset.of(e1, e2, e3, e4)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4) {
|
||||
return iterAssert.containsExactlyInAnyOrder(e1, e2, e3, e4);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX: Add variants for 6+ elements?
|
||||
static final class ObjectEnumerableContainsExactlyInAnyOrderFiveElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4, T e5) {
|
||||
return iterAssert.containsExactlyInAnyOrderElementsOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3, e4, e5),
|
||||
Arrays.asList(e1, e2, e3, e4, e5),
|
||||
ImmutableSet.of(e1, e2, e3, e4, e5),
|
||||
ImmutableMultiset.of(e1, e2, e3, e4, e5)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4, T e5) {
|
||||
return iterAssert.containsExactlyInAnyOrder(e1, e2, e3, e4, e5);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// ObjectEnumerableAssert: containsSequence
|
||||
//
|
||||
|
||||
static final class ObjectEnumerableContainsSequenceTwoElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2) {
|
||||
return iterAssert.containsSequence(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2),
|
||||
Arrays.asList(e1, e2),
|
||||
ImmutableSet.of(e1, e2),
|
||||
ImmutableMultiset.of(e1, e2)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2) {
|
||||
return iterAssert.containsSequence(e1, e2);
|
||||
}
|
||||
}
|
||||
|
||||
static final class ObjectEnumerableContainsSequenceThreeElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3) {
|
||||
return iterAssert.containsSequence(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3),
|
||||
Arrays.asList(e1, e2, e3),
|
||||
ImmutableSet.of(e1, e2, e3),
|
||||
ImmutableMultiset.of(e1, e2, e3)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3) {
|
||||
return iterAssert.containsSequence(e1, e2, e3);
|
||||
}
|
||||
}
|
||||
|
||||
static final class ObjectEnumerableContainsSequenceFourElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4) {
|
||||
return iterAssert.containsSequence(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3, e4),
|
||||
Arrays.asList(e1, e2, e3, e4),
|
||||
ImmutableSet.of(e1, e2, e3, e4),
|
||||
ImmutableMultiset.of(e1, e2, e3, e4)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4) {
|
||||
return iterAssert.containsSequence(e1, e2, e3, e4);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX: Add variants for 6+ elements?
|
||||
static final class ObjectEnumerableContainsSequenceFiveElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4, T e5) {
|
||||
return iterAssert.containsSequence(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3, e4, e5),
|
||||
Arrays.asList(e1, e2, e3, e4, e5),
|
||||
ImmutableSet.of(e1, e2, e3, e4, e5),
|
||||
ImmutableMultiset.of(e1, e2, e3, e4, e5)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4, T e5) {
|
||||
return iterAssert.containsSequence(e1, e2, e3, e4, e5);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// ObjectEnumerableAssert: containsSubsequence
|
||||
//
|
||||
|
||||
static final class ObjectEnumerableContainsSubsequenceTwoElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2) {
|
||||
return iterAssert.containsSubsequence(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2),
|
||||
Arrays.asList(e1, e2),
|
||||
ImmutableSet.of(e1, e2),
|
||||
ImmutableMultiset.of(e1, e2)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2) {
|
||||
return iterAssert.containsSubsequence(e1, e2);
|
||||
}
|
||||
}
|
||||
|
||||
static final class ObjectEnumerableContainsSubsequenceThreeElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3) {
|
||||
return iterAssert.containsSubsequence(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3),
|
||||
Arrays.asList(e1, e2, e3),
|
||||
ImmutableSet.of(e1, e2, e3),
|
||||
ImmutableMultiset.of(e1, e2, e3)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3) {
|
||||
return iterAssert.containsSubsequence(e1, e2, e3);
|
||||
}
|
||||
}
|
||||
|
||||
static final class ObjectEnumerableContainsSubsequenceFourElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4) {
|
||||
return iterAssert.containsSubsequence(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3, e4),
|
||||
Arrays.asList(e1, e2, e3, e4),
|
||||
ImmutableSet.of(e1, e2, e3, e4),
|
||||
ImmutableMultiset.of(e1, e2, e3, e4)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4) {
|
||||
return iterAssert.containsSubsequence(e1, e2, e3, e4);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX: Add variants for 6+ elements?
|
||||
static final class ObjectEnumerableContainsSubsequenceFiveElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4, T e5) {
|
||||
return iterAssert.containsSubsequence(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3, e4, e5),
|
||||
Arrays.asList(e1, e2, e3, e4, e5),
|
||||
ImmutableSet.of(e1, e2, e3, e4, e5),
|
||||
ImmutableMultiset.of(e1, e2, e3, e4, e5)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4, T e5) {
|
||||
return iterAssert.containsSubsequence(e1, e2, e3, e4, e5);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// ObjectEnumerableAssert: doesNotContain
|
||||
//
|
||||
|
||||
static final class ObjectEnumerableDoesNotContainTwoElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2) {
|
||||
return iterAssert.doesNotContainAnyElementsOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2),
|
||||
Arrays.asList(e1, e2),
|
||||
ImmutableSet.of(e1, e2),
|
||||
ImmutableMultiset.of(e1, e2)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2) {
|
||||
return iterAssert.doesNotContain(e1, e2);
|
||||
}
|
||||
}
|
||||
|
||||
static final class ObjectEnumerableDoesNotContainThreeElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3) {
|
||||
return iterAssert.doesNotContainAnyElementsOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3),
|
||||
Arrays.asList(e1, e2, e3),
|
||||
ImmutableSet.of(e1, e2, e3),
|
||||
ImmutableMultiset.of(e1, e2, e3)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3) {
|
||||
return iterAssert.doesNotContain(e1, e2, e3);
|
||||
}
|
||||
}
|
||||
|
||||
static final class ObjectEnumerableDoesNotContainFourElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4) {
|
||||
return iterAssert.doesNotContainAnyElementsOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3, e4),
|
||||
Arrays.asList(e1, e2, e3, e4),
|
||||
ImmutableSet.of(e1, e2, e3, e4),
|
||||
ImmutableMultiset.of(e1, e2, e3, e4)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4) {
|
||||
return iterAssert.doesNotContain(e1, e2, e3, e4);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX: Add variants for 6+ elements?
|
||||
static final class ObjectEnumerableDoesNotContainFiveElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4, T e5) {
|
||||
return iterAssert.doesNotContainAnyElementsOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3, e4, e5),
|
||||
Arrays.asList(e1, e2, e3, e4, e5),
|
||||
ImmutableSet.of(e1, e2, e3, e4, e5),
|
||||
ImmutableMultiset.of(e1, e2, e3, e4, e5)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4, T e5) {
|
||||
return iterAssert.doesNotContain(e1, e2, e3, e4, e5);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// ObjectEnumerableAssert: doesNotContainSequence
|
||||
//
|
||||
|
||||
static final class ObjectEnumerableDoesNotContainSequenceTwoElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2) {
|
||||
return iterAssert.doesNotContainSequence(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2),
|
||||
Arrays.asList(e1, e2),
|
||||
ImmutableSet.of(e1, e2),
|
||||
ImmutableMultiset.of(e1, e2)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2) {
|
||||
return iterAssert.doesNotContainSequence(e1, e2);
|
||||
}
|
||||
}
|
||||
|
||||
static final class ObjectEnumerableDoesNotContainSequenceThreeElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3) {
|
||||
return iterAssert.doesNotContainSequence(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3),
|
||||
Arrays.asList(e1, e2, e3),
|
||||
ImmutableSet.of(e1, e2, e3),
|
||||
ImmutableMultiset.of(e1, e2, e3)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3) {
|
||||
return iterAssert.doesNotContainSequence(e1, e2, e3);
|
||||
}
|
||||
}
|
||||
|
||||
static final class ObjectEnumerableDoesNotContainSequenceFourElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4) {
|
||||
return iterAssert.doesNotContainSequence(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3, e4),
|
||||
Arrays.asList(e1, e2, e3, e4),
|
||||
ImmutableSet.of(e1, e2, e3, e4),
|
||||
ImmutableMultiset.of(e1, e2, e3, e4)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4) {
|
||||
return iterAssert.doesNotContainSequence(e1, e2, e3, e4);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX: Add variants for 6+ elements?
|
||||
static final class ObjectEnumerableDoesNotContainSequenceFiveElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4, T e5) {
|
||||
return iterAssert.doesNotContainSequence(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3, e4, e5),
|
||||
Arrays.asList(e1, e2, e3, e4, e5),
|
||||
ImmutableSet.of(e1, e2, e3, e4, e5),
|
||||
ImmutableMultiset.of(e1, e2, e3, e4, e5)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4, T e5) {
|
||||
return iterAssert.doesNotContainSequence(e1, e2, e3, e4, e5);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// ObjectEnumerableAssert: containsOnly
|
||||
//
|
||||
|
||||
static final class ObjectEnumerableContainsOnlyTwoElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2) {
|
||||
return iterAssert.hasSameElementsAs(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2),
|
||||
Arrays.asList(e1, e2),
|
||||
ImmutableSet.of(e1, e2),
|
||||
ImmutableMultiset.of(e1, e2)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2) {
|
||||
return iterAssert.containsOnly(e1, e2);
|
||||
}
|
||||
}
|
||||
|
||||
static final class ObjectEnumerableContainsOnlyThreeElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3) {
|
||||
return iterAssert.hasSameElementsAs(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3),
|
||||
Arrays.asList(e1, e2, e3),
|
||||
ImmutableSet.of(e1, e2, e3),
|
||||
ImmutableMultiset.of(e1, e2, e3)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3) {
|
||||
return iterAssert.containsOnly(e1, e2, e3);
|
||||
}
|
||||
}
|
||||
|
||||
static final class ObjectEnumerableContainsOnlyFourElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4) {
|
||||
return iterAssert.hasSameElementsAs(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3, e4),
|
||||
Arrays.asList(e1, e2, e3, e4),
|
||||
ImmutableSet.of(e1, e2, e3, e4),
|
||||
ImmutableMultiset.of(e1, e2, e3, e4)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4) {
|
||||
return iterAssert.containsOnly(e1, e2, e3, e4);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX: Add variants for 6+ elements?
|
||||
static final class ObjectEnumerableContainsOnlyFiveElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4, T e5) {
|
||||
return iterAssert.hasSameElementsAs(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3, e4, e5),
|
||||
Arrays.asList(e1, e2, e3, e4, e5),
|
||||
ImmutableSet.of(e1, e2, e3, e4, e5),
|
||||
ImmutableMultiset.of(e1, e2, e3, e4, e5)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4, T e5) {
|
||||
return iterAssert.containsOnly(e1, e2, e3, e4, e5);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// ObjectEnumerableAssert: isSubsetOf
|
||||
//
|
||||
|
||||
static final class ObjectEnumerableIsSubsetOfTwoElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2) {
|
||||
return iterAssert.isSubsetOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2),
|
||||
Arrays.asList(e1, e2),
|
||||
ImmutableSet.of(e1, e2),
|
||||
ImmutableMultiset.of(e1, e2)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2) {
|
||||
return iterAssert.isSubsetOf(e1, e2);
|
||||
}
|
||||
}
|
||||
|
||||
static final class ObjectEnumerableIsSubsetOfThreeElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3) {
|
||||
return iterAssert.isSubsetOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3),
|
||||
Arrays.asList(e1, e2, e3),
|
||||
ImmutableSet.of(e1, e2, e3),
|
||||
ImmutableMultiset.of(e1, e2, e3)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3) {
|
||||
return iterAssert.isSubsetOf(e1, e2, e3);
|
||||
}
|
||||
}
|
||||
|
||||
static final class ObjectEnumerableIsSubsetOfFourElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4) {
|
||||
return iterAssert.isSubsetOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3, e4),
|
||||
Arrays.asList(e1, e2, e3, e4),
|
||||
ImmutableSet.of(e1, e2, e3, e4),
|
||||
ImmutableMultiset.of(e1, e2, e3, e4)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4) {
|
||||
return iterAssert.isSubsetOf(e1, e2, e3, e4);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX: Add variants for 6+ elements?
|
||||
static final class ObjectEnumerableIsSubsetOfFiveElements<S, T extends S> {
|
||||
@BeforeTemplate
|
||||
ObjectEnumerableAssert<?, S> before(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4, T e5) {
|
||||
return iterAssert.isSubsetOf(
|
||||
Refaster.anyOf(
|
||||
ImmutableList.of(e1, e2, e3, e4, e5),
|
||||
Arrays.asList(e1, e2, e3, e4, e5),
|
||||
ImmutableSet.of(e1, e2, e3, e4, e5),
|
||||
ImmutableMultiset.of(e1, e2, e3, e4, e5)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@SuppressWarnings("unchecked")
|
||||
ObjectEnumerableAssert<?, S> after(
|
||||
ObjectEnumerableAssert<?, S> iterAssert, T e1, T e2, T e3, T e4, T e5) {
|
||||
return iterAssert.isSubsetOf(e1, e2, e3, e4, e5);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Above: Generated code.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Organize the code below.
|
||||
|
||||
@@ -12,7 +12,6 @@ import java.nio.charset.Charset;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import org.assertj.core.api.AbstractAssert;
|
||||
import org.assertj.core.api.AbstractBooleanAssert;
|
||||
import org.assertj.core.api.AbstractStringAssert;
|
||||
import tech.picnic.errorprone.refaster.annotation.OnlineDocumentation;
|
||||
|
||||
@@ -70,32 +69,6 @@ final class AssertJStringRules {
|
||||
}
|
||||
}
|
||||
|
||||
static final class AssertThatStringContains {
|
||||
@BeforeTemplate
|
||||
AbstractBooleanAssert<?> before(String string, String substring) {
|
||||
return assertThat(string.contains(substring)).isTrue();
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@UseImportPolicy(STATIC_IMPORT_ALWAYS)
|
||||
AbstractStringAssert<?> after(String string, String substring) {
|
||||
return assertThat(string).contains(substring);
|
||||
}
|
||||
}
|
||||
|
||||
static final class AssertThatStringDoesNotContain {
|
||||
@BeforeTemplate
|
||||
AbstractBooleanAssert<?> before(String string, String substring) {
|
||||
return assertThat(string.contains(substring)).isFalse();
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@UseImportPolicy(STATIC_IMPORT_ALWAYS)
|
||||
AbstractStringAssert<?> after(String string, String substring) {
|
||||
return assertThat(string).doesNotContain(substring);
|
||||
}
|
||||
}
|
||||
|
||||
static final class AssertThatMatches {
|
||||
@BeforeTemplate
|
||||
AbstractAssert<?, ?> before(String string, String regex) {
|
||||
|
||||
@@ -7,10 +7,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
import static org.assertj.core.api.Assertions.assertThatNullPointerException;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
import static org.assertj.core.api.InstanceOfAssertFactories.throwable;
|
||||
import static org.assertj.core.api.InstanceOfAssertFactories.type;
|
||||
|
||||
import com.google.errorprone.refaster.Refaster;
|
||||
import com.google.errorprone.refaster.annotation.AfterTemplate;
|
||||
import com.google.errorprone.refaster.annotation.BeforeTemplate;
|
||||
import com.google.errorprone.refaster.annotation.Repeated;
|
||||
@@ -19,7 +16,6 @@ import java.io.IOException;
|
||||
import org.assertj.core.api.AbstractObjectAssert;
|
||||
import org.assertj.core.api.AbstractThrowableAssert;
|
||||
import org.assertj.core.api.ThrowableAssert.ThrowingCallable;
|
||||
import org.assertj.core.api.ThrowableAssertAlternative;
|
||||
import tech.picnic.errorprone.refaster.annotation.OnlineDocumentation;
|
||||
|
||||
/**
|
||||
@@ -35,21 +31,6 @@ import tech.picnic.errorprone.refaster.annotation.OnlineDocumentation;
|
||||
final class AssertJThrowingCallableRules {
|
||||
private AssertJThrowingCallableRules() {}
|
||||
|
||||
static final class AssertThatThrownByIsInstanceOf<T extends Throwable> {
|
||||
@BeforeTemplate
|
||||
void before(ThrowingCallable throwingCallable, Class<T> exceptionType) {
|
||||
Refaster.anyOf(
|
||||
assertThatThrownBy(throwingCallable).asInstanceOf(throwable(exceptionType)),
|
||||
assertThatThrownBy(throwingCallable).asInstanceOf(type(exceptionType)));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@UseImportPolicy(STATIC_IMPORT_ALWAYS)
|
||||
void after(ThrowingCallable throwingCallable, Class<T> exceptionType) {
|
||||
assertThatThrownBy(throwingCallable).isInstanceOf(exceptionType);
|
||||
}
|
||||
}
|
||||
|
||||
static final class AssertThatThrownByIllegalArgumentException {
|
||||
@BeforeTemplate
|
||||
AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable) {
|
||||
@@ -80,27 +61,6 @@ final class AssertJThrowingCallableRules {
|
||||
}
|
||||
}
|
||||
|
||||
static final class AssertThatThrownByIllegalArgumentExceptionRootCauseHasMessage {
|
||||
@BeforeTemplate
|
||||
@SuppressWarnings(
|
||||
"AssertThatThrownByIllegalArgumentException" /* This is a more specific template. */)
|
||||
AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) {
|
||||
return assertThatIllegalArgumentException()
|
||||
.isThrownBy(throwingCallable)
|
||||
.havingRootCause()
|
||||
.withMessage(message);
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@UseImportPolicy(STATIC_IMPORT_ALWAYS)
|
||||
AbstractObjectAssert<?, ?> after(ThrowingCallable throwingCallable, String message) {
|
||||
return assertThatThrownBy(throwingCallable)
|
||||
.isInstanceOf(IllegalArgumentException.class)
|
||||
.rootCause()
|
||||
.hasMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
static final class AssertThatThrownByIllegalArgumentExceptionHasMessageParameters {
|
||||
@BeforeTemplate
|
||||
@SuppressWarnings(
|
||||
@@ -211,27 +171,6 @@ final class AssertJThrowingCallableRules {
|
||||
}
|
||||
}
|
||||
|
||||
static final class AssertThatThrownByIllegalStateExceptionRootCauseHasMessage {
|
||||
@BeforeTemplate
|
||||
@SuppressWarnings(
|
||||
"AssertThatThrownByIllegalStateException" /* This is a more specific template. */)
|
||||
AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) {
|
||||
return assertThatIllegalStateException()
|
||||
.isThrownBy(throwingCallable)
|
||||
.havingRootCause()
|
||||
.withMessage(message);
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@UseImportPolicy(STATIC_IMPORT_ALWAYS)
|
||||
AbstractObjectAssert<?, ?> after(ThrowingCallable throwingCallable, String message) {
|
||||
return assertThatThrownBy(throwingCallable)
|
||||
.isInstanceOf(IllegalStateException.class)
|
||||
.rootCause()
|
||||
.hasMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
static final class AssertThatThrownByIllegalStateExceptionHasMessageParameters {
|
||||
@BeforeTemplate
|
||||
@SuppressWarnings(
|
||||
@@ -340,27 +279,6 @@ final class AssertJThrowingCallableRules {
|
||||
}
|
||||
}
|
||||
|
||||
static final class AssertThatThrownByNullPointerExceptionRootCauseHasMessage {
|
||||
@BeforeTemplate
|
||||
@SuppressWarnings(
|
||||
"AssertThatThrownByNullPointerException" /* This is a more specific template. */)
|
||||
AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) {
|
||||
return assertThatNullPointerException()
|
||||
.isThrownBy(throwingCallable)
|
||||
.havingRootCause()
|
||||
.withMessage(message);
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@UseImportPolicy(STATIC_IMPORT_ALWAYS)
|
||||
AbstractObjectAssert<?, ?> after(ThrowingCallable throwingCallable, String message) {
|
||||
return assertThatThrownBy(throwingCallable)
|
||||
.isInstanceOf(NullPointerException.class)
|
||||
.rootCause()
|
||||
.hasMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
static final class AssertThatThrownByNullPointerExceptionHasMessageParameters {
|
||||
@BeforeTemplate
|
||||
@SuppressWarnings(
|
||||
@@ -468,26 +386,6 @@ final class AssertJThrowingCallableRules {
|
||||
}
|
||||
}
|
||||
|
||||
static final class AssertThatThrownByIOExceptionRootCauseHasMessage {
|
||||
@BeforeTemplate
|
||||
@SuppressWarnings("AssertThatThrownByIOException" /* This is a more specific template. */)
|
||||
AbstractObjectAssert<?, ?> before(ThrowingCallable throwingCallable, String message) {
|
||||
return assertThatIOException()
|
||||
.isThrownBy(throwingCallable)
|
||||
.havingRootCause()
|
||||
.withMessage(message);
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@UseImportPolicy(STATIC_IMPORT_ALWAYS)
|
||||
AbstractObjectAssert<?, ?> after(ThrowingCallable throwingCallable, String message) {
|
||||
return assertThatThrownBy(throwingCallable)
|
||||
.isInstanceOf(IOException.class)
|
||||
.rootCause()
|
||||
.hasMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
static final class AssertThatThrownByIOExceptionHasMessageParameters {
|
||||
@BeforeTemplate
|
||||
@SuppressWarnings("AssertThatThrownByIOException" /* This is a more specific template. */)
|
||||
@@ -554,24 +452,24 @@ final class AssertJThrowingCallableRules {
|
||||
}
|
||||
}
|
||||
|
||||
static final class AssertThatThrownByAsInstanceOfThrowable<T extends Throwable> {
|
||||
static final class AssertThatThrownBy {
|
||||
@BeforeTemplate
|
||||
ThrowableAssertAlternative<T> before(
|
||||
ThrowingCallable throwingCallable, Class<T> exceptionType) {
|
||||
AbstractObjectAssert<?, ?> before(
|
||||
ThrowingCallable throwingCallable, Class<? extends Throwable> exceptionType) {
|
||||
return assertThatExceptionOfType(exceptionType).isThrownBy(throwingCallable);
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@UseImportPolicy(STATIC_IMPORT_ALWAYS)
|
||||
AbstractThrowableAssert<?, T> after(ThrowingCallable throwingCallable, Class<T> exceptionType) {
|
||||
return assertThatThrownBy(throwingCallable).asInstanceOf(throwable(exceptionType));
|
||||
AbstractObjectAssert<?, ?> after(
|
||||
ThrowingCallable throwingCallable, Class<? extends Throwable> exceptionType) {
|
||||
return assertThatThrownBy(throwingCallable).isInstanceOf(exceptionType);
|
||||
}
|
||||
}
|
||||
|
||||
static final class AssertThatThrownByHasMessage {
|
||||
@BeforeTemplate
|
||||
@SuppressWarnings(
|
||||
"AssertThatThrownByAsInstanceOfThrowable" /* This is a more specific template. */)
|
||||
@SuppressWarnings("AssertThatThrownBy" /* This is a more specific template. */)
|
||||
AbstractObjectAssert<?, ?> before(
|
||||
ThrowingCallable throwingCallable,
|
||||
Class<? extends Throwable> exceptionType,
|
||||
@@ -591,37 +489,9 @@ final class AssertJThrowingCallableRules {
|
||||
}
|
||||
}
|
||||
|
||||
static final class AssertThatThrownByRootCauseHasMessage {
|
||||
@BeforeTemplate
|
||||
@SuppressWarnings(
|
||||
"AssertThatThrownByAsInstanceOfThrowable" /* This is a more specific template. */)
|
||||
AbstractObjectAssert<?, ?> before(
|
||||
ThrowingCallable throwingCallable,
|
||||
Class<? extends Throwable> exceptionType,
|
||||
String message) {
|
||||
return assertThatExceptionOfType(exceptionType)
|
||||
.isThrownBy(throwingCallable)
|
||||
.havingRootCause()
|
||||
.withMessage(message);
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@UseImportPolicy(STATIC_IMPORT_ALWAYS)
|
||||
AbstractObjectAssert<?, ?> after(
|
||||
ThrowingCallable throwingCallable,
|
||||
Class<? extends Throwable> exceptionType,
|
||||
String message) {
|
||||
return assertThatThrownBy(throwingCallable)
|
||||
.isInstanceOf(exceptionType)
|
||||
.rootCause()
|
||||
.hasMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
static final class AssertThatThrownByHasMessageParameters {
|
||||
@BeforeTemplate
|
||||
@SuppressWarnings(
|
||||
"AssertThatThrownByAsInstanceOfThrowable" /* This is a more specific template. */)
|
||||
@SuppressWarnings("AssertThatThrownBy" /* This is a more specific template. */)
|
||||
AbstractObjectAssert<?, ?> before(
|
||||
ThrowingCallable throwingCallable,
|
||||
Class<? extends Throwable> exceptionType,
|
||||
@@ -647,8 +517,7 @@ final class AssertJThrowingCallableRules {
|
||||
|
||||
static final class AssertThatThrownByHasMessageStartingWith {
|
||||
@BeforeTemplate
|
||||
@SuppressWarnings(
|
||||
"AssertThatThrownByAsInstanceOfThrowable" /* This is a more specific template. */)
|
||||
@SuppressWarnings("AssertThatThrownBy" /* This is a more specific template. */)
|
||||
AbstractObjectAssert<?, ?> before(
|
||||
ThrowingCallable throwingCallable,
|
||||
Class<? extends Throwable> exceptionType,
|
||||
@@ -672,8 +541,7 @@ final class AssertJThrowingCallableRules {
|
||||
|
||||
static final class AssertThatThrownByHasMessageContaining {
|
||||
@BeforeTemplate
|
||||
@SuppressWarnings(
|
||||
"AssertThatThrownByAsInstanceOfThrowable" /* This is a more specific template. */)
|
||||
@SuppressWarnings("AssertThatThrownBy" /* This is a more specific template. */)
|
||||
AbstractObjectAssert<?, ?> before(
|
||||
ThrowingCallable throwingCallable,
|
||||
Class<? extends Throwable> exceptionType,
|
||||
@@ -697,8 +565,7 @@ final class AssertJThrowingCallableRules {
|
||||
|
||||
static final class AssertThatThrownByHasMessageNotContaining {
|
||||
@BeforeTemplate
|
||||
@SuppressWarnings(
|
||||
"AssertThatThrownByAsInstanceOfThrowable" /* This is a more specific template. */)
|
||||
@SuppressWarnings("AssertThatThrownBy" /* This is a more specific template. */)
|
||||
AbstractObjectAssert<?, ?> before(
|
||||
ThrowingCallable throwingCallable,
|
||||
Class<? extends Throwable> exceptionType,
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.sun.tools.javac.util.Constants;
|
||||
import com.sun.tools.javac.util.Convert;
|
||||
import javax.lang.model.element.Name;
|
||||
import tech.picnic.errorprone.refaster.annotation.OnlineDocumentation;
|
||||
import tech.picnic.errorprone.utils.SourceCode;
|
||||
|
||||
/** Refaster rules related to {@link com.google.errorprone.bugpatterns.BugChecker} classes. */
|
||||
@OnlineDocumentation
|
||||
@@ -57,26 +56,16 @@ final class BugCheckerRules {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prefer {@link SourceCode#toStringConstantExpression(Object,
|
||||
* com.google.errorprone.VisitorState)} over alternatives that unnecessarily escape single quote
|
||||
* characters.
|
||||
*/
|
||||
/** Prefer using the {@link Constants} API over more verbose alternatives. */
|
||||
static final class ConstantsFormat {
|
||||
@BeforeTemplate
|
||||
String before(CharSequence value) {
|
||||
return Constants.format(value);
|
||||
}
|
||||
|
||||
@BeforeTemplate
|
||||
String before(String value) {
|
||||
return String.format("\"%s\"", Convert.quote(value));
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
String after(CharSequence value) {
|
||||
return SourceCode.toStringConstantExpression(
|
||||
value, Refaster.emitCommentBefore("REPLACEME", null));
|
||||
String after(String value) {
|
||||
return Constants.format(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
package tech.picnic.errorprone.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 tech.picnic.errorprone.refaster.annotation.OnlineDocumentation;
|
||||
|
||||
/** Refaster rules related to expressions dealing with {@link CharSequence}s. */
|
||||
@OnlineDocumentation
|
||||
final class CharSequenceRules {
|
||||
private CharSequenceRules() {}
|
||||
|
||||
/**
|
||||
* Prefer {@link CharSequence#isEmpty()} over alternatives that consult the char sequence's
|
||||
* length.
|
||||
*/
|
||||
// XXX: Drop this rule once we (and OpenRewrite) no longer support projects targeting Java 14 or
|
||||
// below.
|
||||
static final class CharSequenceIsEmpty {
|
||||
@BeforeTemplate
|
||||
boolean before(CharSequence charSequence) {
|
||||
return Refaster.anyOf(
|
||||
charSequence.length() == 0, charSequence.length() <= 0, charSequence.length() < 1);
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@AlsoNegation
|
||||
boolean after(CharSequence charSequence) {
|
||||
return charSequence.isEmpty();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,12 +93,6 @@ final class FileRules {
|
||||
/**
|
||||
* Prefer {@link Files#createTempFile(String, String, FileAttribute[])} over alternatives that
|
||||
* create files with more liberal permissions.
|
||||
*
|
||||
* <p>Note that {@link File#createTempFile} treats the given prefix as a path, and ignores all but
|
||||
* its file name. That is, the actual prefix used is derived from all characters following the
|
||||
* final file separator (if any). This is not the case with {@link Files#createTempFile}, which
|
||||
* will instead throw an {@link IllegalArgumentException} if the prefix contains any file
|
||||
* separators.
|
||||
*/
|
||||
static final class FilesCreateTempFileToFile {
|
||||
@BeforeTemplate
|
||||
@@ -123,12 +117,6 @@ final class FileRules {
|
||||
/**
|
||||
* Prefer {@link Files#createTempFile(Path, String, String, FileAttribute[])} over alternatives
|
||||
* that create files with more liberal permissions.
|
||||
*
|
||||
* <p>Note that {@link File#createTempFile} treats the given prefix as a path, and ignores all but
|
||||
* its file name. That is, the actual prefix used is derived from all characters following the
|
||||
* final file separator (if any). This is not the case with {@link Files#createTempFile}, which
|
||||
* will instead throw an {@link IllegalArgumentException} if the prefix contains any file
|
||||
* separators.
|
||||
*/
|
||||
static final class FilesCreateTempFileInCustomDirectoryToFile {
|
||||
@BeforeTemplate
|
||||
|
||||
@@ -36,7 +36,8 @@ final class ImmutableListMultimapRules {
|
||||
* Prefer {@link ImmutableListMultimap#builder()} over the associated constructor on constructions
|
||||
* that produce a less-specific type.
|
||||
*/
|
||||
// XXX: This rule may drop generic type information, leading to non-compilable code.
|
||||
// XXX: This drops generic type information, sometimes leading to non-compilable code. See
|
||||
// https://github.com/google/error-prone/pull/2706.
|
||||
static final class ImmutableListMultimapBuilder<K, V> {
|
||||
@BeforeTemplate
|
||||
ImmutableMultimap.Builder<K, V> before() {
|
||||
|
||||
@@ -28,7 +28,8 @@ final class ImmutableListRules {
|
||||
private ImmutableListRules() {}
|
||||
|
||||
/** Prefer {@link ImmutableList#builder()} over the associated constructor. */
|
||||
// XXX: This rule may drop generic type information, leading to non-compilable code.
|
||||
// XXX: This drops generic type information, sometimes leading to non-compilable code. See
|
||||
// https://github.com/google/error-prone/pull/2706.
|
||||
static final class ImmutableListBuilder<T> {
|
||||
@BeforeTemplate
|
||||
ImmutableList.Builder<T> before() {
|
||||
|
||||
@@ -31,7 +31,8 @@ final class ImmutableMapRules {
|
||||
private ImmutableMapRules() {}
|
||||
|
||||
/** Prefer {@link ImmutableMap#builder()} over the associated constructor. */
|
||||
// XXX: This rule may drop generic type information, leading to non-compilable code.
|
||||
// XXX: This drops generic type information, sometimes leading to non-compilable code. See
|
||||
// https://github.com/google/error-prone/pull/2706.
|
||||
static final class ImmutableMapBuilder<K, V> {
|
||||
@BeforeTemplate
|
||||
ImmutableMap.Builder<K, V> before() {
|
||||
|
||||
@@ -21,7 +21,8 @@ final class ImmutableMultisetRules {
|
||||
private ImmutableMultisetRules() {}
|
||||
|
||||
/** Prefer {@link ImmutableMultiset#builder()} over the associated constructor. */
|
||||
// XXX: This rule may drop generic type information, leading to non-compilable code.
|
||||
// XXX: This drops generic type information, sometimes leading to non-compilable code. See
|
||||
// https://github.com/google/error-prone/pull/2706.
|
||||
static final class ImmutableMultisetBuilder<T> {
|
||||
@BeforeTemplate
|
||||
ImmutableMultiset.Builder<T> before() {
|
||||
|
||||
@@ -29,7 +29,8 @@ final class ImmutableSetMultimapRules {
|
||||
private ImmutableSetMultimapRules() {}
|
||||
|
||||
/** Prefer {@link ImmutableSetMultimap#builder()} over the associated constructor. */
|
||||
// XXX: This rule may drop generic type information, leading to non-compilable code.
|
||||
// XXX: This drops generic type information, sometimes leading to non-compilable code. See
|
||||
// https://github.com/google/error-prone/pull/2706.
|
||||
static final class ImmutableSetMultimapBuilder<K, V> {
|
||||
@BeforeTemplate
|
||||
ImmutableSetMultimap.Builder<K, V> before() {
|
||||
|
||||
@@ -29,7 +29,8 @@ final class ImmutableSetRules {
|
||||
private ImmutableSetRules() {}
|
||||
|
||||
/** Prefer {@link ImmutableSet#builder()} over the associated constructor. */
|
||||
// XXX: This rule may drop generic type information, leading to non-compilable code.
|
||||
// XXX: This drops generic type information, sometimes leading to non-compilable code. See
|
||||
// https://github.com/google/error-prone/pull/2706.
|
||||
static final class ImmutableSetBuilder<T> {
|
||||
@BeforeTemplate
|
||||
ImmutableSet.Builder<T> before() {
|
||||
|
||||
@@ -37,7 +37,8 @@ final class ImmutableSortedMapRules {
|
||||
* Prefer {@link ImmutableSortedMap#naturalOrder()} over the alternative that requires explicitly
|
||||
* providing the {@link Comparator}.
|
||||
*/
|
||||
// XXX: This rule may drop generic type information, leading to non-compilable code.
|
||||
// XXX: This drops generic type information, sometimes leading to non-compilable code. See
|
||||
// https://github.com/google/error-prone/pull/2706.
|
||||
static final class ImmutableSortedMapNaturalOrderBuilder<K extends Comparable<? super K>, V> {
|
||||
@BeforeTemplate
|
||||
ImmutableSortedMap.Builder<K, V> before() {
|
||||
@@ -54,7 +55,8 @@ final class ImmutableSortedMapRules {
|
||||
* Prefer {@link ImmutableSortedMap#reverseOrder()} over the alternative that requires explicitly
|
||||
* providing the {@link Comparator}.
|
||||
*/
|
||||
// XXX: This rule may drop generic type information, leading to non-compilable code.
|
||||
// XXX: This drops generic type information, sometimes leading to non-compilable code. See
|
||||
// https://github.com/google/error-prone/pull/2706.
|
||||
static final class ImmutableSortedMapReverseOrderBuilder<K extends Comparable<? super K>, V> {
|
||||
@BeforeTemplate
|
||||
ImmutableSortedMap.Builder<K, V> before() {
|
||||
|
||||
@@ -1742,91 +1742,6 @@ final class ReactorRules {
|
||||
}
|
||||
}
|
||||
|
||||
/** Prefer {@link PublisherProbe#assertWasSubscribed()} over more verbose alternatives. */
|
||||
static final class PublisherProbeAssertWasSubscribed<T> {
|
||||
@BeforeTemplate
|
||||
void before(PublisherProbe<T> probe) {
|
||||
Refaster.anyOf(
|
||||
assertThat(probe.wasSubscribed()).isTrue(),
|
||||
assertThat(probe.subscribeCount()).isNotNegative(),
|
||||
assertThat(probe.subscribeCount()).isNotEqualTo(0),
|
||||
assertThat(probe.subscribeCount()).isPositive());
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
void after(PublisherProbe<T> probe) {
|
||||
probe.assertWasSubscribed();
|
||||
}
|
||||
}
|
||||
|
||||
/** Prefer {@link PublisherProbe#assertWasNotSubscribed()} over more verbose alternatives. */
|
||||
static final class PublisherProbeAssertWasNotSubscribed<T> {
|
||||
@BeforeTemplate
|
||||
void before(PublisherProbe<T> probe) {
|
||||
Refaster.anyOf(
|
||||
assertThat(probe.wasSubscribed()).isFalse(),
|
||||
assertThat(probe.subscribeCount()).isEqualTo(0),
|
||||
assertThat(probe.subscribeCount()).isNotPositive());
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
void after(PublisherProbe<T> probe) {
|
||||
probe.assertWasNotSubscribed();
|
||||
}
|
||||
}
|
||||
|
||||
/** Prefer {@link PublisherProbe#assertWasCancelled()} over more verbose alternatives. */
|
||||
static final class PublisherProbeAssertWasCancelled<T> {
|
||||
@BeforeTemplate
|
||||
void before(PublisherProbe<T> probe) {
|
||||
assertThat(probe.wasCancelled()).isTrue();
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
void after(PublisherProbe<T> probe) {
|
||||
probe.assertWasCancelled();
|
||||
}
|
||||
}
|
||||
|
||||
/** Prefer {@link PublisherProbe#assertWasNotCancelled()} over more verbose alternatives. */
|
||||
static final class PublisherProbeAssertWasNotCancelled<T> {
|
||||
@BeforeTemplate
|
||||
void before(PublisherProbe<T> probe) {
|
||||
assertThat(probe.wasCancelled()).isFalse();
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
void after(PublisherProbe<T> probe) {
|
||||
probe.assertWasNotCancelled();
|
||||
}
|
||||
}
|
||||
|
||||
/** Prefer {@link PublisherProbe#assertWasRequested()} over more verbose alternatives. */
|
||||
static final class PublisherProbeAssertWasRequested<T> {
|
||||
@BeforeTemplate
|
||||
void before(PublisherProbe<T> probe) {
|
||||
assertThat(probe.wasRequested()).isTrue();
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
void after(PublisherProbe<T> probe) {
|
||||
probe.assertWasRequested();
|
||||
}
|
||||
}
|
||||
|
||||
/** Prefer {@link PublisherProbe#assertWasNotRequested()} over more verbose alternatives. */
|
||||
static final class PublisherProbeAssertWasNotRequested<T> {
|
||||
@BeforeTemplate
|
||||
void before(PublisherProbe<T> probe) {
|
||||
assertThat(probe.wasRequested()).isFalse();
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
void after(PublisherProbe<T> probe) {
|
||||
probe.assertWasNotRequested();
|
||||
}
|
||||
}
|
||||
|
||||
/** Prefer {@link Mono#as(Function)} when creating a {@link StepVerifier}. */
|
||||
static final class StepVerifierFromMono<T> {
|
||||
@BeforeTemplate
|
||||
|
||||
@@ -297,22 +297,6 @@ final class StreamRules {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prefer an unconditional {@link Map#get(Object)} call followed by a {@code null} check over a
|
||||
* call to {@link Map#containsKey(Object)}, as the former avoids a second lookup operation.
|
||||
*/
|
||||
static final class StreamMapFilter<T, K, V> {
|
||||
@BeforeTemplate
|
||||
Stream<V> before(Stream<T> stream, Map<K, V> map) {
|
||||
return stream.filter(map::containsKey).map(map::get);
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
Stream<V> after(Stream<T> stream, Map<K, V> map) {
|
||||
return stream.map(map::get).filter(Objects::nonNull);
|
||||
}
|
||||
}
|
||||
|
||||
static final class StreamMin<T> {
|
||||
@BeforeTemplate
|
||||
@SuppressWarnings("java:S4266" /* This violation will be rewritten. */)
|
||||
|
||||
@@ -9,12 +9,10 @@ import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.base.Utf8;
|
||||
import com.google.common.collect.Streams;
|
||||
import com.google.errorprone.annotations.FormatMethod;
|
||||
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 com.google.errorprone.refaster.annotation.Repeated;
|
||||
import com.google.errorprone.refaster.annotation.UseImportPolicy;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -31,14 +29,11 @@ final class StringRules {
|
||||
private StringRules() {}
|
||||
|
||||
/** Prefer {@link String#isEmpty()} over alternatives that consult the string's length. */
|
||||
// XXX: Drop this rule once we (and OpenRewrite) no longer support projects targeting Java 14 or
|
||||
// below. The `CharSequenceIsEmpty` rule then suffices. (This rule exists so that e.g. projects
|
||||
// that target JDK 11 can disable `CharSequenceIsEmpty` without losing a valuable rule.)
|
||||
// XXX: Look into a more general approach to supporting different Java language levels, such as
|
||||
// rule selection based on some annotation, or a separate Maven module.
|
||||
// XXX: Now that we build with JDK 15+, this rule can be generalized to cover all `CharSequence`
|
||||
// subtypes. This does require a mechanism (perhaps an annotation, or a separate Maven module) to
|
||||
// make sure that non-String expressions are rewritten only if client code also targets JDK 15+.
|
||||
static final class StringIsEmpty {
|
||||
@BeforeTemplate
|
||||
@SuppressWarnings("CharSequenceIsEmpty" /* This is a more specific template. */)
|
||||
boolean before(String str) {
|
||||
return Refaster.anyOf(str.length() == 0, str.length() <= 0, str.length() < 1);
|
||||
}
|
||||
@@ -350,23 +345,4 @@ final class StringRules {
|
||||
return string.startsWith(prefix, fromIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prefer {@link String#formatted(Object...)} over {@link String#format(String, Object...)}, as
|
||||
* the former works more nicely with text blocks, while the latter does not appear advantageous in
|
||||
* any circumstance (assuming one targets JDK 15+).
|
||||
*/
|
||||
static final class StringFormatted {
|
||||
@BeforeTemplate
|
||||
@FormatMethod
|
||||
String before(String format, @Repeated Object args) {
|
||||
return String.format(format, args);
|
||||
}
|
||||
|
||||
@AfterTemplate
|
||||
@FormatMethod
|
||||
String after(String format, @Repeated Object args) {
|
||||
return format.formatted(args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ final class ClassCastLambdaUsageTest {
|
||||
"import java.util.stream.Stream;",
|
||||
"",
|
||||
"class A {",
|
||||
" <T> void m() {",
|
||||
" void m() {",
|
||||
" Number localVariable = 0;",
|
||||
"",
|
||||
" Stream.of(0).map(i -> i);",
|
||||
@@ -32,14 +32,13 @@ final class ClassCastLambdaUsageTest {
|
||||
" i -> {",
|
||||
" return (Integer) i;",
|
||||
" });",
|
||||
" Stream.<ImmutableSet>of(ImmutableSet.of(6)).map(s -> (ImmutableSet<Number>) s);",
|
||||
" Stream.of(ImmutableSet.of(7)).map(s -> (ImmutableSet<?>) s);",
|
||||
" Stream.of(8).reduce((a, b) -> (Integer) a);",
|
||||
" IntStream.of(9).mapToObj(i -> (char) i);",
|
||||
" Stream.of(10).map(i -> (T) i);",
|
||||
" Stream.<ImmutableSet>of(ImmutableSet.of(5)).map(s -> (ImmutableSet<Number>) s);",
|
||||
" Stream.of(ImmutableSet.of(6)).map(s -> (ImmutableSet<?>) s);",
|
||||
" Stream.of(7).reduce((a, b) -> (Integer) a);",
|
||||
" IntStream.of(8).mapToObj(i -> (char) i);",
|
||||
"",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" Stream.of(11).map(i -> (Integer) i);",
|
||||
" Stream.of(8).map(i -> (Integer) i);",
|
||||
" }",
|
||||
"}")
|
||||
.doTest();
|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
package tech.picnic.errorprone.bugpatterns;
|
||||
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper;
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;
|
||||
import com.google.errorprone.CompilationTestHelper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
final class ExplicitArgumentEnumerationTest {
|
||||
@Test
|
||||
void identification() {
|
||||
CompilationTestHelper.newInstance(ExplicitArgumentEnumeration.class, getClass())
|
||||
.addSourceLines(
|
||||
"A.java",
|
||||
"import static org.assertj.core.api.Assertions.assertThat;",
|
||||
"",
|
||||
"import com.google.common.collect.ImmutableList;",
|
||||
"import com.google.errorprone.CompilationTestHelper;",
|
||||
"import com.google.errorprone.bugpatterns.BugChecker;",
|
||||
"import org.jooq.impl.DSL;",
|
||||
"import reactor.core.publisher.Flux;",
|
||||
"import reactor.test.StepVerifier;",
|
||||
"",
|
||||
"class A {",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" private final int value = unaryMethod(ImmutableList.of(1, 2));",
|
||||
"",
|
||||
" void m() {",
|
||||
" ImmutableList<String> list = ImmutableList.of();",
|
||||
" assertThat(ImmutableList.of()).containsAnyElementsOf(list);",
|
||||
"",
|
||||
" ImmutableList.<ImmutableList<String>>builder().add(ImmutableList.of());",
|
||||
"",
|
||||
" DSL.row(ImmutableList.of(1, 2));",
|
||||
"",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" unaryMethod(ImmutableList.of(1, 2));",
|
||||
" unaryMethodWithLessVisibleOverload(ImmutableList.of(1, 2));",
|
||||
" binaryMethod(ImmutableList.of(1, 2), 3);",
|
||||
"",
|
||||
" ImmutableList.builder()",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" .addAll(ImmutableList.of())",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" .addAll(ImmutableList.copyOf(new String[0]))",
|
||||
" .addAll(ImmutableList.copyOf(ImmutableList.of()))",
|
||||
" .build();",
|
||||
"",
|
||||
" assertThat(ImmutableList.of(1))",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" .containsAnyElementsOf(ImmutableList.of(1))",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" .isSubsetOf(ImmutableList.of(1));",
|
||||
"",
|
||||
" Flux.just(1, 2)",
|
||||
" .as(StepVerifier::create)",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" .expectNextSequence(ImmutableList.of(1, 2))",
|
||||
" .verifyComplete();",
|
||||
"",
|
||||
" CompilationTestHelper.newInstance(BugChecker.class, getClass())",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" .setArgs(ImmutableList.of(\"foo\"))",
|
||||
" .withClasspath();",
|
||||
" }",
|
||||
"",
|
||||
" private int unaryMethod(ImmutableList<Integer> args) {",
|
||||
" return 0;",
|
||||
" }",
|
||||
"",
|
||||
" private int unaryMethod(Integer... args) {",
|
||||
" return unaryMethod(ImmutableList.copyOf(args));",
|
||||
" }",
|
||||
"",
|
||||
" void unaryMethodWithLessVisibleOverload(ImmutableList<Integer> args) {}",
|
||||
"",
|
||||
" private void unaryMethodWithLessVisibleOverload(Integer... args) {",
|
||||
" unaryMethodWithLessVisibleOverload(ImmutableList.copyOf(args));",
|
||||
" }",
|
||||
"",
|
||||
" private void binaryMethod(ImmutableList<Integer> args, int extraArg) {}",
|
||||
"",
|
||||
" private void binaryMethod(Integer... args) {",
|
||||
" binaryMethod(ImmutableList.copyOf(args), 0);",
|
||||
" }",
|
||||
"}")
|
||||
.doTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
void replacement() {
|
||||
BugCheckerRefactoringTestHelper.newInstance(ExplicitArgumentEnumeration.class, getClass())
|
||||
.addInputLines(
|
||||
"A.java",
|
||||
"import static org.assertj.core.api.Assertions.assertThat;",
|
||||
"",
|
||||
"import com.google.common.collect.ImmutableList;",
|
||||
"import com.google.common.collect.ImmutableMultiset;",
|
||||
"import com.google.common.collect.ImmutableSet;",
|
||||
"import com.google.errorprone.BugCheckerRefactoringTestHelper;",
|
||||
"import com.google.errorprone.CompilationTestHelper;",
|
||||
"import com.google.errorprone.bugpatterns.BugChecker;",
|
||||
"import java.util.Arrays;",
|
||||
"import java.util.List;",
|
||||
"import java.util.Set;",
|
||||
"import reactor.core.publisher.Flux;",
|
||||
"import reactor.test.StepVerifier;",
|
||||
"",
|
||||
"class A {",
|
||||
" void m() {",
|
||||
" ImmutableList.builder().addAll(ImmutableList.of()).build();",
|
||||
"",
|
||||
" assertThat(ImmutableList.of()).containsAnyElementsOf(ImmutableMultiset.of());",
|
||||
" assertThat(ImmutableList.of()).containsAll(ImmutableSet.of());",
|
||||
" assertThat(ImmutableList.of()).containsExactlyElementsOf(List.of());",
|
||||
" assertThat(ImmutableList.of()).containsExactlyInAnyOrderElementsOf(Set.of());",
|
||||
" assertThat(ImmutableList.of()).containsSequence(Arrays.asList());",
|
||||
" assertThat(ImmutableList.of()).containsSubsequence(ImmutableList.of(1));",
|
||||
" assertThat(ImmutableList.of()).doesNotContainAnyElementsOf(ImmutableMultiset.of(2));",
|
||||
" assertThat(ImmutableList.of()).doesNotContainSequence(ImmutableSet.of(3));",
|
||||
" assertThat(ImmutableList.of()).doesNotContainSubsequence(List.of(4));",
|
||||
" assertThat(ImmutableList.of()).hasSameElementsAs(Set.of(5));",
|
||||
" assertThat(ImmutableList.of()).isSubsetOf(Arrays.asList(6));",
|
||||
"",
|
||||
" Flux.empty()",
|
||||
" .as(StepVerifier::create)",
|
||||
" .expectNextSequence(ImmutableList.of(1, 2))",
|
||||
" .verifyComplete();",
|
||||
"",
|
||||
" BugCheckerRefactoringTestHelper.newInstance(BugChecker.class, getClass())",
|
||||
" .setArgs(ImmutableList.of(\"foo\", \"bar\"));",
|
||||
" CompilationTestHelper.newInstance(BugChecker.class, getClass())",
|
||||
" .setArgs(ImmutableList.of(\"foo\", \"bar\"));",
|
||||
" }",
|
||||
"}")
|
||||
.addOutputLines(
|
||||
"A.java",
|
||||
"import static org.assertj.core.api.Assertions.assertThat;",
|
||||
"",
|
||||
"import com.google.common.collect.ImmutableList;",
|
||||
"import com.google.common.collect.ImmutableMultiset;",
|
||||
"import com.google.common.collect.ImmutableSet;",
|
||||
"import com.google.errorprone.BugCheckerRefactoringTestHelper;",
|
||||
"import com.google.errorprone.CompilationTestHelper;",
|
||||
"import com.google.errorprone.bugpatterns.BugChecker;",
|
||||
"import java.util.Arrays;",
|
||||
"import java.util.List;",
|
||||
"import java.util.Set;",
|
||||
"import reactor.core.publisher.Flux;",
|
||||
"import reactor.test.StepVerifier;",
|
||||
"",
|
||||
"class A {",
|
||||
" void m() {",
|
||||
" ImmutableList.builder().add().build();",
|
||||
"",
|
||||
" assertThat(ImmutableList.of()).containsAnyOf();",
|
||||
" assertThat(ImmutableList.of()).contains();",
|
||||
" assertThat(ImmutableList.of()).containsExactly();",
|
||||
" assertThat(ImmutableList.of()).containsExactlyInAnyOrder();",
|
||||
" assertThat(ImmutableList.of()).containsSequence();",
|
||||
" assertThat(ImmutableList.of()).containsSubsequence(1);",
|
||||
" assertThat(ImmutableList.of()).doesNotContain(2);",
|
||||
" assertThat(ImmutableList.of()).doesNotContainSequence(3);",
|
||||
" assertThat(ImmutableList.of()).doesNotContainSubsequence(4);",
|
||||
" assertThat(ImmutableList.of()).containsOnly(5);",
|
||||
" assertThat(ImmutableList.of()).isSubsetOf(6);",
|
||||
"",
|
||||
" Flux.empty().as(StepVerifier::create).expectNext(1, 2).verifyComplete();",
|
||||
"",
|
||||
" BugCheckerRefactoringTestHelper.newInstance(BugChecker.class, getClass()).setArgs(\"foo\", \"bar\");",
|
||||
" CompilationTestHelper.newInstance(BugChecker.class, getClass()).setArgs(\"foo\", \"bar\");",
|
||||
" }",
|
||||
"}")
|
||||
.doTest(TestMode.TEXT_MATCH);
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ final class JUnitMethodDeclarationTest {
|
||||
CompilationTestHelper.newInstance(JUnitMethodDeclaration.class, getClass())
|
||||
.addSourceLines(
|
||||
"A.java",
|
||||
"import static org.junit.jupiter.params.provider.Arguments.*;",
|
||||
"import static org.junit.jupiter.params.provider.Arguments.arguments;",
|
||||
"",
|
||||
"import org.junit.jupiter.api.AfterAll;",
|
||||
"import org.junit.jupiter.api.AfterEach;",
|
||||
@@ -154,10 +154,8 @@ final class JUnitMethodDeclarationTest {
|
||||
" void overload() {}",
|
||||
"",
|
||||
" @Test",
|
||||
" // BUG: Diagnostic contains: (but note that another method named `arguments` is in scope)",
|
||||
" void testArguments() {",
|
||||
" arguments();",
|
||||
" }",
|
||||
" // BUG: Diagnostic contains: (but note that `arguments` is already statically imported)",
|
||||
" void testArguments() {}",
|
||||
"",
|
||||
" @Test",
|
||||
" // BUG: Diagnostic contains: (but note that `public` is not a valid identifier)",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package tech.picnic.errorprone.bugpatterns;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper;
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;
|
||||
import com.google.errorprone.CompilationTestHelper;
|
||||
@@ -293,8 +294,9 @@ final class LexicographicalAnnotationAttributeListingTest {
|
||||
/* Some violations are not flagged because they are not in- or excluded. */
|
||||
CompilationTestHelper.newInstance(LexicographicalAnnotationAttributeListing.class, getClass())
|
||||
.setArgs(
|
||||
"-XepOpt:LexicographicalAnnotationAttributeListing:Includes=pkg.A.Foo,pkg.A.Bar",
|
||||
"-XepOpt:LexicographicalAnnotationAttributeListing:Excludes=pkg.A.Bar#value")
|
||||
ImmutableList.of(
|
||||
"-XepOpt:LexicographicalAnnotationAttributeListing:Includes=pkg.A.Foo,pkg.A.Bar",
|
||||
"-XepOpt:LexicographicalAnnotationAttributeListing:Excludes=pkg.A.Bar#value"))
|
||||
.addSourceLines(
|
||||
"pkg/A.java",
|
||||
"package pkg;",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package tech.picnic.errorprone.bugpatterns;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper;
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;
|
||||
import com.google.errorprone.CompilationTestHelper;
|
||||
@@ -407,7 +408,8 @@ final class RedundantStringConversionTest {
|
||||
void identificationOfCustomConversionMethod() {
|
||||
CompilationTestHelper.newInstance(RedundantStringConversion.class, getClass())
|
||||
.setArgs(
|
||||
"-XepOpt:RedundantStringConversion:ExtraConversionMethods=java.lang.Enum#name(),A#name(),A.B#toString(int)")
|
||||
ImmutableList.of(
|
||||
"-XepOpt:RedundantStringConversion:ExtraConversionMethods=java.lang.Enum#name(),A#name(),A.B#toString(int)"))
|
||||
.addSourceLines(
|
||||
"A.java",
|
||||
"import java.math.RoundingMode;",
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
package tech.picnic.errorprone.bugpatterns;
|
||||
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper;
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;
|
||||
import com.google.errorprone.CompilationTestHelper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
final class RedundantStringEscapeTest {
|
||||
@Test
|
||||
void identification() {
|
||||
CompilationTestHelper.newInstance(RedundantStringEscape.class, getClass())
|
||||
.addSourceLines(
|
||||
"A.java",
|
||||
"import java.util.Arrays;",
|
||||
"import java.util.List;",
|
||||
"",
|
||||
"class A {",
|
||||
" List<String> m() {",
|
||||
" return Arrays.asList(",
|
||||
" \"foo\",",
|
||||
" \"ß\",",
|
||||
" \"'\",",
|
||||
" \"\\\"\",",
|
||||
" \"\\\\\",",
|
||||
" \"\\\\'\",",
|
||||
" \"'\\\\\",",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" \"\\\\\\'\",",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" \"\\'\\\\\",",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" \"\\'\",",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" \"'\\'\",",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" \"\\''\",",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" \"\\'\\'\",",
|
||||
" (",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" /* Leading comment. */ \"\\'\" /* Trailing comment. */),",
|
||||
" // BUG: Diagnostic contains:",
|
||||
" \"\\'foo\\\"bar\\'baz\\\"qux\\'\");",
|
||||
" }",
|
||||
"}")
|
||||
.doTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
void replacement() {
|
||||
BugCheckerRefactoringTestHelper.newInstance(RedundantStringEscape.class, getClass())
|
||||
.addInputLines(
|
||||
"A.java",
|
||||
"import java.util.Arrays;",
|
||||
"import java.util.List;",
|
||||
"",
|
||||
"class A {",
|
||||
" List<String> m() {",
|
||||
" return Arrays.asList(",
|
||||
" \"\\'\",",
|
||||
" \"'\\'\",",
|
||||
" \"\\''\",",
|
||||
" \"\\'\\'\",",
|
||||
" \"\\'ß\\'\",",
|
||||
" (",
|
||||
" /* Leading comment. */ \"\\'\" /* Trailing comment. */),",
|
||||
" \"\\'foo\\\"bar\\'baz\\\"qux\\'\");",
|
||||
" }",
|
||||
"}")
|
||||
.addOutputLines(
|
||||
"A.java",
|
||||
"import java.util.Arrays;",
|
||||
"import java.util.List;",
|
||||
"",
|
||||
"class A {",
|
||||
" List<String> m() {",
|
||||
" return Arrays.asList(",
|
||||
" \"'\",",
|
||||
" \"''\",",
|
||||
" \"''\",",
|
||||
" \"''\",",
|
||||
" \"'ß'\",",
|
||||
" (",
|
||||
" /* Leading comment. */ \"'\" /* Trailing comment. */),",
|
||||
" \"'foo\\\"bar'baz\\\"qux'\");",
|
||||
" }",
|
||||
"}")
|
||||
.doTest(TestMode.TEXT_MATCH);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package tech.picnic.errorprone.bugpatterns;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper;
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;
|
||||
import com.google.errorprone.CompilationTestHelper;
|
||||
@@ -188,7 +189,7 @@ final class Slf4jLoggerDeclarationTest {
|
||||
@Test
|
||||
void replacementWithCustomLoggerName() {
|
||||
BugCheckerRefactoringTestHelper.newInstance(Slf4jLoggerDeclaration.class, getClass())
|
||||
.setArgs("-XepOpt:Slf4jLoggerDeclaration:CanonicalStaticLoggerName=FOO_BAR")
|
||||
.setArgs(ImmutableList.of("-XepOpt:Slf4jLogDeclaration:CanonicalStaticLoggerName=FOO_BAR"))
|
||||
.addInputLines(
|
||||
"A.java",
|
||||
"import org.slf4j.Logger;",
|
||||
|
||||
@@ -36,7 +36,6 @@ final class RefasterRulesTest {
|
||||
AssortedRules.class,
|
||||
BigDecimalRules.class,
|
||||
BugCheckerRules.class,
|
||||
CharSequenceRules.class,
|
||||
ClassRules.class,
|
||||
CollectionRules.class,
|
||||
ComparatorRules.class,
|
||||
|
||||
@@ -33,14 +33,6 @@ final class AssertJStringRulesTest implements RefasterRuleCollectionTestCase {
|
||||
return assertThat("foo".isEmpty()).isFalse();
|
||||
}
|
||||
|
||||
AbstractAssert<?, ?> testAssertThatStringContains() {
|
||||
return assertThat("foo".contains("bar")).isTrue();
|
||||
}
|
||||
|
||||
AbstractAssert<?, ?> testAssertThatStringDoesNotContain() {
|
||||
return assertThat("foo".contains("bar")).isFalse();
|
||||
}
|
||||
|
||||
AbstractAssert<?, ?> testAssertThatMatches() {
|
||||
return assertThat("foo".matches(".*")).isTrue();
|
||||
}
|
||||
|
||||
@@ -34,14 +34,6 @@ final class AssertJStringRulesTest implements RefasterRuleCollectionTestCase {
|
||||
return assertThat("foo").isNotEmpty();
|
||||
}
|
||||
|
||||
AbstractAssert<?, ?> testAssertThatStringContains() {
|
||||
return assertThat("foo").contains("bar");
|
||||
}
|
||||
|
||||
AbstractAssert<?, ?> testAssertThatStringDoesNotContain() {
|
||||
return assertThat("foo").doesNotContain("bar");
|
||||
}
|
||||
|
||||
AbstractAssert<?, ?> testAssertThatMatches() {
|
||||
return assertThat("foo").matches(".*");
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
import static org.assertj.core.api.Assertions.assertThatNullPointerException;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
import static org.assertj.core.api.InstanceOfAssertFactories.throwable;
|
||||
import static org.assertj.core.api.InstanceOfAssertFactories.type;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import org.assertj.core.api.AbstractObjectAssert;
|
||||
@@ -22,13 +20,7 @@ final class AssertJThrowingCallableRulesTest implements RefasterRuleCollectionTe
|
||||
assertThatIOException(),
|
||||
assertThatIllegalArgumentException(),
|
||||
assertThatIllegalStateException(),
|
||||
assertThatNullPointerException(),
|
||||
type(Throwable.class));
|
||||
}
|
||||
|
||||
void testAssertThatThrownByIsInstanceOf() {
|
||||
assertThatThrownBy(() -> {}).asInstanceOf(throwable(IllegalArgumentException.class));
|
||||
assertThatThrownBy(() -> {}).asInstanceOf(type(IllegalArgumentException.class));
|
||||
assertThatNullPointerException());
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByIllegalArgumentException() {
|
||||
@@ -39,13 +31,6 @@ final class AssertJThrowingCallableRulesTest implements RefasterRuleCollectionTe
|
||||
return assertThatIllegalArgumentException().isThrownBy(() -> {}).withMessage("foo");
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByIllegalArgumentExceptionRootCauseHasMessage() {
|
||||
return assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> {})
|
||||
.havingRootCause()
|
||||
.withMessage("foo");
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByIllegalArgumentExceptionHasMessageParameters() {
|
||||
return assertThatIllegalArgumentException().isThrownBy(() -> {}).withMessage("foo %s", "bar");
|
||||
}
|
||||
@@ -74,13 +59,6 @@ final class AssertJThrowingCallableRulesTest implements RefasterRuleCollectionTe
|
||||
return assertThatIllegalStateException().isThrownBy(() -> {}).withMessage("foo");
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByIllegalStateExceptionRootCauseHasMessage() {
|
||||
return assertThatIllegalStateException()
|
||||
.isThrownBy(() -> {})
|
||||
.havingRootCause()
|
||||
.withMessage("foo");
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByIllegalStateExceptionHasMessageParameters() {
|
||||
return assertThatIllegalStateException().isThrownBy(() -> {}).withMessage("foo %s", "bar");
|
||||
}
|
||||
@@ -105,13 +83,6 @@ final class AssertJThrowingCallableRulesTest implements RefasterRuleCollectionTe
|
||||
return assertThatNullPointerException().isThrownBy(() -> {}).withMessage("foo");
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByNullPointerExceptionRootCauseHasMessage() {
|
||||
return assertThatNullPointerException()
|
||||
.isThrownBy(() -> {})
|
||||
.havingRootCause()
|
||||
.withMessage("foo");
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByNullPointerExceptionHasMessageParameters() {
|
||||
return assertThatNullPointerException().isThrownBy(() -> {}).withMessage("foo %s", "bar");
|
||||
}
|
||||
@@ -136,10 +107,6 @@ final class AssertJThrowingCallableRulesTest implements RefasterRuleCollectionTe
|
||||
return assertThatIOException().isThrownBy(() -> {}).withMessage("foo");
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByIOExceptionRootCauseHasMessage() {
|
||||
return assertThatIOException().isThrownBy(() -> {}).havingRootCause().withMessage("foo");
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByIOExceptionHasMessageParameters() {
|
||||
return assertThatIOException().isThrownBy(() -> {}).withMessage("foo %s", "bar");
|
||||
}
|
||||
@@ -156,7 +123,7 @@ final class AssertJThrowingCallableRulesTest implements RefasterRuleCollectionTe
|
||||
return assertThatIOException().isThrownBy(() -> {}).withMessageNotContaining("foo");
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByAsInstanceOfThrowable() {
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownBy() {
|
||||
return assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() -> {});
|
||||
}
|
||||
|
||||
@@ -166,13 +133,6 @@ final class AssertJThrowingCallableRulesTest implements RefasterRuleCollectionTe
|
||||
.withMessage("foo");
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByRootCauseHasMessage() {
|
||||
return assertThatExceptionOfType(IllegalArgumentException.class)
|
||||
.isThrownBy(() -> {})
|
||||
.havingRootCause()
|
||||
.withMessage("foo");
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByHasMessageParameters() {
|
||||
return assertThatExceptionOfType(IllegalArgumentException.class)
|
||||
.isThrownBy(() -> {})
|
||||
|
||||
@@ -6,8 +6,6 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
import static org.assertj.core.api.Assertions.assertThatNullPointerException;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
import static org.assertj.core.api.InstanceOfAssertFactories.throwable;
|
||||
import static org.assertj.core.api.InstanceOfAssertFactories.type;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import java.io.IOException;
|
||||
@@ -23,13 +21,7 @@ final class AssertJThrowingCallableRulesTest implements RefasterRuleCollectionTe
|
||||
assertThatIOException(),
|
||||
assertThatIllegalArgumentException(),
|
||||
assertThatIllegalStateException(),
|
||||
assertThatNullPointerException(),
|
||||
type(Throwable.class));
|
||||
}
|
||||
|
||||
void testAssertThatThrownByIsInstanceOf() {
|
||||
assertThatThrownBy(() -> {}).isInstanceOf(IllegalArgumentException.class);
|
||||
assertThatThrownBy(() -> {}).isInstanceOf(IllegalArgumentException.class);
|
||||
assertThatNullPointerException());
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByIllegalArgumentException() {
|
||||
@@ -42,13 +34,6 @@ final class AssertJThrowingCallableRulesTest implements RefasterRuleCollectionTe
|
||||
.hasMessage("foo");
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByIllegalArgumentExceptionRootCauseHasMessage() {
|
||||
return assertThatThrownBy(() -> {})
|
||||
.isInstanceOf(IllegalArgumentException.class)
|
||||
.rootCause()
|
||||
.hasMessage("foo");
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByIllegalArgumentExceptionHasMessageParameters() {
|
||||
return assertThatThrownBy(() -> {})
|
||||
.isInstanceOf(IllegalArgumentException.class)
|
||||
@@ -83,13 +68,6 @@ final class AssertJThrowingCallableRulesTest implements RefasterRuleCollectionTe
|
||||
return assertThatThrownBy(() -> {}).isInstanceOf(IllegalStateException.class).hasMessage("foo");
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByIllegalStateExceptionRootCauseHasMessage() {
|
||||
return assertThatThrownBy(() -> {})
|
||||
.isInstanceOf(IllegalStateException.class)
|
||||
.rootCause()
|
||||
.hasMessage("foo");
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByIllegalStateExceptionHasMessageParameters() {
|
||||
return assertThatThrownBy(() -> {})
|
||||
.isInstanceOf(IllegalStateException.class)
|
||||
@@ -122,13 +100,6 @@ final class AssertJThrowingCallableRulesTest implements RefasterRuleCollectionTe
|
||||
return assertThatThrownBy(() -> {}).isInstanceOf(NullPointerException.class).hasMessage("foo");
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByNullPointerExceptionRootCauseHasMessage() {
|
||||
return assertThatThrownBy(() -> {})
|
||||
.isInstanceOf(NullPointerException.class)
|
||||
.rootCause()
|
||||
.hasMessage("foo");
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByNullPointerExceptionHasMessageParameters() {
|
||||
return assertThatThrownBy(() -> {})
|
||||
.isInstanceOf(NullPointerException.class)
|
||||
@@ -161,13 +132,6 @@ final class AssertJThrowingCallableRulesTest implements RefasterRuleCollectionTe
|
||||
return assertThatThrownBy(() -> {}).isInstanceOf(IOException.class).hasMessage("foo");
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByIOExceptionRootCauseHasMessage() {
|
||||
return assertThatThrownBy(() -> {})
|
||||
.isInstanceOf(IOException.class)
|
||||
.rootCause()
|
||||
.hasMessage("foo");
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByIOExceptionHasMessageParameters() {
|
||||
return assertThatThrownBy(() -> {}).isInstanceOf(IOException.class).hasMessage("foo %s", "bar");
|
||||
}
|
||||
@@ -188,8 +152,8 @@ final class AssertJThrowingCallableRulesTest implements RefasterRuleCollectionTe
|
||||
.hasMessageNotContaining("foo");
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByAsInstanceOfThrowable() {
|
||||
return assertThatThrownBy(() -> {}).asInstanceOf(throwable(IllegalArgumentException.class));
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownBy() {
|
||||
return assertThatThrownBy(() -> {}).isInstanceOf(IllegalArgumentException.class);
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByHasMessage() {
|
||||
@@ -198,13 +162,6 @@ final class AssertJThrowingCallableRulesTest implements RefasterRuleCollectionTe
|
||||
.hasMessage("foo");
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByRootCauseHasMessage() {
|
||||
return assertThatThrownBy(() -> {})
|
||||
.isInstanceOf(IllegalArgumentException.class)
|
||||
.rootCause()
|
||||
.hasMessage("foo");
|
||||
}
|
||||
|
||||
AbstractObjectAssert<?, ?> testAssertThatThrownByHasMessageParameters() {
|
||||
return assertThatThrownBy(() -> {})
|
||||
.isInstanceOf(IllegalArgumentException.class)
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.google.common.collect.ImmutableSet;
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper;
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper.FixChoosers;
|
||||
import com.google.errorprone.bugpatterns.BugChecker;
|
||||
import com.sun.tools.javac.util.Constants;
|
||||
import com.sun.tools.javac.util.Convert;
|
||||
import javax.lang.model.element.Name;
|
||||
import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
|
||||
@@ -12,7 +11,7 @@ import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
|
||||
final class BugCheckerRulesTest implements RefasterRuleCollectionTestCase {
|
||||
@Override
|
||||
public ImmutableSet<Object> elidedTypesAndStaticImports() {
|
||||
return ImmutableSet.of(Constants.class, Convert.class, FixChoosers.class);
|
||||
return ImmutableSet.of(Convert.class, FixChoosers.class);
|
||||
}
|
||||
|
||||
ImmutableSet<BugCheckerRefactoringTestHelper> testBugCheckerRefactoringTestHelperIdentity() {
|
||||
@@ -30,8 +29,8 @@ final class BugCheckerRulesTest implements RefasterRuleCollectionTestCase {
|
||||
.addOutputLines("A.java", "class A {}");
|
||||
}
|
||||
|
||||
ImmutableSet<String> testConstantsFormat() {
|
||||
return ImmutableSet.of(Constants.format("foo"), String.format("\"%s\"", Convert.quote("bar")));
|
||||
String testConstantsFormat() {
|
||||
return String.format("\"%s\"", Convert.quote("foo"));
|
||||
}
|
||||
|
||||
ImmutableSet<Boolean> testNameContentEquals() {
|
||||
|
||||
@@ -8,12 +8,11 @@ import com.sun.tools.javac.util.Constants;
|
||||
import com.sun.tools.javac.util.Convert;
|
||||
import javax.lang.model.element.Name;
|
||||
import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
|
||||
import tech.picnic.errorprone.utils.SourceCode;
|
||||
|
||||
final class BugCheckerRulesTest implements RefasterRuleCollectionTestCase {
|
||||
@Override
|
||||
public ImmutableSet<Object> elidedTypesAndStaticImports() {
|
||||
return ImmutableSet.of(Constants.class, Convert.class, FixChoosers.class);
|
||||
return ImmutableSet.of(Convert.class, FixChoosers.class);
|
||||
}
|
||||
|
||||
ImmutableSet<BugCheckerRefactoringTestHelper> testBugCheckerRefactoringTestHelperIdentity() {
|
||||
@@ -29,10 +28,8 @@ final class BugCheckerRulesTest implements RefasterRuleCollectionTestCase {
|
||||
.expectUnchanged();
|
||||
}
|
||||
|
||||
ImmutableSet<String> testConstantsFormat() {
|
||||
return ImmutableSet.of(
|
||||
SourceCode.toStringConstantExpression("foo", /* REPLACEME */ null),
|
||||
SourceCode.toStringConstantExpression("bar", /* REPLACEME */ null));
|
||||
String testConstantsFormat() {
|
||||
return Constants.format("foo");
|
||||
}
|
||||
|
||||
ImmutableSet<Boolean> testNameContentEquals() {
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package tech.picnic.errorprone.refasterrules;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
|
||||
|
||||
final class CharSequenceRulesTest implements RefasterRuleCollectionTestCase {
|
||||
ImmutableSet<Boolean> testCharSequenceIsEmpty() {
|
||||
return ImmutableSet.of(
|
||||
new StringBuilder("foo").length() == 0,
|
||||
new StringBuilder("bar").length() <= 0,
|
||||
new StringBuilder("baz").length() < 1,
|
||||
new StringBuilder("qux").length() != 0,
|
||||
new StringBuilder("quux").length() > 0,
|
||||
new StringBuilder("corge").length() >= 1);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package tech.picnic.errorprone.refasterrules;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import tech.picnic.errorprone.refaster.test.RefasterRuleCollectionTestCase;
|
||||
|
||||
final class CharSequenceRulesTest implements RefasterRuleCollectionTestCase {
|
||||
ImmutableSet<Boolean> testCharSequenceIsEmpty() {
|
||||
return ImmutableSet.of(
|
||||
new StringBuilder("foo").isEmpty(),
|
||||
new StringBuilder("bar").isEmpty(),
|
||||
new StringBuilder("baz").isEmpty(),
|
||||
!new StringBuilder("qux").isEmpty(),
|
||||
!new StringBuilder("quux").isEmpty(),
|
||||
!new StringBuilder("corge").isEmpty());
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,6 @@ final class ReactorRulesTest implements RefasterRuleCollectionTestCase {
|
||||
List.class,
|
||||
ImmutableCollection.class,
|
||||
ImmutableMap.class,
|
||||
assertThat(false),
|
||||
assertThat(0),
|
||||
maxBy(null),
|
||||
minBy(null),
|
||||
@@ -590,35 +589,6 @@ final class ReactorRulesTest implements RefasterRuleCollectionTestCase {
|
||||
return ImmutableSet.of(PublisherProbe.of(Mono.empty()), PublisherProbe.of(Flux.empty()));
|
||||
}
|
||||
|
||||
void testPublisherProbeAssertWasSubscribed() {
|
||||
assertThat(PublisherProbe.of(Mono.just(1)).wasSubscribed()).isTrue();
|
||||
assertThat(PublisherProbe.of(Mono.just(2)).subscribeCount()).isNotNegative();
|
||||
assertThat(PublisherProbe.of(Mono.just(3)).subscribeCount()).isNotEqualTo(0);
|
||||
assertThat(PublisherProbe.of(Mono.just(4)).subscribeCount()).isPositive();
|
||||
}
|
||||
|
||||
void testPublisherProbeAssertWasNotSubscribed() {
|
||||
assertThat(PublisherProbe.of(Mono.just(1)).wasSubscribed()).isFalse();
|
||||
assertThat(PublisherProbe.of(Mono.just(2)).subscribeCount()).isEqualTo(0);
|
||||
assertThat(PublisherProbe.of(Mono.just(3)).subscribeCount()).isNotPositive();
|
||||
}
|
||||
|
||||
void testPublisherProbeAssertWasCancelled() {
|
||||
assertThat(PublisherProbe.empty().wasCancelled()).isTrue();
|
||||
}
|
||||
|
||||
void testPublisherProbeAssertWasNotCancelled() {
|
||||
assertThat(PublisherProbe.empty().wasCancelled()).isFalse();
|
||||
}
|
||||
|
||||
void testPublisherProbeAssertWasRequested() {
|
||||
assertThat(PublisherProbe.empty().wasRequested()).isTrue();
|
||||
}
|
||||
|
||||
void testPublisherProbeAssertWasNotRequested() {
|
||||
assertThat(PublisherProbe.empty().wasRequested()).isFalse();
|
||||
}
|
||||
|
||||
ImmutableSet<StepVerifier.FirstStep<Integer>> testStepVerifierFromMono() {
|
||||
return ImmutableSet.of(
|
||||
StepVerifier.create(Mono.just(1)), Mono.just(2).flux().as(StepVerifier::create));
|
||||
|
||||
@@ -47,7 +47,6 @@ final class ReactorRulesTest implements RefasterRuleCollectionTestCase {
|
||||
List.class,
|
||||
ImmutableCollection.class,
|
||||
ImmutableMap.class,
|
||||
assertThat(false),
|
||||
assertThat(0),
|
||||
maxBy(null),
|
||||
minBy(null),
|
||||
@@ -578,35 +577,6 @@ final class ReactorRulesTest implements RefasterRuleCollectionTestCase {
|
||||
return ImmutableSet.of(PublisherProbe.empty(), PublisherProbe.empty());
|
||||
}
|
||||
|
||||
void testPublisherProbeAssertWasSubscribed() {
|
||||
PublisherProbe.of(Mono.just(1)).assertWasSubscribed();
|
||||
PublisherProbe.of(Mono.just(2)).assertWasSubscribed();
|
||||
PublisherProbe.of(Mono.just(3)).assertWasSubscribed();
|
||||
PublisherProbe.of(Mono.just(4)).assertWasSubscribed();
|
||||
}
|
||||
|
||||
void testPublisherProbeAssertWasNotSubscribed() {
|
||||
PublisherProbe.of(Mono.just(1)).assertWasNotSubscribed();
|
||||
PublisherProbe.of(Mono.just(2)).assertWasNotSubscribed();
|
||||
PublisherProbe.of(Mono.just(3)).assertWasNotSubscribed();
|
||||
}
|
||||
|
||||
void testPublisherProbeAssertWasCancelled() {
|
||||
PublisherProbe.empty().assertWasCancelled();
|
||||
}
|
||||
|
||||
void testPublisherProbeAssertWasNotCancelled() {
|
||||
PublisherProbe.empty().assertWasNotCancelled();
|
||||
}
|
||||
|
||||
void testPublisherProbeAssertWasRequested() {
|
||||
PublisherProbe.empty().assertWasRequested();
|
||||
}
|
||||
|
||||
void testPublisherProbeAssertWasNotRequested() {
|
||||
PublisherProbe.empty().assertWasNotRequested();
|
||||
}
|
||||
|
||||
ImmutableSet<StepVerifier.FirstStep<Integer>> testStepVerifierFromMono() {
|
||||
return ImmutableSet.of(
|
||||
Mono.just(1).as(StepVerifier::create), Mono.just(2).as(StepVerifier::create));
|
||||
|
||||
@@ -141,12 +141,6 @@ final class StreamRulesTest implements RefasterRuleCollectionTestCase {
|
||||
return Stream.of(1).findFirst().isPresent();
|
||||
}
|
||||
|
||||
Stream<Integer> testStreamMapFilter() {
|
||||
return Stream.of("foo")
|
||||
.filter(ImmutableMap.of(1, 2)::containsKey)
|
||||
.map(ImmutableMap.of(1, 2)::get);
|
||||
}
|
||||
|
||||
ImmutableSet<Optional<String>> testStreamMin() {
|
||||
return ImmutableSet.of(
|
||||
Stream.of("foo").max(comparingInt(String::length).reversed()),
|
||||
|
||||
@@ -141,10 +141,6 @@ final class StreamRulesTest implements RefasterRuleCollectionTestCase {
|
||||
return Stream.of(1).findAny().isPresent();
|
||||
}
|
||||
|
||||
Stream<Integer> testStreamMapFilter() {
|
||||
return Stream.of("foo").map(ImmutableMap.of(1, 2)::get).filter(Objects::nonNull);
|
||||
}
|
||||
|
||||
ImmutableSet<Optional<String>> testStreamMin() {
|
||||
return ImmutableSet.of(
|
||||
Stream.of("foo").min(comparingInt(String::length)),
|
||||
|
||||
@@ -28,9 +28,9 @@ final class StringRulesTest implements RefasterRuleCollectionTestCase {
|
||||
"foo".length() == 0,
|
||||
"bar".length() <= 0,
|
||||
"baz".length() < 1,
|
||||
"qux".length() != 0,
|
||||
"quux".length() > 0,
|
||||
"corge".length() >= 1);
|
||||
"foo".length() != 0,
|
||||
"bar".length() > 0,
|
||||
"baz".length() >= 1);
|
||||
}
|
||||
|
||||
boolean testStringIsEmptyPredicate() {
|
||||
@@ -124,8 +124,4 @@ final class StringRulesTest implements RefasterRuleCollectionTestCase {
|
||||
boolean testStringStartsWith() {
|
||||
return "foo".substring(1).startsWith("bar");
|
||||
}
|
||||
|
||||
String testStringFormatted() {
|
||||
return String.format("%s%s", "foo", "bar");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,9 +31,9 @@ final class StringRulesTest implements RefasterRuleCollectionTestCase {
|
||||
"foo".isEmpty(),
|
||||
"bar".isEmpty(),
|
||||
"baz".isEmpty(),
|
||||
!"qux".isEmpty(),
|
||||
!"quux".isEmpty(),
|
||||
!"corge".isEmpty());
|
||||
!"foo".isEmpty(),
|
||||
!"bar".isEmpty(),
|
||||
!"baz".isEmpty());
|
||||
}
|
||||
|
||||
boolean testStringIsEmptyPredicate() {
|
||||
@@ -124,8 +124,4 @@ final class StringRulesTest implements RefasterRuleCollectionTestCase {
|
||||
boolean testStringStartsWith() {
|
||||
return "foo".startsWith("bar", 1);
|
||||
}
|
||||
|
||||
String testStringFormatted() {
|
||||
return "%s%s".formatted("foo", "bar");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,8 +30,8 @@ import com.sun.source.tree.BinaryTree;
|
||||
import com.sun.source.tree.ClassTree;
|
||||
import com.sun.source.tree.ExpressionTree;
|
||||
import com.sun.source.tree.Tree.Kind;
|
||||
import com.sun.tools.javac.util.Constants;
|
||||
import javax.lang.model.element.Name;
|
||||
import tech.picnic.errorprone.utils.SourceCode;
|
||||
|
||||
/**
|
||||
* A {@link BugChecker} that flags {@link BugChecker} declarations inside {@code
|
||||
@@ -126,9 +126,7 @@ public final class BugPatternLink extends BugChecker implements ClassTreeMatcher
|
||||
state,
|
||||
"link",
|
||||
ImmutableList.of(
|
||||
linkPrefix
|
||||
+ " + "
|
||||
+ SourceCode.toStringConstantExpression(tree.getSimpleName(), state))));
|
||||
linkPrefix + " + " + Constants.format(tree.getSimpleName().toString()))));
|
||||
|
||||
String linkType =
|
||||
SuggestedFixes.qualifyStaticImport(
|
||||
|
||||
@@ -26,8 +26,8 @@ import com.sun.source.tree.LiteralTree;
|
||||
import com.sun.source.tree.MethodInvocationTree;
|
||||
import com.sun.tools.javac.code.Symbol;
|
||||
import com.sun.tools.javac.code.Symbol.ClassSymbol;
|
||||
import com.sun.tools.javac.util.Constants;
|
||||
import java.util.regex.Pattern;
|
||||
import tech.picnic.errorprone.utils.SourceCode;
|
||||
import tech.picnic.errorprone.utils.ThirdPartyLibrary;
|
||||
|
||||
/**
|
||||
@@ -123,8 +123,7 @@ public final class ErrorProneRuntimeClasspath extends BugChecker
|
||||
.setMessage("This type may not be on the runtime classpath; use a string literal instead")
|
||||
.addFix(
|
||||
SuggestedFix.replace(
|
||||
tree,
|
||||
SourceCode.toStringConstantExpression(receiver.owner.getQualifiedName(), state)))
|
||||
tree, Constants.format(receiver.owner.getQualifiedName().toString())))
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -151,9 +150,7 @@ public final class ErrorProneRuntimeClasspath extends BugChecker
|
||||
original,
|
||||
identifier
|
||||
+ ".class.getCanonicalName()"
|
||||
+ (suffix.isEmpty()
|
||||
? ""
|
||||
: (" + " + SourceCode.toStringConstantExpression(suffix, state))))
|
||||
+ (suffix.isEmpty() ? "" : (" + " + Constants.format(suffix))))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.sun.tools.javac.code.Attribute;
|
||||
import com.sun.tools.javac.code.Symbol.ClassSymbol;
|
||||
import com.sun.tools.javac.code.Symbol.MethodSymbol;
|
||||
import com.sun.tools.javac.code.Symbol.TypeSymbol;
|
||||
import com.sun.tools.javac.util.Constants;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -48,7 +49,6 @@ import javax.lang.model.element.AnnotationMirror;
|
||||
import javax.lang.model.element.AnnotationValue;
|
||||
import javax.lang.model.element.Modifier;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import tech.picnic.errorprone.utils.SourceCode;
|
||||
|
||||
/**
|
||||
* A {@link BugChecker} that validates the claim made by {@link
|
||||
@@ -129,9 +129,7 @@ public final class ExhaustiveRefasterTypeMigration extends BugChecker implements
|
||||
migrationAnnotation,
|
||||
state,
|
||||
TYPE_MIGRATION_UNMIGRATED_METHODS_ELEMENT,
|
||||
unmigratedMethods.stream()
|
||||
.map(m -> SourceCode.toStringConstantExpression(m, state))
|
||||
.collect(toImmutableList()))
|
||||
unmigratedMethods.stream().map(Constants::format).collect(toImmutableList()))
|
||||
.build());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
package tech.picnic.errorprone.utils;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static tech.picnic.errorprone.utils.JavaKeywords.isValidIdentifier;
|
||||
|
||||
import com.google.errorprone.VisitorState;
|
||||
import com.google.errorprone.util.ASTHelpers;
|
||||
import com.sun.source.tree.ClassTree;
|
||||
import com.sun.source.tree.IdentifierTree;
|
||||
import com.sun.source.tree.MethodInvocationTree;
|
||||
import com.sun.source.util.TreeScanner;
|
||||
import com.sun.source.tree.ImportTree;
|
||||
import com.sun.source.tree.Tree;
|
||||
import com.sun.tools.javac.code.Symbol.MethodSymbol;
|
||||
import com.sun.tools.javac.code.Type;
|
||||
import java.util.Optional;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/** A set of helper methods for detecting conflicts that would be caused when applying fixes. */
|
||||
public final class ConflictDetection {
|
||||
@@ -27,10 +24,9 @@ public final class ConflictDetection {
|
||||
* <ul>
|
||||
* <li>Whether the rename would merely introduce a method overload, rather than clashing with an
|
||||
* existing method declaration in its class or a supertype.
|
||||
* <li>Whether the rename would in fact change the target of an existing method invocation in
|
||||
* the scope of its containing class. (It could e.g. be that said invocation targets an
|
||||
* identically-named method with different parameter types in some non-static nested type
|
||||
* declaration.)
|
||||
* <li>Whether the rename would in fact clash with a static import. (It could be that a static
|
||||
* import of the same name is only referenced from lexical scopes in which the method under
|
||||
* consideration cannot be referenced directly.)
|
||||
* </ul>
|
||||
*
|
||||
* @param method The method considered for renaming.
|
||||
@@ -47,11 +43,11 @@ public final class ConflictDetection {
|
||||
"a method named `%s` is already defined in this class or a supertype", newName));
|
||||
}
|
||||
|
||||
if (isLocalMethodInvocation(newName, state)) {
|
||||
return Optional.of(String.format("another method named `%s` is in scope", newName));
|
||||
if (isSimpleNameStaticallyImported(newName, state)) {
|
||||
return Optional.of(String.format("`%s` is already statically imported", newName));
|
||||
}
|
||||
|
||||
if (!SourceCode.isValidIdentifier(newName)) {
|
||||
if (!isValidIdentifier(newName)) {
|
||||
return Optional.of(String.format("`%s` is not a valid identifier", newName));
|
||||
}
|
||||
|
||||
@@ -64,35 +60,16 @@ public final class ConflictDetection {
|
||||
.isPresent();
|
||||
}
|
||||
|
||||
private static boolean isLocalMethodInvocation(String name, VisitorState state) {
|
||||
return Boolean.TRUE.equals(
|
||||
new TreeScanner<Boolean, @Nullable Void>() {
|
||||
@Override
|
||||
public Boolean visitClass(ClassTree tree, @Nullable Void unused) {
|
||||
if (ASTHelpers.getSymbol(tree).isStatic()) {
|
||||
/*
|
||||
* Don't descend into static type definitions: in those context, any unqualified
|
||||
* method invocation cannot refer to a method in the outer scope.
|
||||
*/
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
private static boolean isSimpleNameStaticallyImported(String simpleName, VisitorState state) {
|
||||
return state.getPath().getCompilationUnit().getImports().stream()
|
||||
.filter(ImportTree::isStatic)
|
||||
.map(ImportTree::getQualifiedIdentifier)
|
||||
.map(tree -> getStaticImportSimpleName(tree, state))
|
||||
.anyMatch(simpleName::contentEquals);
|
||||
}
|
||||
|
||||
return super.visitClass(tree, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean visitMethodInvocation(MethodInvocationTree tree, @Nullable Void unused) {
|
||||
return (tree.getMethodSelect() instanceof IdentifierTree identifier
|
||||
&& name.contentEquals(identifier.getName()))
|
||||
|| super.visitMethodInvocation(tree, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean reduce(Boolean r1, Boolean r2) {
|
||||
return Boolean.TRUE.equals(r1) || Boolean.TRUE.equals(r2);
|
||||
}
|
||||
}.scan(
|
||||
requireNonNull(state.findEnclosing(ClassTree.class), "No enclosing class").getMembers(),
|
||||
null));
|
||||
private static CharSequence getStaticImportSimpleName(Tree tree, VisitorState state) {
|
||||
String source = SourceCode.treeToString(tree, state);
|
||||
return source.subSequence(source.lastIndexOf('.') + 1, source.length());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
package tech.picnic.errorprone.utils;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/** Utility class that can be used to identify reserved keywords of the Java language. */
|
||||
// XXX: This class is no longer only about keywords. Consider changing its name and class-level
|
||||
// documentation.
|
||||
public final class JavaKeywords {
|
||||
/**
|
||||
* Enumeration of boolean and null literals.
|
||||
*
|
||||
* @see <a href="https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.10.3">JDK 17
|
||||
* JLS section 3.10.3: Boolean Literals</a>
|
||||
* @see <a href="https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.10.8">JDK 17
|
||||
* JLS section 3.10.8: The Null Literal</a>
|
||||
*/
|
||||
private static final ImmutableSet<String> BOOLEAN_AND_NULL_LITERALS =
|
||||
ImmutableSet.of("true", "false", "null");
|
||||
|
||||
/**
|
||||
* List of all reserved keywords in the Java language.
|
||||
*
|
||||
* @see <a href="https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.9">JDK 17 JLS
|
||||
* section 3.9: Keywords</a>
|
||||
*/
|
||||
private static final ImmutableSet<String> RESERVED_KEYWORDS =
|
||||
ImmutableSet.of(
|
||||
"_",
|
||||
"abstract",
|
||||
"assert",
|
||||
"boolean",
|
||||
"break",
|
||||
"byte",
|
||||
"case",
|
||||
"catch",
|
||||
"char",
|
||||
"class",
|
||||
"const",
|
||||
"continue",
|
||||
"default",
|
||||
"do",
|
||||
"double",
|
||||
"else",
|
||||
"enum",
|
||||
"extends",
|
||||
"final",
|
||||
"finally",
|
||||
"float",
|
||||
"for",
|
||||
"goto",
|
||||
"if",
|
||||
"implements",
|
||||
"import",
|
||||
"instanceof",
|
||||
"int",
|
||||
"interface",
|
||||
"long",
|
||||
"native",
|
||||
"new",
|
||||
"package",
|
||||
"private",
|
||||
"protected",
|
||||
"public",
|
||||
"return",
|
||||
"short",
|
||||
"static",
|
||||
"strictfp",
|
||||
"super",
|
||||
"switch",
|
||||
"synchronized",
|
||||
"this",
|
||||
"throw",
|
||||
"throws",
|
||||
"transient",
|
||||
"try",
|
||||
"void",
|
||||
"volatile",
|
||||
"while");
|
||||
|
||||
/**
|
||||
* List of all contextual keywords in the Java language.
|
||||
*
|
||||
* @see <a href="https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.9">JDK 17 JLS
|
||||
* section 3.9: Keywords</a>
|
||||
*/
|
||||
private static final ImmutableSet<String> CONTEXTUAL_KEYWORDS =
|
||||
ImmutableSet.of(
|
||||
"exports",
|
||||
"module",
|
||||
"non-sealed",
|
||||
"open",
|
||||
"opens",
|
||||
"permits",
|
||||
"provides",
|
||||
"record",
|
||||
"requires",
|
||||
"sealed",
|
||||
"to",
|
||||
"transitive",
|
||||
"uses",
|
||||
"var",
|
||||
"with",
|
||||
"yield");
|
||||
|
||||
/** List of all keywords in the Java language. */
|
||||
private static final ImmutableSet<String> ALL_KEYWORDS =
|
||||
Sets.union(RESERVED_KEYWORDS, CONTEXTUAL_KEYWORDS).immutableCopy();
|
||||
|
||||
private JavaKeywords() {}
|
||||
|
||||
/**
|
||||
* Tells whether the given string is a valid identifier in the Java language.
|
||||
*
|
||||
* @param str The string of interest.
|
||||
* @return {@code true} if the given string is a valid identifier in the Java language.
|
||||
* @see <a href="https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.8">JDK 17 JLS
|
||||
* section 3.8: Identifiers</a>
|
||||
*/
|
||||
@SuppressWarnings("java:S1067" /* Chaining conjunctions like this does not impact readability. */)
|
||||
public static boolean isValidIdentifier(String str) {
|
||||
return !str.isEmpty()
|
||||
&& !isReservedKeyword(str)
|
||||
&& !BOOLEAN_AND_NULL_LITERALS.contains(str)
|
||||
&& Character.isJavaIdentifierStart(str.codePointAt(0))
|
||||
&& str.codePoints().skip(1).allMatch(Character::isUnicodeIdentifierPart);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells whether the given string is a reserved keyword in the Java language.
|
||||
*
|
||||
* @param str The string of interest.
|
||||
* @return {@code true} if the given string is a reserved keyword in the Java language.
|
||||
*/
|
||||
public static boolean isReservedKeyword(String str) {
|
||||
return RESERVED_KEYWORDS.contains(str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells whether the given string is a contextual keyword in the Java language.
|
||||
*
|
||||
* @param str The string of interest.
|
||||
* @return {@code true} if the given string is a contextual keyword in the Java language.
|
||||
*/
|
||||
public static boolean isContextualKeyword(String str) {
|
||||
return CONTEXTUAL_KEYWORDS.contains(str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells whether the given string is a reserved or contextual keyword in the Java language.
|
||||
*
|
||||
* @param str The string of interest.
|
||||
* @return {@code true} if the given string is a reserved or contextual keyword in the Java
|
||||
* language.
|
||||
*/
|
||||
public static boolean isKeyword(String str) {
|
||||
return ALL_KEYWORDS.contains(str);
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@ import com.sun.source.tree.Tree;
|
||||
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
|
||||
import com.sun.tools.javac.util.Position;
|
||||
import java.util.Optional;
|
||||
import javax.lang.model.SourceVersion;
|
||||
|
||||
/**
|
||||
* A collection of Error Prone utility methods for dealing with the source code representation of
|
||||
@@ -29,18 +28,6 @@ public final class SourceCode {
|
||||
|
||||
private SourceCode() {}
|
||||
|
||||
/**
|
||||
* Tells whether the given string is a valid identifier in the Java language.
|
||||
*
|
||||
* @param str The string of interest.
|
||||
* @return {@code true} if the given string is a valid identifier in the Java language.
|
||||
* @see <a href="https://docs.oracle.com/javase/specs/jls/se17/html/jls-3.html#jls-3.8">JDK 17 JLS
|
||||
* section 3.8: Identifiers</a>
|
||||
*/
|
||||
public static boolean isValidIdentifier(String str) {
|
||||
return str.indexOf('.') < 0 && SourceVersion.isName(str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of the given {@link Tree}, preferring the original source code
|
||||
* (if available) over its prettified representation.
|
||||
@@ -55,24 +42,6 @@ public final class SourceCode {
|
||||
return src != null ? src : tree.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Java string constant expression (i.e., a quoted string) representing the given input.
|
||||
*
|
||||
* @param value The value of interest.
|
||||
* @param state A {@link VisitorState} describing the context in which the given {@link Tree} is
|
||||
* found.
|
||||
* @return A non-{@code null} string.
|
||||
* @apiNote This method differs from {@link com.sun.tools.javac.util.Constants#format(Object)} in
|
||||
* that it does not superfluously escape single quote characters. It is different from {@link
|
||||
* VisitorState#getConstantExpression(Object)} in that it is more performant and accepts any
|
||||
* {@link CharSequence} instance.
|
||||
*/
|
||||
// XXX: Drop this method if https://github.com/google/error-prone/pull/4586 is merged and released
|
||||
// with the proposed `CharSequence` compatibility change.
|
||||
public static String toStringConstantExpression(Object value, VisitorState state) {
|
||||
return state.getConstantExpression(value instanceof CharSequence ? value.toString() : value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link SuggestedFix} for the deletion of the given {@link Tree}, including any
|
||||
* whitespace that follows it.
|
||||
|
||||
@@ -21,13 +21,13 @@ final class ConflictDetectionTest {
|
||||
"pkg/A.java",
|
||||
"package pkg;",
|
||||
"",
|
||||
"import static pkg.A.StaticType.method3t;",
|
||||
"import static pkg.A.StaticType.method4t;",
|
||||
"import static pkg.A.B.method3t;",
|
||||
"",
|
||||
"import pkg.A.method4t;",
|
||||
"",
|
||||
"class A {",
|
||||
" void method1() {",
|
||||
" method3t();",
|
||||
" method4(method4t.class);",
|
||||
" }",
|
||||
"",
|
||||
@@ -37,7 +37,7 @@ final class ConflictDetectionTest {
|
||||
"",
|
||||
" void method2t() {}",
|
||||
"",
|
||||
" // BUG: Diagnostic contains: another method named `method3t` is in scope",
|
||||
" // BUG: Diagnostic contains: `method3t` is already statically imported",
|
||||
" void method3() {}",
|
||||
"",
|
||||
" void method4(Object o) {}",
|
||||
@@ -45,34 +45,8 @@ final class ConflictDetectionTest {
|
||||
" // BUG: Diagnostic contains: `int` is not a valid identifier",
|
||||
" void in() {}",
|
||||
"",
|
||||
" class InstanceType {",
|
||||
" void m() {",
|
||||
" System.out.println(method3t());",
|
||||
" }",
|
||||
" }",
|
||||
"",
|
||||
" static class StaticType {",
|
||||
" static int method3t() {",
|
||||
" return 0;",
|
||||
" }",
|
||||
"",
|
||||
" static void method4t() {",
|
||||
" method4t();",
|
||||
" }",
|
||||
" }",
|
||||
"",
|
||||
" record RecordType() {",
|
||||
" void m() {",
|
||||
" method4t();",
|
||||
" }",
|
||||
" }",
|
||||
"",
|
||||
" enum EnumType {",
|
||||
" ELEM;",
|
||||
"",
|
||||
" void m() {",
|
||||
" method4t();",
|
||||
" }",
|
||||
" static class B {",
|
||||
" static void method3t() {}",
|
||||
" }",
|
||||
"",
|
||||
" class method4t {}",
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package tech.picnic.errorprone.utils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.params.provider.Arguments.arguments;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
final class JavaKeywordsTest {
|
||||
private static Stream<Arguments> isValidIdentifierTestCases() {
|
||||
/* { string, expected } */
|
||||
return Stream.of(
|
||||
arguments("", false),
|
||||
arguments("public", false),
|
||||
arguments("true", false),
|
||||
arguments("false", false),
|
||||
arguments("null", false),
|
||||
arguments("0", false),
|
||||
arguments("\0", false),
|
||||
arguments("a%\0", false),
|
||||
arguments("a", true),
|
||||
arguments("a0", true),
|
||||
arguments("_a0", true),
|
||||
arguments("test", true));
|
||||
}
|
||||
|
||||
@MethodSource("isValidIdentifierTestCases")
|
||||
@ParameterizedTest
|
||||
void isValidIdentifier(String string, boolean expected) {
|
||||
assertThat(JavaKeywords.isValidIdentifier(string)).isEqualTo(expected);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
package tech.picnic.errorprone.utils;
|
||||
|
||||
import static com.google.errorprone.BugPattern.SeverityLevel.ERROR;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.params.provider.Arguments.arguments;
|
||||
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper;
|
||||
import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode;
|
||||
@@ -10,80 +8,18 @@ import com.google.errorprone.BugPattern;
|
||||
import com.google.errorprone.VisitorState;
|
||||
import com.google.errorprone.bugpatterns.BugChecker;
|
||||
import com.google.errorprone.bugpatterns.BugChecker.AnnotationTreeMatcher;
|
||||
import com.google.errorprone.bugpatterns.BugChecker.LiteralTreeMatcher;
|
||||
import com.google.errorprone.bugpatterns.BugChecker.MethodInvocationTreeMatcher;
|
||||
import com.google.errorprone.bugpatterns.BugChecker.MethodTreeMatcher;
|
||||
import com.google.errorprone.bugpatterns.BugChecker.VariableTreeMatcher;
|
||||
import com.google.errorprone.fixes.SuggestedFix;
|
||||
import com.google.errorprone.matchers.Description;
|
||||
import com.google.errorprone.util.ASTHelpers;
|
||||
import com.sun.source.tree.AnnotationTree;
|
||||
import com.sun.source.tree.LiteralTree;
|
||||
import com.sun.source.tree.MethodInvocationTree;
|
||||
import com.sun.source.tree.MethodTree;
|
||||
import com.sun.source.tree.Tree;
|
||||
import com.sun.source.tree.VariableTree;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
import javax.lang.model.element.Name;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
final class SourceCodeTest {
|
||||
private static Stream<Arguments> isValidIdentifierTestCases() {
|
||||
/* { string, expected } */
|
||||
return Stream.of(
|
||||
arguments("", false),
|
||||
arguments(".", false),
|
||||
arguments("a.", false),
|
||||
arguments(".a", false),
|
||||
arguments("a.b", false),
|
||||
arguments("public", false),
|
||||
arguments("true", false),
|
||||
arguments("false", false),
|
||||
arguments("null", false),
|
||||
arguments("0", false),
|
||||
arguments("\0", false),
|
||||
arguments("a%\0", false),
|
||||
arguments("a", true),
|
||||
arguments("a0", true),
|
||||
arguments("_a0", true),
|
||||
arguments("test", true));
|
||||
}
|
||||
|
||||
@MethodSource("isValidIdentifierTestCases")
|
||||
@ParameterizedTest
|
||||
void isValidIdentifier(String string, boolean expected) {
|
||||
assertThat(SourceCode.isValidIdentifier(string)).isEqualTo(expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
void toStringConstantExpression() {
|
||||
BugCheckerRefactoringTestHelper.newInstance(
|
||||
ToStringConstantExpressionTestChecker.class, getClass())
|
||||
.addInputLines(
|
||||
"A.java",
|
||||
"class A {",
|
||||
" String m() {",
|
||||
" char a = 'c';",
|
||||
" char b = '\\'';",
|
||||
" return \"foo\\\"bar\\'baz\\bqux\";",
|
||||
" }",
|
||||
"}")
|
||||
.addOutputLines(
|
||||
"A.java",
|
||||
"class A {",
|
||||
" String m() {",
|
||||
" char a = 'c' /* 'c' */; /* \"a\" */",
|
||||
" char b = '\\'' /* '\\'' */; /* \"b\" */",
|
||||
" return \"foo\\\"bar\\'baz\\bqux\" /* \"foo\\\"bar'baz\\bqux\" */;",
|
||||
" }",
|
||||
"}")
|
||||
.doTest(TestMode.TEXT_MATCH);
|
||||
}
|
||||
|
||||
@Test
|
||||
void deleteWithTrailingWhitespaceAnnotations() {
|
||||
BugCheckerRefactoringTestHelper.newInstance(
|
||||
@@ -292,41 +228,6 @@ final class SourceCodeTest {
|
||||
.doTest(TestMode.TEXT_MATCH);
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link BugChecker} that applies {@link SourceCode#toStringConstantExpression(Object,
|
||||
* VisitorState)} to string literals.
|
||||
*/
|
||||
@BugPattern(severity = ERROR, summary = "Interacts with `SourceCode` for testing purposes")
|
||||
public static final class ToStringConstantExpressionTestChecker extends BugChecker
|
||||
implements LiteralTreeMatcher, VariableTreeMatcher {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public Description matchLiteral(LiteralTree tree, VisitorState state) {
|
||||
// XXX: The character conversion is a workaround for the fact that `ASTHelpers#constValue`
|
||||
// returns an `Integer` value for `char` constants.
|
||||
return Optional.ofNullable(ASTHelpers.constValue(tree))
|
||||
.map(
|
||||
constant ->
|
||||
ASTHelpers.isSubtype(ASTHelpers.getType(tree), state.getSymtab().charType, state)
|
||||
? (char) (int) constant
|
||||
: constant)
|
||||
.map(constant -> describeMatch(tree, addComment(tree, constant, state)))
|
||||
.orElse(Description.NO_MATCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Description matchVariable(VariableTree tree, VisitorState state) {
|
||||
return describeMatch(
|
||||
tree, addComment(tree, ASTHelpers.getSymbol(tree).getSimpleName(), state));
|
||||
}
|
||||
|
||||
private static SuggestedFix addComment(Tree tree, Object value, VisitorState state) {
|
||||
return SuggestedFix.postfixWith(
|
||||
tree, "/* %s */".formatted(SourceCode.toStringConstantExpression(value, state)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link BugChecker} that uses {@link SourceCode#deleteWithTrailingWhitespace(Tree,
|
||||
* VisitorState)} to suggest the deletion of annotations and methods with a name containing
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,66 +1,34 @@
|
||||
src/it/java/com/google/checkstyle/test/chapter7javadoc/rule734nonrequiredjavadoc/NonRequiredJavadocTest.java:[33,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/com/google/checkstyle/test/chapter7javadoc/rule711generalform/InvalidJavadocPositionTest.java:[35,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/com/google/checkstyle/test/chapter7javadoc/rule734nonrequiredjavadoc/InvalidJavadocPositionTest.java:[35,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/com/sun/checkstyle/test/chapter5comments/rule52documentationcomments/InvalidJavadocPositionTest.java:[35,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAbbreviationAsWordInNameTest.java:[116,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `enum` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAbbreviationAsWordInNameTest.java:[166,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAbbreviationAsWordInNameTest.java:[117,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `enum` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAbbreviationAsWordInNameTest.java:[169,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAbbreviationAsWordInNameTest.java:[91,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `class` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationLocationTest.java:[101,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `enum` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationLocationTest.java:[104,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `enum` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationLocationTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `class` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationLocationTest.java:[69,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationLocationTest.java:[71,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnonInnerLengthTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidEscapedUnicodeCharactersTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidNoArgumentSuperConstructorCallTest.java:[41,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCatchParameterNameTest.java:[161,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `enum` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCatchParameterNameTest.java:[187,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionClassMemberImpliedModifierTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionClassMemberImpliedModifierTest.java:[71,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `enum` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionClassTypeParameterNameTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `class` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionClassTypeParameterNameTest.java:[69,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionConstructorsDeclarationGroupingTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `class` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionConstructorsDeclarationGroupingTest.java:[70,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `enum` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionDeclarationOrderTest.java:[64,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `static` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCatchParameterNameTest.java:[166,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `enum` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCatchParameterNameTest.java:[193,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEqualsAvoidNullTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `equals` is already defined in this class or a supertype)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionFinalClassTest.java:[38,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalImportTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalImportTest.java:[53,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `static` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalInstantiationTest.java:[91,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalTokenTest.java:[56,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `native` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalTokenTextTest.java:[91,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIndentationTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionLambdaParameterNameTest.java:[41,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMemberNameTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodCountTest.java:[109,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `protected` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodCountTest.java:[134,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `public` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodCountTest.java:[37,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodCountTest.java:[61,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `private` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodCountTest.java:[85,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `package` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodNameTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionLambdaBodyLengthTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingJavadocTypeTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `class` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingOverrideTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `class` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingOverrideTest.java:[66,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingOverrideTest.java:[67,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMultipleStringLiteralsTest.java:[41,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMutableExceptionTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNeedBracesTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `do` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoLineWrapTest.java:[37,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOuterTypeNumberTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOverloadMethodsDeclarationOrderTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionParameterNumberTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRecordComponentNameTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRecordComponentNumberTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionReturnCountTest.java:[38,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `void` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionSeparatorWrapTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `class` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionSeparatorWrapTest.java:[60,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionSimplifyBooleanExpressionTest.java:[90,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionSuperFinalizeTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionThrowsCountTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionTypeNameTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUncommentedMainTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessarySemicolonAfterTypeMemberDeclarationTest.java:[41,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessarySemicolonInTryWithResourcesTest.java:[41,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedImportsTest.java:[57,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `static` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/DetailAstImplTest.java:[595,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/PackageNamesLoaderTest.java:[58,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/api/FilterSetTest.java:[49,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/api/FullIdentTest.java:[42,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/api/FullIdentTest.java:[41,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheckTest.java:[77,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheckTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/OrderedPropertiesCheckTest.java:[49,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
@@ -78,7 +46,6 @@ src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCh
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidDoubleBraceInitializationCheckTest.java:[37,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidInlineConditionalsCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidNoArgumentSuperConstructorCallCheckTest.java:[37,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/ConstructorsDeclarationGroupingCheckTest.java:[35,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/CovariantEqualsCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheckTest.java:[44,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/DefaultComesLastCheckTest.java:[55,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
@@ -103,7 +70,8 @@ src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolon
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonInTryWithResourcesCheckTest.java:[38,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/design/InterfaceIsTypeCheckTest.java:[37,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/design/MutableExceptionCheckTest.java:[54,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheckTest.java:[100,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `null` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/design/ThrowsCountCheckTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheckTest.java:[99,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `null` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheckTest.java:[81,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/InvalidJavadocPositionCheckTest.java:[59,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocContentLocationCheckTest.java:[57,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
@@ -113,8 +81,8 @@ src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocNodeImplTest
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagInfoTest.java:[230,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `throws` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagInfoTest.java:[294,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `return` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagTest.java:[58,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java:[84,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `protected` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java:[90,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `public` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java:[83,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `protected` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java:[89,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `public` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheckTest.java:[60,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocTypeCheckTest.java:[118,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `protected` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocTypeCheckTest.java:[126,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `public` is not a valid identifier)
|
||||
@@ -165,7 +133,7 @@ src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyCommentF
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilterTest.java:[151,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionSingleFilterTest.java:[42,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/grammar/antlr4/Antlr4AstRegressionTest.java:[34,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `package` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/grammar/comments/CommentsTest.java:[69,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/grammar/comments/CommentsTest.java:[53,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/grammar/java8/DefaultMethodsTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `switch` is not a valid identifier)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/gui/BaseCellEditorTest.java:[31,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype)
|
||||
src/test/java/com/puppycrawl/tools/checkstyle/utils/CheckUtilTest.java:[71,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `equals` is already defined in this class or a supertype)
|
||||
|
||||
@@ -1,24 +1,19 @@
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -368,6 +368,12 @@
|
||||
<version>1.4.4</version>
|
||||
@@ -366,6 +366,12 @@
|
||||
<version>1.4.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
+ <dependency>
|
||||
+ <groupId>org.assertj</groupId>
|
||||
+ <artifactId>assertj-core</artifactId>
|
||||
+ <version>3.27.0<!-- Renovate: org.assertj:assertj-bom --></version>
|
||||
+ <version>${assertj.version}</version>
|
||||
+ <scope>test</scope>
|
||||
+ </dependency>
|
||||
<dependency>
|
||||
<groupId>nl.jqno.equalsverifier</groupId>
|
||||
<artifactId>equalsverifier</artifactId>
|
||||
@@ -2421,9 +2427,13 @@
|
||||
<compilerArgs>
|
||||
<arg>-Xpkginfo:always</arg>
|
||||
<arg>-XDcompilePolicy=simple</arg>
|
||||
+ <!-- XXX: Drop this flag once the project uses Error Prone 2.36.0+ by default. -->
|
||||
+ <arg>--should-stop=ifError=FLOW</arg>
|
||||
@@ -2422,6 +2428,8 @@
|
||||
<arg>
|
||||
-Xplugin:ErrorProne ${error-prone.configuration-args}
|
||||
</arg>
|
||||
@@ -27,7 +22,7 @@
|
||||
</compilerArgs>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
@@ -2436,6 +2446,11 @@
|
||||
@@ -2434,6 +2442,11 @@
|
||||
<artifactId>error-prone-contrib</artifactId>
|
||||
<version>${error-prone-support.version}</version>
|
||||
</path>
|
||||
@@ -39,12 +34,8 @@
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</execution>
|
||||
@@ -2476,11 +2491,14 @@
|
||||
<compilerArgs>
|
||||
<arg>-Xpkginfo:always</arg>
|
||||
@@ -2476,9 +2489,10 @@
|
||||
<arg>-XDcompilePolicy=simple</arg>
|
||||
+ <!-- XXX: Drop this flag once the project uses Error Prone 2.36.0+ by default. -->
|
||||
+ <arg>--should-stop=ifError=FLOW</arg>
|
||||
<arg>
|
||||
-Xplugin:ErrorProne \
|
||||
- -XepExcludedPaths:.*[\\/]resources[\\/].* \
|
||||
@@ -55,7 +46,7 @@
|
||||
</compilerArgs>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
@@ -2493,6 +2511,11 @@
|
||||
@@ -2491,6 +2505,11 @@
|
||||
<artifactId>error-prone-contrib</artifactId>
|
||||
<version>${error-prone-support.version}</version>
|
||||
</path>
|
||||
@@ -67,39 +58,6 @@
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</execution>
|
||||
--- a/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule21filename/FileNameTest.java
|
||||
+++ b/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule21filename/FileNameTest.java
|
||||
@@ -23,6 +23,8 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport;
|
||||
|
||||
+// This class is referenced from another package.
|
||||
+@SuppressWarnings("JUnitClassModifiers")
|
||||
public class FileNameTest extends AbstractGoogleModuleTestSupport {
|
||||
|
||||
@Override
|
||||
--- a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/SourceFileStructureTest.java
|
||||
+++ b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/SourceFileStructureTest.java
|
||||
@@ -23,6 +23,8 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport;
|
||||
|
||||
+// This class is referenced from another package.
|
||||
+@SuppressWarnings("JUnitClassModifiers")
|
||||
public class SourceFileStructureTest extends AbstractGoogleModuleTestSupport {
|
||||
|
||||
@Override
|
||||
--- a/src/it/java/com/google/checkstyle/test/chapter3filestructure/toolongpackagetotestcoveragegooglesjavastylerule/PackageStatementTest.java
|
||||
+++ b/src/it/java/com/google/checkstyle/test/chapter3filestructure/toolongpackagetotestcoveragegooglesjavastylerule/PackageStatementTest.java
|
||||
@@ -23,6 +23,8 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport;
|
||||
|
||||
+// This class is referenced from another package.
|
||||
+@SuppressWarnings("JUnitClassModifiers")
|
||||
public class PackageStatementTest extends AbstractGoogleModuleTestSupport {
|
||||
|
||||
@Override
|
||||
--- a/src/main/java/com/puppycrawl/tools/checkstyle/DetailNodeTreeStringPrinter.java
|
||||
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/DetailNodeTreeStringPrinter.java
|
||||
@@ -63,6 +63,8 @@ public final class DetailNodeTreeStringPrinter {
|
||||
@@ -113,7 +71,7 @@
|
||||
final ParseStatus status = parser.parseJavadocAsDetailNode(blockComment);
|
||||
--- a/src/main/java/com/puppycrawl/tools/checkstyle/SarifLogger.java
|
||||
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/SarifLogger.java
|
||||
@@ -157,6 +157,9 @@ public class SarifLogger extends AbstractAutomaticBean implements AuditListener
|
||||
@@ -139,6 +139,9 @@ public class SarifLogger extends AbstractAutomaticBean implements AuditListener
|
||||
@Override
|
||||
public void auditFinished(AuditEvent event) {
|
||||
final String version = SarifLogger.class.getPackage().getImplementationVersion();
|
||||
@@ -125,7 +83,7 @@
|
||||
.replace(RESULTS_PLACEHOLDER, String.join(",\n", results));
|
||||
--- a/src/test/java/com/puppycrawl/tools/checkstyle/CheckerTest.java
|
||||
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/CheckerTest.java
|
||||
@@ -97,6 +97,8 @@ import de.thetaphi.forbiddenapis.SuppressForbidden;
|
||||
@@ -93,6 +93,8 @@ import de.thetaphi.forbiddenapis.SuppressForbidden;
|
||||
* @noinspectionreason ClassWithTooManyDependencies - complex tests require a large number
|
||||
* of imports
|
||||
*/
|
||||
@@ -167,7 +125,7 @@
|
||||
assertWithMessage("Exception is expected but got " + test).fail();
|
||||
--- a/src/test/java/com/puppycrawl/tools/checkstyle/TreeWalkerTest.java
|
||||
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/TreeWalkerTest.java
|
||||
@@ -84,6 +84,8 @@ import com.puppycrawl.tools.checkstyle.utils.CommonUtil;
|
||||
@@ -80,6 +80,8 @@ import com.puppycrawl.tools.checkstyle.utils.CommonUtil;
|
||||
* @noinspectionreason ClassWithTooManyDependencies - complex tests require a
|
||||
* large number of imports
|
||||
*/
|
||||
|
||||
@@ -5,10 +5,10 @@ set -e -u -o pipefail
|
||||
test_name="$(basename "${0}" .sh)"
|
||||
project='checkstyle'
|
||||
repository='https://github.com/checkstyle/checkstyle.git'
|
||||
revision='checkstyle-10.21.0'
|
||||
additional_build_flags='-Perror-prone-compile,error-prone-test-compile -Dmaven.compiler.failOnError=true'
|
||||
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'
|
||||
shared_error_prone_flags='-XepExcludedPaths:(\Q${project.basedir}${file.separator}src${file.separator}\E(it|test|xdocs-examples)\Q${file.separator}resources\E|\Q${project.build.directory}${file.separator}\E).*'
|
||||
patch_error_prone_flags=''
|
||||
validation_error_prone_flags=''
|
||||
# Validation skips some tests:
|
||||
@@ -30,7 +30,6 @@ fi
|
||||
"${revision}" \
|
||||
"${additional_build_flags}" \
|
||||
"${additional_source_directories}" \
|
||||
"${shared_error_prone_flags}" \
|
||||
"${patch_error_prone_flags}" \
|
||||
"${validation_error_prone_flags}" \
|
||||
"${validation_build_flags}" \
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,48 +1,287 @@
|
||||
metrics-collectd/src/main/java/io/dropwizard/metrics5/collectd/CollectdReporter.java:[306,57] [rawtypes] found raw type: Gauge
|
||||
metrics-collectd/src/main/java/io/dropwizard/metrics5/collectd/PacketWriter.java:[164,12] [cast] redundant cast to ByteBuffer
|
||||
metrics-collectd/src/main/java/io/dropwizard/metrics5/collectd/PacketWriter.java:[169,11] [cast] redundant cast to ByteBuffer
|
||||
metrics-collectd/src/main/java/io/dropwizard/metrics5/collectd/PacketWriter.java:[175,17] [cast] redundant cast to ByteBuffer
|
||||
metrics-collectd/src/main/java/io/dropwizard/metrics5/collectd/PacketWriter.java:[200,8] [cast] redundant cast to ByteBuffer
|
||||
metrics-collectd/src/main/java/io/dropwizard/metrics5/collectd/PacketWriter.java:[203,21] [cast] redundant cast to ByteBuffer
|
||||
metrics-collectd/src/main/java/io/dropwizard/metrics5/collectd/PacketWriter.java:[206,11] [cast] redundant cast to ByteBuffer
|
||||
metrics-collectd/src/main/java/io/dropwizard/metrics5/collectd/PacketWriter.java:[250,36] [cast] redundant cast to ByteBuffer
|
||||
metrics-core/src/main/java/io/dropwizard/metrics5/CsvReporter.java:[390,35] [FormatStringConcatenation] Defer string concatenation to the invoked method
|
||||
metrics-core/src/main/java/io/dropwizard/metrics5/InstrumentedExecutorService.java:[244,25] [try] auto-closeable resource durationContext is never referenced in body of corresponding try statement
|
||||
metrics-core/src/main/java/io/dropwizard/metrics5/InstrumentedExecutorService.java:[266,25] [try] auto-closeable resource context is never referenced in body of corresponding try statement
|
||||
metrics-graphite/src/main/java/io/dropwizard/metrics5/graphite/GraphiteReporter.java:[431,14] [Slf4jLogStatement] Log statement contains 0 placeholders, but specifies 1 matching argument(s)
|
||||
metrics-graphite/src/main/java/io/dropwizard/metrics5/graphite/GraphiteReporter.java:[436,16] [Slf4jLogStatement] Log statement contains 0 placeholders, but specifies 1 matching argument(s)
|
||||
metrics-graphite/src/main/java/io/dropwizard/metrics5/graphite/GraphiteReporter.java:[449,17] [Slf4jLogStatement] Log statement contains 0 placeholders, but specifies 1 matching argument(s)
|
||||
metrics-healthchecks/src/test/java/io/dropwizard/metrics5/health/HealthCheckTest.java:[189,46] [TimeZoneUsage] Derive the current time from an existing `Clock` Spring bean, and don't rely on a `Clock`'s time zone
|
||||
metrics-healthchecks/src/test/java/io/dropwizard/metrics5/health/HealthCheckTest.java:[203,46] [TimeZoneUsage] Derive the current time from an existing `Clock` Spring bean, and don't rely on a `Clock`'s time zone
|
||||
metrics-httpclient/src/test/java/io/dropwizard/metrics5/httpclient/HttpClientMetricNameStrategiesTest.java:[124,22] [deprecation] rewriteURI(URI,HttpHost,boolean) in URIUtils has been deprecated
|
||||
metrics-httpclient5/src/main/java/io/dropwizard/metrics5/httpclient5/InstrumentedAsyncClientConnectionManager.java:[29,62] [deprecation] getDefault() in DefaultClientTlsStrategy has been deprecated
|
||||
metrics-httpclient5/src/main/java/io/dropwizard/metrics5/httpclient5/InstrumentedHttpClientConnectionManager.java:[116,50] [deprecation] ConnectionSocketFactory in org.apache.hc.client5.http.socket has been deprecated
|
||||
metrics-httpclient5/src/main/java/io/dropwizard/metrics5/httpclient5/InstrumentedHttpClientConnectionManager.java:[160,12] [deprecation] DefaultHttpClientConnectionOperator(Lookup<ConnectionSocketFactory>,SchemePortResolver,DnsResolver) in DefaultHttpClientConnectionOperator has been deprecated
|
||||
metrics-httpclient5/src/main/java/io/dropwizard/metrics5/httpclient5/InstrumentedHttpClientConnectionManager.java:[30,28] [deprecation] ConnectionSocketFactory in org.apache.hc.client5.http.socket has been deprecated
|
||||
metrics-httpclient5/src/main/java/io/dropwizard/metrics5/httpclient5/InstrumentedHttpClientConnectionManager.java:[31,28] [deprecation] ConnectionSocketFactory in org.apache.hc.client5.http.socket has been deprecated
|
||||
metrics-httpclient5/src/main/java/io/dropwizard/metrics5/httpclient5/InstrumentedHttpClientConnectionManager.java:[32,37] [deprecation] PlainConnectionSocketFactory in org.apache.hc.client5.http.socket has been deprecated
|
||||
metrics-httpclient5/src/main/java/io/dropwizard/metrics5/httpclient5/InstrumentedHttpClientConnectionManager.java:[33,38] [deprecation] SSLConnectionSocketFactory in org.apache.hc.client5.http.ssl has been deprecated
|
||||
metrics-httpclient5/src/main/java/io/dropwizard/metrics5/httpclient5/InstrumentedHttpClientConnectionManager.java:[96,21] [deprecation] ConnectionSocketFactory in org.apache.hc.client5.http.socket has been deprecated
|
||||
metrics-httpclient5/src/main/java/io/dropwizard/metrics5/httpclient5/InstrumentedHttpRequestExecutor.java:[49,4] [deprecation] HttpRequestExecutor(Timeout,ConnectionReuseStrategy,Http1StreamListener) in HttpRequestExecutor has been deprecated
|
||||
metrics-httpclient5/src/test/java/io/dropwizard/metrics5/httpclient5/InstrumentedHttpClientsTest.java:[46,10] [deprecation] execute(ClassicHttpRequest) in HttpClient has been deprecated
|
||||
metrics-httpclient5/src/test/java/io/dropwizard/metrics5/httpclient5/InstrumentedHttpClientsTest.java:[68,12] [deprecation] execute(ClassicHttpRequest) in HttpClient has been deprecated
|
||||
metrics-influxdb/src/main/java/io/dropwizard/metrics5/influxdb/InfluxDbReporter.java:[282,14] [Slf4jLogStatement] Log statement contains 0 placeholders, but specifies 1 matching argument(s)
|
||||
metrics-influxdb/src/main/java/io/dropwizard/metrics5/influxdb/InfluxDbReporter.java:[287,16] [Slf4jLogStatement] Log statement contains 0 placeholders, but specifies 1 matching argument(s)
|
||||
metrics-jakarta-servlets/src/test/java/io/dropwizard/metrics5/servlets/HealthCheckServletTest.java:[31,67] [TimeZoneUsage] Derive the current time from an existing `Clock` Spring bean, and don't rely on a `Clock`'s time zone
|
||||
metrics-jdbi3/src/test/java/io/dropwizard/metrics5/jdbi3/strategies/SmartNameStrategyTest.java:[18,10] [deprecation] InstrumentedTimingCollector in io.dropwizard.metrics5.jdbi3 has been deprecated
|
||||
metrics-jdbi3/src/test/java/io/dropwizard/metrics5/jdbi3/strategies/SmartNameStrategyTest.java:[24,20] [deprecation] InstrumentedTimingCollector in io.dropwizard.metrics5.jdbi3 has been deprecated
|
||||
metrics-jvm/src/test/java/io/dropwizard/metrics5/jvm/BufferPoolMetricSetTest.java:[101,74] [unchecked] unchecked cast
|
||||
metrics-jvm/src/test/java/io/dropwizard/metrics5/jvm/BufferPoolMetricSetTest.java:[56,74] [unchecked] unchecked cast
|
||||
metrics-jvm/src/test/java/io/dropwizard/metrics5/jvm/BufferPoolMetricSetTest.java:[65,74] [unchecked] unchecked cast
|
||||
metrics-jvm/src/test/java/io/dropwizard/metrics5/jvm/BufferPoolMetricSetTest.java:[74,74] [unchecked] unchecked cast
|
||||
metrics-jvm/src/test/java/io/dropwizard/metrics5/jvm/BufferPoolMetricSetTest.java:[83,74] [unchecked] unchecked cast
|
||||
metrics-jvm/src/test/java/io/dropwizard/metrics5/jvm/BufferPoolMetricSetTest.java:[92,74] [unchecked] unchecked cast
|
||||
metrics-legacy-adapter/src/main/java/com/codahale/metrics/MetricRegistry.java:[108,27] [rawtypes] found raw type: Gauge
|
||||
metrics-legacy-adapter/src/main/java/com/codahale/metrics/MetricRegistry.java:[112,27] [rawtypes] found raw type: Gauge
|
||||
metrics-legacy-adapter/src/main/java/com/codahale/metrics/MetricRegistry.java:[51,49] [rawtypes] found raw type: Gauge
|
||||
metrics-legacy-adapter/src/main/java/com/codahale/metrics/MetricRegistry.java:[51,9] [rawtypes] found raw type: Gauge
|
||||
metrics-legacy-adapter/src/test/java/com/codahale/metrics/MetricRegistryTest.java:[367,22] [rawtypes] found raw type: Gauge
|
||||
metrics-legacy-adapter/src/test/java/com/codahale/metrics/MetricRegistryTest.java:[50,4] [rawtypes] found raw type: Gauge
|
||||
metrics-log4j2/src/main/java/io/dropwizard/metrics5/log4j2/InstrumentedAppender.java:[85,4] [deprecation] AbstractAppender(String,Filter,Layout<? extends Serializable>,boolean) in AbstractAppender has been deprecated
|
||||
metrics-log4j2/src/main/java/io/dropwizard/metrics5/log4j2/InstrumentedAppender.java:[96,4] [deprecation] AbstractAppender(String,Filter,Layout<? extends Serializable>,boolean) in AbstractAppender has been deprecated
|
||||
metrics-servlets/src/test/java/io/dropwizard/metrics5/servlets/HealthCheckServletTest.java:[31,67] [TimeZoneUsage] Derive the current time from an existing `Clock` Spring bean, and don't rely on a `Clock`'s time zone
|
||||
metrics-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
|
||||
|
||||
@@ -1,100 +1,203 @@
|
||||
--- a/metrics-jakarta-servlets/src/main/java/io/dropwizard/metrics5/servlets/MetricsServlet.java
|
||||
+++ b/metrics-jakarta-servlets/src/main/java/io/dropwizard/metrics5/servlets/MetricsServlet.java
|
||||
@@ -188,6 +188,9 @@ public class MetricsServlet extends HttpServlet {
|
||||
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();
|
||||
}
|
||||
|
||||
+ // Here `value` may be `null`, while `TimeUnit#valueOf` requires a non-`null` argument.
|
||||
+ // XXX: Investigate better nullness handling by `IdentityConversion`.
|
||||
+ @SuppressWarnings("IdentityConversion")
|
||||
protected TimeUnit parseTimeUnit(String value, TimeUnit defaultValue) {
|
||||
try {
|
||||
return TimeUnit.valueOf(String.valueOf(value).toUpperCase(Locale.US));
|
||||
--- a/metrics-servlets/src/main/java/io/dropwizard/metrics5/servlets/MetricsServlet.java
|
||||
+++ b/metrics-servlets/src/main/java/io/dropwizard/metrics5/servlets/MetricsServlet.java
|
||||
@@ -188,6 +188,9 @@ public class MetricsServlet extends HttpServlet {
|
||||
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();
|
||||
}
|
||||
|
||||
+ // Here `value` may be `null`, while `TimeUnit#valueOf` requires a non-`null` argument.
|
||||
+ // XXX: Investigate better nullness handling by `IdentityConversion`.
|
||||
+ @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
|
||||
@@ -136,6 +136,27 @@
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
+ <dependencyManagement>
|
||||
+ <dependencies>
|
||||
+ <dependency>
|
||||
+ <groupId>com.google.errorprone</groupId>
|
||||
+ <artifactId>error_prone_annotations</artifactId>
|
||||
+ <version>${error-prone.version}</version>
|
||||
+ </dependency>
|
||||
+ <dependency>
|
||||
+ <groupId>com.google.guava</groupId>
|
||||
+ <artifactId>guava</artifactId>
|
||||
+ <version>33.4.0-jre<!-- Renovate: com.google.guava:guava-bom --></version>
|
||||
+ </dependency>
|
||||
+ </dependencies>
|
||||
+ </dependencyManagement>
|
||||
+ <dependencies>
|
||||
+ <dependency>
|
||||
+ <groupId>com.google.guava</groupId>
|
||||
+ <artifactId>guava</artifactId>
|
||||
+ </dependency>
|
||||
+ </dependencies>
|
||||
+
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>jdk8</id>
|
||||
@@ -218,7 +239,9 @@
|
||||
<compilerArgs>
|
||||
@@ -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>
|
||||
+ <!-- XXX: Drop this flag once the project uses Error Prone 2.36.0+ by default. -->
|
||||
+ <arg>--should-stop=ifError=FLOW</arg>
|
||||
+ <arg>-Xplugin:ErrorProne ${error-prone.configuration-args}</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>
|
||||
@@ -229,12 +252,24 @@
|
||||
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=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>
|
||||
+ <arg>-Xmaxwarns</arg>
|
||||
+ <arg>1000000</arg>
|
||||
</compilerArgs>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>com.google.errorprone</groupId>
|
||||
<artifactId>error_prone_core</artifactId>
|
||||
- <annotationProcessorPaths>
|
||||
- <path>
|
||||
- <groupId>com.google.errorprone</groupId>
|
||||
- <artifactId>error_prone_core</artifactId>
|
||||
- <version>${errorprone.version}</version>
|
||||
+ <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>
|
||||
- </path>
|
||||
- </annotationProcessorPaths>
|
||||
</configuration>
|
||||
@@ -364,7 +399,7 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
- <release>8</release>
|
||||
+ <release>11</release>
|
||||
<fork>true</fork>
|
||||
<parameters>true</parameters>
|
||||
<showWarnings>true</showWarnings>
|
||||
</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>
|
||||
|
||||
@@ -3,34 +3,30 @@
|
||||
set -e -u -o pipefail
|
||||
|
||||
test_name="$(basename "${0}" .sh)"
|
||||
project='metrics'
|
||||
repository='https://github.com/dropwizard/metrics.git'
|
||||
revision='v5.0.0-rc22'
|
||||
additional_build_flags=''
|
||||
additional_source_directories=''
|
||||
# XXX: Minimize the diff by including
|
||||
# `-XepOpt:Slf4jLoggerDeclaration:CanonicalStaticLoggerName=LOGGER` once such
|
||||
# flags are supported in patch mode. See
|
||||
# https://github.com/google/error-prone/pull/4699.
|
||||
shared_error_prone_flags='-XepExcludedPaths:.*/target/generated-sources/.*'
|
||||
patch_error_prone_flags=''
|
||||
validation_error_prone_flags=''
|
||||
validation_build_flags=''
|
||||
project=metrics
|
||||
repository=https://github.com/dropwizard/metrics.git
|
||||
revision=v4.2.19
|
||||
|
||||
if [ "${#}" -gt 2 ] || ([ "${#}" = 2 ] && [ "${1:---sync}" != '--sync' ]); then
|
||||
>&2 echo "Usage: ${0} [--sync] [<report_directory>]"
|
||||
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}"))"
|
||||
|
||||
"$(dirname "${0}")/run-integration-test.sh" \
|
||||
# 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}" \
|
||||
"${additional_build_flags}" \
|
||||
"${additional_source_directories}" \
|
||||
"${shared_error_prone_flags}" \
|
||||
"${patch_error_prone_flags}" \
|
||||
"${validation_error_prone_flags}" \
|
||||
"${validation_build_flags}" \
|
||||
$@
|
||||
"" \
|
||||
"" \
|
||||
"${patch_flags}" \
|
||||
"" \
|
||||
"" \
|
||||
"${do_sync}" \
|
||||
"${report_directory}"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,19 +0,0 @@
|
||||
integration-tests/it-exporter/it-exporter-httpserver-sample/src/main/java/io/prometheus/metrics/it/exporter/httpserver/HTTPServerSample.java:[15,5] [ConstantNaming] Constant variables should adhere to the `UPPER_SNAKE_CASE` naming convention; consider renaming to 'SUCCESS', though note that this is not a private constant
|
||||
integration-tests/it-exporter/it-exporter-httpserver-sample/src/main/java/io/prometheus/metrics/it/exporter/httpserver/HTTPServerSample.java:[16,5] [ConstantNaming] Constant variables should adhere to the `UPPER_SNAKE_CASE` naming convention; consider renaming to 'ERROR', though note that this is not a private constant
|
||||
integration-tests/it-exporter/it-exporter-no-protobuf/src/main/java/io/prometheus/metrics/it/exporter/httpserver/HTTPServerSample.java:[15,5] [ConstantNaming] Constant variables should adhere to the `UPPER_SNAKE_CASE` naming convention; consider renaming to 'SUCCESS', though note that this is not a private constant
|
||||
integration-tests/it-exporter/it-exporter-no-protobuf/src/main/java/io/prometheus/metrics/it/exporter/httpserver/HTTPServerSample.java:[16,5] [ConstantNaming] Constant variables should adhere to the `UPPER_SNAKE_CASE` naming convention; consider renaming to 'ERROR', though note that this is not a private constant
|
||||
integration-tests/it-exporter/it-exporter-servlet-jetty-sample/src/main/java/io/prometheus/metrics/it/exporter/servlet/jetty/ExporterServletJettySample.java:[18,5] [ConstantNaming] Constant variables should adhere to the `UPPER_SNAKE_CASE` naming convention; consider renaming to 'SUCCESS', though note that this is not a private constant
|
||||
integration-tests/it-exporter/it-exporter-servlet-jetty-sample/src/main/java/io/prometheus/metrics/it/exporter/servlet/jetty/ExporterServletJettySample.java:[19,5] [ConstantNaming] Constant variables should adhere to the `UPPER_SNAKE_CASE` naming convention; consider renaming to 'ERROR', though note that this is not a private constant
|
||||
integration-tests/it-exporter/it-exporter-servlet-tomcat-sample/src/main/java/io/prometheus/metrics/it/exporter/servlet/tomcat/ExporterServletTomcatSample.java:[21,5] [ConstantNaming] Constant variables should adhere to the `UPPER_SNAKE_CASE` naming convention; consider renaming to 'SUCCESS', though note that this is not a private constant
|
||||
integration-tests/it-exporter/it-exporter-servlet-tomcat-sample/src/main/java/io/prometheus/metrics/it/exporter/servlet/tomcat/ExporterServletTomcatSample.java:[22,5] [ConstantNaming] Constant variables should adhere to the `UPPER_SNAKE_CASE` naming convention; consider renaming to 'ERROR', though note that this is not a private constant
|
||||
prometheus-metrics-core/src/test/java/io/prometheus/metrics/core/metrics/CounterTest.java:[180,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `incWithExemplar` is already defined in this class or a supertype)
|
||||
prometheus-metrics-instrumentation-jvm/src/main/java/io/prometheus/metrics/instrumentation/jvm/JvmNativeMemoryMetrics.java:[96,30] [ConstantNaming] Constant variables should adhere to the `UPPER_SNAKE_CASE` naming convention; consider renaming to 'IS_ENABLED', though note that this is not a private constant
|
||||
prometheus-metrics-instrumentation-jvm/src/main/java/io/prometheus/metrics/instrumentation/jvm/NativeImageChecker.java:[11,24] [ConstantNaming] Constant variables should adhere to the `UPPER_SNAKE_CASE` naming convention; consider renaming to 'IS_GRAAL_VM_NATIVE_IMAGE', though note that this is not a private constant
|
||||
prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/registry/PrometheusRegistry.java:[16,42] [ConstantNaming] Constant variables should adhere to the `UPPER_SNAKE_CASE` naming convention; consider renaming to 'DEFAULT_REGISTRY', though note that this is not a private constant
|
||||
prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/LabelTest.java:[19,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype)
|
||||
prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/LabelTest.java:[24,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `equals` is already defined in this class or a supertype)
|
||||
prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/LabelTest.java:[29,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `hashCode` is already defined in this class or a supertype)
|
||||
prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/PrometheusNamingTest.java:[12,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that another method named `sanitizeMetricName` is in scope)
|
||||
prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/PrometheusNamingTest.java:[44,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that another method named `sanitizeLabelName` is in scope)
|
||||
prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/PrometheusNamingTest.java:[55,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that another method named `validateUnitName` is in scope)
|
||||
prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/PrometheusNamingTest.java:[67,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that another method named `sanitizeUnitName` is in scope)
|
||||
@@ -1,36 +0,0 @@
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -128,7 +128,6 @@
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
- <scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
@@ -370,13 +369,24 @@
|
||||
-Xep:LongDoubleConversion:OFF
|
||||
-Xep:StringSplitter:OFF
|
||||
-XepExcludedPaths:.*/generated/.*
|
||||
+ ${error-prone.configuration-args}
|
||||
</arg>
|
||||
</compilerArgs>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>com.google.errorprone</groupId>
|
||||
<artifactId>error_prone_core</artifactId>
|
||||
- <version>2.36.0</version>
|
||||
+ <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>
|
||||
<!-- Other annotation processors go here.
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e -u -o pipefail
|
||||
|
||||
test_name="$(basename "${0}" .sh)"
|
||||
project='prometheus-java-client'
|
||||
repository='https://github.com/prometheus/client_java.git'
|
||||
revision='v1.3.5'
|
||||
additional_build_flags='-Djava.version=11 -Dwarnings='
|
||||
additional_source_directories=''
|
||||
shared_error_prone_flags=''
|
||||
patch_error_prone_flags=''
|
||||
validation_error_prone_flags=''
|
||||
# Validation skips some tests:
|
||||
# - Starting from a clean repository, the `PushGatewayIT` tests reference a JAR
|
||||
# file that is created only after test completion, causing the tests to fail.
|
||||
# - The `SlidingWindowTest#rotate` test is flaky.
|
||||
# XXX: Drop the `SlidingWindowTest` exclusion once prometheus/client_java#1242
|
||||
# is resolved. For unclear reasons, it appears that without this exclusion the
|
||||
# integration tests are no longer executed, meaning that perhaps all flags
|
||||
# specified here can then be dropped.
|
||||
validation_build_flags='-Dtest=!PushGatewayIT,!SlidingWindowTest#rotate -Dsurefire.failIfNoSpecifiedTests=false'
|
||||
|
||||
if [ "${#}" -gt 2 ] || ([ "${#}" = 2 ] && [ "${1:---sync}" != '--sync' ]); then
|
||||
>&2 echo "Usage: ${0} [--sync] [<report_directory>]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
"$(dirname "${0}")/run-integration-test.sh" \
|
||||
"${test_name}" \
|
||||
"${project}" \
|
||||
"${repository}" \
|
||||
"${revision}" \
|
||||
"${additional_build_flags}" \
|
||||
"${additional_source_directories}" \
|
||||
"${shared_error_prone_flags}" \
|
||||
"${patch_error_prone_flags}" \
|
||||
"${validation_error_prone_flags}" \
|
||||
"${validation_build_flags}" \
|
||||
$@
|
||||
@@ -12,8 +12,8 @@ integration_test_root="$(cd "$(dirname -- "${0}")" && pwd)"
|
||||
error_prone_support_root="${integration_test_root}/.."
|
||||
repos_root="${integration_test_root}/.repos"
|
||||
|
||||
if [ "${#}" -lt 10 ] || [ "${#}" -gt 12 ] || ([ "${#}" = 12 ] && [ "${11:---sync}" != '--sync' ]); then
|
||||
>&2 echo "Usage: $(basename "${0}") <test_name> <project> <repository> <revision> <additional_build_flags> <additional_source_directories> <shared_error_prone_flags> <patch_error_prone_flags> <validation_error_prone_flags> <validation_build_flags> [--sync] [<report_directory>]"
|
||||
if [ "${#}" -lt 9 ] || [ "${#}" -gt 11 ] || ([ "${#}" = 11 ] && [ "${10:---sync}" != '--sync' ]); then
|
||||
>&2 echo "Usage: $(basename "${0}") <test_name> <project> <repository> <revision> <additional_build_flags> <additional_source_directories> <patch_error_prone_flags> <validation_error_prone_flags> <validation_build_flags> [--sync] [<report_directory>]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -23,12 +23,11 @@ repository="${3}"
|
||||
revision="${4}"
|
||||
additional_build_flags="${5}"
|
||||
additional_source_directories="${6}"
|
||||
shared_error_prone_flags="${7}"
|
||||
patch_error_prone_flags="${8}"
|
||||
validation_error_prone_flags="${9}"
|
||||
validation_build_flags="${10}"
|
||||
do_sync="$([ "${#}" = 10 ] || [ "${11:-}" != '--sync' ] || echo 1)"
|
||||
report_directory="$([ "${#}" = 10 ] || ([ -z "${do_sync}" ] && echo "${11}") || ([ "${#}" = 11 ] || echo "${12}"))"
|
||||
patch_error_prone_flags="${7}"
|
||||
validation_error_prone_flags="${8}"
|
||||
validation_build_flags="${9}"
|
||||
do_sync="$([ "${#}" = 9 ] || [ "${10:-}" != '--sync' ] || echo 1)"
|
||||
report_directory="$([ "${#}" = 9 ] || ([ -z "${do_sync}" ] && echo "${10}") || ([ "${#}" = 10 ] || echo "${11}"))"
|
||||
|
||||
if [ -n "${report_directory}" ]; then
|
||||
mkdir -p "${report_directory}"
|
||||
@@ -53,6 +52,7 @@ case "$(uname -s)" in
|
||||
esac
|
||||
|
||||
shared_build_flags="
|
||||
-Perror-prone-compile,error-prone-test-compile
|
||||
-Derror-prone.version=$(
|
||||
mvn -f "${error_prone_support_root}" help:evaluate -Dexpression=version.error-prone -q -DforceStdout
|
||||
)
|
||||
@@ -63,9 +63,15 @@ shared_build_flags="
|
||||
${additional_build_flags}
|
||||
"
|
||||
|
||||
format_goal='com.spotify.fmt:fmt-maven-plugin:2.25:format'
|
||||
# XXX: Configure Renovate to manage the fmt-maven-plugin version declared here.
|
||||
# XXX: Once GitHub actions uses Maven 3.9.2+, we can inline this variable with
|
||||
# version reference `${fmt.version}`, and `-Dfmt.version=2.21.1` added to
|
||||
# `shared_build_flags`.
|
||||
format_goal='com.spotify.fmt:fmt-maven-plugin:2.21.1:format'
|
||||
|
||||
error_prone_patch_flags="${shared_error_prone_flags} -XepPatchLocation:IN_PLACE -XepPatchChecks:$(
|
||||
error_prone_shared_flags='-XepExcludedPaths:(\Q${project.basedir}${file.separator}src${file.separator}\E(it|test|xdocs-examples)\Q${file.separator}resources\E|\Q${project.build.directory}${file.separator}\E).*'
|
||||
|
||||
error_prone_patch_flags="${error_prone_shared_flags} -XepPatchLocation:IN_PLACE -XepPatchChecks:$(
|
||||
find "${error_prone_support_root}" \
|
||||
-path "*/META-INF/services/com.google.errorprone.bugpatterns.BugChecker" \
|
||||
-not -path "*/error-prone-experimental/*" \
|
||||
@@ -75,7 +81,7 @@ error_prone_patch_flags="${shared_error_prone_flags} -XepPatchLocation:IN_PLACE
|
||||
| paste -s -d ',' -
|
||||
) ${patch_error_prone_flags}"
|
||||
|
||||
error_prone_validation_flags="${shared_error_prone_flags} -XepDisableAllChecks $(
|
||||
error_prone_validation_flags="${error_prone_shared_flags} -XepDisableAllChecks $(
|
||||
find "${error_prone_support_root}" \
|
||||
-path "*/META-INF/services/com.google.errorprone.bugpatterns.BugChecker" \
|
||||
-not -path "*/error-prone-experimental/*" \
|
||||
@@ -119,22 +125,14 @@ pushd "${project_root}"
|
||||
git config user.email || git config user.email 'integration-test@example.com'
|
||||
git config user.name || git config user.name 'Integration Test'
|
||||
|
||||
# Prepare the code for analysis by applying the minimal set of changes required
|
||||
# to run Error Prone with Error Prone Support.
|
||||
initial_patch="${integration_test_root}/${test_name}-init.patch"
|
||||
# Prepare the code for analysis by (a) applying the minimal set of changes
|
||||
# required to run Error Prone with Error Prone Support and (b) formatting the
|
||||
# code using the same method by which it will be formatted after each
|
||||
# compilation round. The initial formatting operation ensures that subsequent
|
||||
# modifications can be rendered in a clean manner.
|
||||
git clean -fdx
|
||||
git apply < "${initial_patch}"
|
||||
git apply < "${integration_test_root}/${test_name}-init.patch"
|
||||
git commit -m 'dependency: Introduce Error Prone Support' .
|
||||
if [ -n "${do_sync}" ]; then
|
||||
# The initial patch applied successfully, but if it was created against a
|
||||
# different version, then offsets may have changed. Here we update the patch
|
||||
# to exactly match the new state.
|
||||
git diff HEAD~1 | "${grep_command}" -vP '^(diff|index)' > "${initial_patch}"
|
||||
fi
|
||||
|
||||
# Format the patched code using the same method by which it will be formatted
|
||||
# after each compilation round. This initial formatting operation ensures that
|
||||
# subsequent modifications can be rendered in a clean manner.
|
||||
mvn ${shared_build_flags} "${format_goal}"
|
||||
git commit -m 'minor: Reformat using Google Java Format' .
|
||||
diff_base="$(git rev-parse HEAD)"
|
||||
@@ -143,13 +141,10 @@ diff_base="$(git rev-parse HEAD)"
|
||||
function apply_patch() {
|
||||
local extra_build_args="${1}"
|
||||
|
||||
(
|
||||
set -x \
|
||||
&& mvn ${shared_build_flags} ${extra_build_args} \
|
||||
package "${format_goal}" \
|
||||
-Derror-prone.configuration-args="${error_prone_patch_flags}" \
|
||||
-DskipTests
|
||||
)
|
||||
mvn ${shared_build_flags} ${extra_build_args} \
|
||||
package "${format_goal}" \
|
||||
-Derror-prone.configuration-args="${error_prone_patch_flags}" \
|
||||
-DskipTests
|
||||
|
||||
if ! git diff --exit-code; then
|
||||
git commit -m 'minor: Apply patches' .
|
||||
@@ -173,13 +168,12 @@ apply_patch ''
|
||||
# By also running the tests, we validate that the (majority of) applied changes
|
||||
# are behavior preserving.
|
||||
validation_build_log="${report_directory}/${test_name}-validation-build-log.txt"
|
||||
(
|
||||
set -x \
|
||||
&& mvn ${shared_build_flags} \
|
||||
clean package \
|
||||
-Derror-prone.configuration-args="${error_prone_validation_flags}" \
|
||||
${validation_build_flags}
|
||||
) | tee "${validation_build_log}" || failure=1
|
||||
mvn ${shared_build_flags} \
|
||||
clean package \
|
||||
-Derror-prone.configuration-args="${error_prone_validation_flags}" \
|
||||
${validation_build_flags} \
|
||||
| tee "${validation_build_log}" \
|
||||
|| failure=1
|
||||
|
||||
# Collect the applied changes.
|
||||
expected_changes="${integration_test_root}/${test_name}-expected-changes.patch"
|
||||
|
||||
86
pom.xml
86
pom.xml
@@ -211,16 +211,16 @@
|
||||
<version.auto-value>1.11.0</version.auto-value>
|
||||
<version.error-prone>${version.error-prone-orig}</version.error-prone>
|
||||
<version.error-prone-fork>v${version.error-prone-orig}-picnic-1</version.error-prone-fork>
|
||||
<version.error-prone-orig>2.36.0</version.error-prone-orig>
|
||||
<version.error-prone-orig>2.35.1</version.error-prone-orig>
|
||||
<version.error-prone-slf4j>0.1.28</version.error-prone-slf4j>
|
||||
<version.guava-beta-checker>1.0</version.guava-beta-checker>
|
||||
<version.jdk>17</version.jdk>
|
||||
<version.maven>3.9.9</version.maven>
|
||||
<version.mockito>5.14.2</version.mockito>
|
||||
<version.nopen-checker>1.0.1</version.nopen-checker>
|
||||
<version.nullaway>0.12.2</version.nullaway>
|
||||
<version.nullaway>0.12.1</version.nullaway>
|
||||
<version.pitest-git>1.1.4</version.pitest-git>
|
||||
<version.rewrite-templating>1.20.2</version.rewrite-templating>
|
||||
<version.rewrite-templating>1.17.0</version.rewrite-templating>
|
||||
<version.surefire>3.2.3</version.surefire>
|
||||
</properties>
|
||||
|
||||
@@ -299,7 +299,7 @@
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson</groupId>
|
||||
<artifactId>jackson-bom</artifactId>
|
||||
<version>2.18.2</version>
|
||||
<version>2.18.1</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
@@ -336,7 +336,7 @@
|
||||
<dependency>
|
||||
<groupId>com.google.googlejavaformat</groupId>
|
||||
<artifactId>google-java-format</artifactId>
|
||||
<version>1.25.2</version>
|
||||
<version>1.24.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
@@ -346,7 +346,7 @@
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava-bom</artifactId>
|
||||
<version>33.4.0-jre</version>
|
||||
<version>33.3.1-jre</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
@@ -367,15 +367,13 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-bom</artifactId>
|
||||
<version>1.14.2</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
<artifactId>micrometer-core</artifactId>
|
||||
<version>1.13.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.projectreactor</groupId>
|
||||
<artifactId>reactor-bom</artifactId>
|
||||
<version>2024.0.1</version>
|
||||
<version>2023.0.11</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
@@ -392,7 +390,7 @@
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>2.2.27</version>
|
||||
<version>2.2.25</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
@@ -427,7 +425,7 @@
|
||||
<dependency>
|
||||
<groupId>net.bytebuddy</groupId>
|
||||
<artifactId>byte-buddy</artifactId>
|
||||
<version>1.15.11</version>
|
||||
<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
|
||||
@@ -445,14 +443,14 @@
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-bom</artifactId>
|
||||
<version>3.27.0</version>
|
||||
<version>3.26.3</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.checkerframework</groupId>
|
||||
<artifactId>checker-qual</artifactId>
|
||||
<version>3.48.3</version>
|
||||
<version>3.48.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
@@ -464,11 +462,6 @@
|
||||
<artifactId>value-annotations</artifactId>
|
||||
<version>2.10.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jooq</groupId>
|
||||
<artifactId>jooq</artifactId>
|
||||
<version>3.19.16</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jspecify</groupId>
|
||||
<artifactId>jspecify</artifactId>
|
||||
@@ -477,7 +470,7 @@
|
||||
<dependency>
|
||||
<groupId>org.junit</groupId>
|
||||
<artifactId>junit-bom</artifactId>
|
||||
<version>5.11.4</version>
|
||||
<version>5.11.3</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
@@ -491,7 +484,14 @@
|
||||
<dependency>
|
||||
<groupId>org.mongodb</groupId>
|
||||
<artifactId>mongodb-driver-core</artifactId>
|
||||
<version>5.2.1</version>
|
||||
<version>5.2.0</version>
|
||||
</dependency>
|
||||
<!-- XXX: Drop this `rewrite-java-17` version declaration once
|
||||
`rewrite-recipe-bom` pulls in version 8.39.1 or greater. -->
|
||||
<dependency>
|
||||
<groupId>org.openrewrite</groupId>
|
||||
<artifactId>rewrite-java-17</artifactId>
|
||||
<version>8.40.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openrewrite</groupId>
|
||||
@@ -501,7 +501,7 @@
|
||||
<dependency>
|
||||
<groupId>org.openrewrite.recipe</groupId>
|
||||
<artifactId>rewrite-recipe-bom</artifactId>
|
||||
<version>2.23.2</version>
|
||||
<version>2.21.1</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
@@ -515,19 +515,19 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-framework-bom</artifactId>
|
||||
<version>6.2.1</version>
|
||||
<version>6.1.14</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
<version>3.4.1</version>
|
||||
<version>3.3.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-bom</artifactId>
|
||||
<version>6.4.2</version>
|
||||
<version>6.3.4</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
@@ -928,7 +928,7 @@
|
||||
<dependency>
|
||||
<groupId>com.puppycrawl.tools</groupId>
|
||||
<artifactId>checkstyle</artifactId>
|
||||
<version>10.21.0</version>
|
||||
<version>10.20.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.spring.nohttp</groupId>
|
||||
@@ -1227,7 +1227,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.11.2</version>
|
||||
<version>3.11.1</version>
|
||||
<configuration>
|
||||
<additionalJOptions>
|
||||
<additionalJOption>--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</additionalJOption>
|
||||
@@ -1313,7 +1313,7 @@
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>license-maven-plugin</artifactId>
|
||||
<version>2.5.0</version>
|
||||
<version>2.4.0</version>
|
||||
<configuration>
|
||||
<includedLicenses>
|
||||
<!-- The SPDX IDs of licenses of third-party
|
||||
@@ -1368,8 +1368,6 @@
|
||||
| BSD licence
|
||||
| BSD License 3
|
||||
| Eclipse Distribution License (New BSD License)
|
||||
| Eclipse Distribution License - v 1.0
|
||||
| EDL 1.0
|
||||
| New BSD License
|
||||
</licenseMerge>
|
||||
<licenseMerge>
|
||||
@@ -1454,7 +1452,7 @@
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>versions-maven-plugin</artifactId>
|
||||
<version>2.18.0</version>
|
||||
<version>2.17.1</version>
|
||||
<configuration>
|
||||
<updateBuildOutputTimestampPolicy>never</updateBuildOutputTimestampPolicy>
|
||||
</configuration>
|
||||
@@ -1523,7 +1521,7 @@
|
||||
<plugin>
|
||||
<groupId>org.pitest</groupId>
|
||||
<artifactId>pitest-maven</artifactId>
|
||||
<version>1.17.3</version>
|
||||
<version>1.17.1</version>
|
||||
<configuration>
|
||||
<excludedClasses>
|
||||
<!-- AutoValue generated classes. -->
|
||||
@@ -1969,6 +1967,12 @@
|
||||
<!-- XXX: Enable this once we open-source
|
||||
this library. -->
|
||||
-Xep:BetaApi:OFF
|
||||
<!-- This check flags bad member names, but
|
||||
also type names that we may want to accept.
|
||||
Consider contributing a flag to toggle this
|
||||
behavior. See
|
||||
https://github.com/google/error-prone/issues/4616 -->
|
||||
-Xep:IdentifierName:OFF
|
||||
<!-- We don't target JDK 7. -->
|
||||
-Xep:Java7ApiChecker:OFF
|
||||
<!-- We don't target JDK 8. -->
|
||||
@@ -1984,9 +1988,6 @@
|
||||
<!-- XXX: Enable once there are fewer
|
||||
false-positives.
|
||||
-XepOpt:CheckReturnValue:CheckAllMethods=true -->
|
||||
<!-- XXX: Consider renaming flagged types
|
||||
instead. -->
|
||||
-XepOpt:IdentifierName:AllowInitialismsInTypeName=true
|
||||
-XepOpt:InlineMe:SkipInliningsWithComments=false
|
||||
-XepOpt:NullAway:AnnotatedPackages=tech.picnic
|
||||
-XepOpt:NullAway:AssertsEnabled=true
|
||||
@@ -2001,18 +2002,11 @@
|
||||
</arg>
|
||||
<!-- The Error Prone plugin makes certain
|
||||
assumptions about the state of the AST at the
|
||||
moment it is invoked. Those assumptions require
|
||||
the `simple` compile policy. This flag may be
|
||||
dropped after resolution of
|
||||
moment it is invoked. Those assumptions are met
|
||||
when using the `simple` compile policy. This
|
||||
flag may be dropped after resolution of
|
||||
https://bugs.openjdk.java.net/browse/JDK-8155674. -->
|
||||
<arg>-XDcompilePolicy=simple</arg>
|
||||
<!-- Similarly, Error Prone requires that flow
|
||||
analysis has been performed, e.g. to determine
|
||||
whether variables are effectively final. This
|
||||
flag may be dropped if it ever becomes the
|
||||
default. See
|
||||
https://bugs.openjdk.org/browse/JDK-8134117. -->
|
||||
<arg>--should-stop=ifError=FLOW</arg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
releases:
|
||||
- version: 0.19.1
|
||||
compatible:
|
||||
- "2.36.0"
|
||||
- "2.35.1"
|
||||
- "2.35.0"
|
||||
- "2.34.0"
|
||||
@@ -13,7 +12,6 @@ releases:
|
||||
- "2.30.0"
|
||||
- version: 0.19.0
|
||||
compatible:
|
||||
- "2.36.0"
|
||||
- "2.35.1"
|
||||
- "2.35.0"
|
||||
- "2.34.0"
|
||||
@@ -23,7 +21,6 @@ releases:
|
||||
- "2.30.0"
|
||||
- version: 0.18.0
|
||||
compatible:
|
||||
- "2.36.0"
|
||||
- "2.35.1"
|
||||
- "2.35.0"
|
||||
- "2.34.0"
|
||||
|
||||
@@ -45,13 +45,6 @@ for eps_version in ${eps_versions}; do
|
||||
(set +u && echo n | sdk install maven "${mvn_version}")
|
||||
sdk use maven "${mvn_version}"
|
||||
|
||||
# As of version 2.36.0, Error Prone requires that the
|
||||
# `--should-stop=ifError=FLOW` flag is provided. Make sure that this flag is
|
||||
# always specified. (The `-XDcompilePolicy=simple` flag has been specified
|
||||
# since the first Error Prone Support release. It's okay if the added flag is
|
||||
# present more than once; the last variant listed wins.)
|
||||
sed -i 's,<arg>-XDcompilePolicy=simple</arg>,<arg>-XDcompilePolicy=simple</arg><arg>--should-stop=ifError=FLOW</arg>,' pom.xml
|
||||
|
||||
# Collect the list of checks supported by this version of Error Prone
|
||||
# Support.
|
||||
# XXX: Conditionally omit the `MethodReferenceUsage` exclusion once that
|
||||
|
||||
Reference in New Issue
Block a user