diff --git a/.github/actions/run-gradle/action.yml b/.github/actions/run-gradle/action.yml index 54eefc9b64..fa4cbc3354 100644 --- a/.github/actions/run-gradle/action.yml +++ b/.github/actions/run-gradle/action.yml @@ -40,13 +40,13 @@ runs: echo "GRAALVM=true" >> $GITHUB_ENV echo "JAVA_VERSION=${{ inputs.graal }}" >> $GITHUB_ENV - name: Set up JDK ${{ inputs.java }} - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2 + uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4.3.0 if: (inputs.early-access != inputs.java) && (inputs.java != 'GraalVM') with: java-version: ${{ inputs.java }} distribution: temurin - name: Set up JDK ${{ inputs.java }} - uses: oracle-actions/setup-java@83e2004a40aaa491fbc6b4697353b9a75b095efb # v1.3.4 + uses: oracle-actions/setup-java@2e744f723b003fdd759727d0ff654c8717024845 # v1.4.0 if: (inputs.early-access == inputs.java) && (inputs.java != 'GraalVM') with: release: ${{ inputs.java }} @@ -72,14 +72,14 @@ runs: echo "toolchainVersion=${toolchainVersion}" >> $GITHUB_ENV - name: Set up JDK ${{ env.toolchainVersion }} id: setup-gradle-jdk - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2 + uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4.3.0 if: inputs.java != 'GraalVM' with: java-version: ${{ env.toolchainVersion }} distribution: temurin - name: Setup Gradle id: setup-gradle - uses: gradle/actions/setup-gradle@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4.0.1 + uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # v4.1.0 env: JAVA_HOME: ${{ steps.setup-gradle-jdk.outputs.path }} ORG_GRADLE_PROJECT_org.gradle.java.installations.auto-download: 'false' diff --git a/.github/scripts/analyze.sh b/.github/scripts/analyze.sh index 99418a0d15..c8deb3236d 100755 --- a/.github/scripts/analyze.sh +++ b/.github/scripts/analyze.sh @@ -4,5 +4,5 @@ set -eux ./gradlew \ forbiddenApis forbiddenApisTest -DforbiddenApis \ pmdJavaPoet pmdMain pmdCodeGen pmdJmh pmdTest -Dpmd \ - spotbugsJavaPoet spotbugsMain spotbugsCodeGen spotbugsJmh -Dspotbugs \ + spotbugsJavaPoet spotbugsMain spotbugsCodeGen spotbugsJmh spotbugsTest -Dspotbugs \ "$@" diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index 2098f2f5ce..4cf4d84fa3 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block @@ -16,7 +16,7 @@ jobs: github.com:443 - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: actionlint - uses: reviewdog/action-actionlint@4f8f9963ca57a41e5fd5b538dd79dbfbd3e0b38a # v1.54.0 + uses: reviewdog/action-actionlint@12f7cb8c93ab327c99dec3a1d502c0f314978afd # v1.55.0 env: SHELLCHECK_OPTS: -e SC2001 -e SC2035 -e SC2046 -e SC2061 -e SC2086 -e SC2156 with: diff --git a/.github/workflows/analysis.yml b/.github/workflows/analysis.yml index 15270c671f..e52ed19ea2 100644 --- a/.github/workflows/analysis.yml +++ b/.github/workflows/analysis.yml @@ -26,7 +26,7 @@ jobs: JAVA_VERSION: 22 steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block @@ -44,7 +44,7 @@ jobs: JAVA_VERSION: 23 steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block @@ -62,7 +62,7 @@ jobs: JAVA_VERSION: 23 steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index a27adb2c67..18bd31a682 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -16,7 +16,7 @@ jobs: JAVA_VERSION: ${{ matrix.java }} steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 300864425f..45c335d7c4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,7 +53,7 @@ jobs: JAVA_VERSION: ${{ matrix.java }} steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block @@ -170,7 +170,7 @@ jobs: JAVA_VERSION: ${{ matrix.java }} steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block @@ -213,7 +213,7 @@ jobs: if: (github.event_name == 'push') && (github.event.repository.fork == false) steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block @@ -289,7 +289,7 @@ jobs: checks: write steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block @@ -341,7 +341,7 @@ jobs: && endsWith(github.ref, github.event.repository.default_branch) steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block diff --git a/.github/workflows/codacy.yml b/.github/workflows/codacy.yml index b183d6dd3d..aed0389695 100644 --- a/.github/workflows/codacy.yml +++ b/.github/workflows/codacy.yml @@ -13,7 +13,7 @@ jobs: if: github.event.repository.fork == false steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block @@ -47,7 +47,7 @@ jobs: if: steps.check_files.outputs.files_exists == 'true' run: jq -c '.runs |= unique_by({tool, invocations, results})' < results.sarif > codacy.sarif - name: Upload result to GitHub Code Scanning - uses: github/codeql-action/upload-sarif@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + uses: github/codeql-action/upload-sarif@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 if: steps.check_files.outputs.files_exists == 'true' continue-on-error: true with: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index f499e7d75f..f2e8deabef 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block @@ -57,10 +57,10 @@ jobs: java: ${{ env.JAVA_VERSION }} token: ${{ secrets.GITHUB_TOKEN }} - name: Initialize CodeQL - uses: github/codeql-action/init@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + uses: github/codeql-action/init@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 with: languages: java - name: Autobuild - uses: github/codeql-action/autobuild@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + uses: github/codeql-action/autobuild@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + uses: github/codeql-action/analyze@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 diff --git a/.github/workflows/dependency-check.yml b/.github/workflows/dependency-check.yml index bdc44979af..0e8f9d2291 100644 --- a/.github/workflows/dependency-check.yml +++ b/.github/workflows/dependency-check.yml @@ -22,7 +22,7 @@ jobs: && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false) steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block @@ -60,7 +60,7 @@ jobs: with: files: build/reports/dependency-check-report.sarif - name: Upload result to GitHub Code Scanning - uses: github/codeql-action/upload-sarif@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + uses: github/codeql-action/upload-sarif@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 if: steps.check_files.outputs.files_exists == 'true' with: sarif_file: build/reports/dependency-check-report.sarif diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index f8423c0241..6eff859f88 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -10,7 +10,7 @@ jobs: pull-requests: write steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block diff --git a/.github/workflows/dependency-submission-pr-retreive.yml b/.github/workflows/dependency-submission-pr-retreive.yml index 19861f843b..e9547f4ba5 100644 --- a/.github/workflows/dependency-submission-pr-retreive.yml +++ b/.github/workflows/dependency-submission-pr-retreive.yml @@ -16,7 +16,7 @@ jobs: contents: write steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block @@ -35,6 +35,6 @@ jobs: repo1.maven.org:443 services.gradle.org:443 - name: Retrieve and submit dependency graph - uses: gradle/actions/dependency-submission@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4.0.1 + uses: gradle/actions/dependency-submission@d156388eb19639ec20ade50009f3d199ce1e2808 # v4.1.0 with: dependency-graph: download-and-submit diff --git a/.github/workflows/dependency-submission-pr-submit.yml b/.github/workflows/dependency-submission-pr-submit.yml index 0cab8a83ba..38c83ca6f4 100644 --- a/.github/workflows/dependency-submission-pr-submit.yml +++ b/.github/workflows/dependency-submission-pr-submit.yml @@ -13,7 +13,7 @@ jobs: contents: read steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block @@ -33,12 +33,12 @@ jobs: services.gradle.org:443 - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Set up JDK ${{ env.JAVA_VERSION }} - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2 + uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4.3.0 with: java-version: ${{ env.JAVA_VERSION }} distribution: temurin - name: Submit Dependency Graph - uses: gradle/actions/dependency-submission@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4.0.1 + uses: gradle/actions/dependency-submission@d156388eb19639ec20ade50009f3d199ce1e2808 # v4.1.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} dependency-graph: generate-and-upload diff --git a/.github/workflows/dependency-submission.yml b/.github/workflows/dependency-submission.yml index 891d78f690..aa680e5802 100644 --- a/.github/workflows/dependency-submission.yml +++ b/.github/workflows/dependency-submission.yml @@ -13,7 +13,7 @@ jobs: contents: write steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block @@ -33,11 +33,11 @@ jobs: services.gradle.org:443 - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Set up JDK ${{ env.JAVA_VERSION }} - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2 + uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4.3.0 with: java-version: ${{ env.JAVA_VERSION }} distribution: temurin - name: Submit Dependency Graph - uses: gradle/actions/dependency-submission@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4.0.1 + uses: gradle/actions/dependency-submission@d156388eb19639ec20ade50009f3d199ce1e2808 # v4.1.0 with: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} diff --git a/.github/workflows/devskim.yml b/.github/workflows/devskim.yml index 4aabf76a62..2754fa9d33 100644 --- a/.github/workflows/devskim.yml +++ b/.github/workflows/devskim.yml @@ -19,7 +19,7 @@ jobs: security-events: write steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block @@ -31,6 +31,6 @@ jobs: - name: Run DevSkim scanner uses: microsoft/DevSkim-Action@914fa647b406c387000300b2f09bb28691be2b6d # v1.0.14 - name: Upload DevSkim scan results to GitHub Security tab - uses: github/codeql-action/upload-sarif@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + uses: github/codeql-action/upload-sarif@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 with: sarif_file: devskim-results.sarif diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 3ff896014b..16c788a024 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block @@ -34,12 +34,12 @@ jobs: www.graalvm.org:443 - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Set up JDK ${{ env.JAVA_VERSION }} - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2 + uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4.3.0 with: java-version: ${{ env.JAVA_VERSION }} distribution: temurin - name: Setup Gradle - uses: gradle/actions/setup-gradle@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4.0.1 + uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # v4.1.0 with: add-job-summary: never cache-read-only: false diff --git a/.github/workflows/gitleaks.yml b/.github/workflows/gitleaks.yml index c790cc47b9..d99328a0a6 100644 --- a/.github/workflows/gitleaks.yml +++ b/.github/workflows/gitleaks.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml index 548ede3d46..44f055c95c 100644 --- a/.github/workflows/gradle-wrapper-validation.yml +++ b/.github/workflows/gradle-wrapper-validation.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block @@ -18,4 +18,4 @@ jobs: github.com:443 services.gradle.org:443 - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: gradle/actions/wrapper-validation@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4.0.1 + - uses: gradle/actions/wrapper-validation@d156388eb19639ec20ade50009f3d199ce1e2808 # v4.1.0 diff --git a/.github/workflows/qodana.yml b/.github/workflows/qodana.yml index 151931ed95..1e0f374a96 100644 --- a/.github/workflows/qodana.yml +++ b/.github/workflows/qodana.yml @@ -19,7 +19,7 @@ jobs: && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false) steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block @@ -62,12 +62,12 @@ jobs: java: ${{ env.JAVA_VERSION }} arguments: build -x test - name: Qodana - Code Inspection - uses: JetBrains/qodana-action@5983adcc5fdb505e156e5f756a80f2f979fb1ac0 # v2024.2.2 + uses: JetBrains/qodana-action@84494be4d1a2f64ec1c4bfdf475406e246e34672 # v2024.2.3 env: QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }} with: upload-result: true - name: Upload SARIF file for GitHub Advanced Security Dashboard - uses: github/codeql-action/upload-sarif@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + uses: github/codeql-action/upload-sarif@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 with: sarif_file: ${{ runner.temp }}/qodana/results/qodana.sarif.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c5486e0b4d..bc95d9f501 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ jobs: if: github.event.repository.fork == false steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: audit diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index d28a09aa45..30aa7d86d7 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -20,7 +20,7 @@ jobs: if: github.event.repository.fork == false steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block @@ -58,6 +58,6 @@ jobs: path: results.sarif retention-days: 5 - name: Upload to code-scanning - uses: github/codeql-action/upload-sarif@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + uses: github/codeql-action/upload-sarif@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 with: sarif_file: results.sarif diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml index 5e69497f71..c9f09367c3 100644 --- a/.github/workflows/semgrep.yml +++ b/.github/workflows/semgrep.yml @@ -34,7 +34,7 @@ jobs: if: steps.check_files.outputs.files_exists == 'true' run: jq -c '.runs[0].tool.driver.rules |= unique_by(.id)' < results.sarif > semgrep.sarif - name: Upload SARIF file for GitHub Advanced Security Dashboard - uses: github/codeql-action/upload-sarif@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + uses: github/codeql-action/upload-sarif@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 if: steps.check_files.outputs.files_exists == 'true' continue-on-error: true with: diff --git a/.github/workflows/snyk.yml b/.github/workflows/snyk.yml index 8b094accbf..7fd9bba606 100644 --- a/.github/workflows/snyk.yml +++ b/.github/workflows/snyk.yml @@ -42,7 +42,7 @@ jobs: with: files: snyk.sarif - name: Upload result to GitHub Code Scanning - uses: github/codeql-action/upload-sarif@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + uses: github/codeql-action/upload-sarif@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 if: steps.check_files.outputs.files_exists == 'true' with: sarif_file: snyk.sarif diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index 5f89cc112c..6709a8c08c 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block @@ -34,4 +34,4 @@ jobs: objects.githubusercontent.com:443 - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Typos - uses: crate-ci/typos@945d407a5fc9097f020969446a16f581612ab4df # v1.24.5 + uses: crate-ci/typos@8e6a4285bcbde632c5d79900a7779746e8b7ea3f # v1.24.6 diff --git a/.github/workflows/trivy.yml b/.github/workflows/trivy.yml index 532ed7b778..a12433183f 100644 --- a/.github/workflows/trivy.yml +++ b/.github/workflows/trivy.yml @@ -12,7 +12,7 @@ jobs: security-events: write steps: - name: Harden Runner - uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: disable-sudo: true egress-policy: block @@ -29,6 +29,6 @@ jobs: format: sarif output: trivy-results.sarif - name: Upload Trivy scan results to GitHub Security tab - uses: github/codeql-action/upload-sarif@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + uses: github/codeql-action/upload-sarif@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 with: sarif_file: trivy-results.sarif diff --git a/caffeine/build.gradle.kts b/caffeine/build.gradle.kts index 846d3d374e..8e3f915839 100644 --- a/caffeine/build.gradle.kts +++ b/caffeine/build.gradle.kts @@ -378,7 +378,7 @@ data class Scenario(val implementation: Implementation, } fun testName(): String = buildString { - append(keys.name.lowercase() + "Keys") + append(keys.name.lowercase()).append("Keys") append("And").append(values).append("Values") if (stats == Stats.Enabled) { append("Stats") diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/AsMapTest.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/AsMapTest.java index f9f00a7fde..9b308fe6be 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/AsMapTest.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/AsMapTest.java @@ -39,8 +39,8 @@ import static org.slf4j.event.Level.WARN; import java.util.AbstractMap; -import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; @@ -1810,7 +1810,7 @@ public void keySet_removeAll_null(Map map, CacheContext context) { @CheckNoStats @Test(dataProvider = "caches") public void keySet_removeAll_nullKey(Map map, CacheContext context) { - map.keySet().removeAll(Arrays.asList((Object) null)); + map.keySet().removeAll(Collections.singletonList((Object) null)); assertThat(map).isEqualTo(context.original()); } @@ -1978,7 +1978,7 @@ public void keySet_retainAll_null(Map map, CacheContext context) { @CheckNoStats @Test(dataProvider = "caches") public void keySet_retainAll_nullKey(Map map, CacheContext context) { - map.keySet().retainAll(Arrays.asList((Object) null)); + map.keySet().retainAll(Collections.singletonList((Object) null)); assertThat(map).isExhaustivelyEmpty(); } @@ -2221,7 +2221,7 @@ public void values_removeAll_null(Map map, CacheContext context) { @CheckNoStats @Test(dataProvider = "caches") public void values_removeAll_nullValue(Map map, CacheContext context) { - map.values().removeAll(Arrays.asList((Object) null)); + map.values().removeAll(Collections.singletonList((Object) null)); assertThat(map).isEqualTo(context.original()); } @@ -2382,7 +2382,7 @@ public void values_retainAll_null(Map map, CacheContext context) { @CheckNoStats @Test(dataProvider = "caches") public void values_retainAll_nullValue(Map map, CacheContext context) { - map.values().retainAll(Arrays.asList((Object) null)); + map.values().retainAll(Collections.singletonList((Object) null)); assertThat(map).isExhaustivelyEmpty(); } @@ -2651,7 +2651,7 @@ public void entrySet_removeAll_null(Map map, CacheContext context) { @CheckNoStats @Test(dataProvider = "caches") public void entrySet_removeAll_nullEntry(Map map, CacheContext context) { - map.entrySet().removeAll(Arrays.asList((Object) null)); + map.entrySet().removeAll(Collections.singletonList((Object) null)); assertThat(map).isEqualTo(context.original()); } @@ -2853,7 +2853,7 @@ public void entrySet_retainAll_null(Map map, CacheContext context) { @CheckNoStats @Test(dataProvider = "caches") public void entrySet_retainAll_nullEntry(Map map, CacheContext context) { - map.entrySet().retainAll(Arrays.asList((Object) null)); + map.entrySet().retainAll(Collections.singletonList((Object) null)); assertThat(map).isExhaustivelyEmpty(); } diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/AsyncAsMapTest.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/AsyncAsMapTest.java index c1b3b05cd0..57dd96cb68 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/AsyncAsMapTest.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/AsyncAsMapTest.java @@ -41,6 +41,7 @@ import java.util.AbstractMap; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -1534,7 +1535,7 @@ public void keySet_removeAll_null(AsyncCache cache, CacheContext conte @CheckNoStats @Test(dataProvider = "caches") public void keySet_removeAll_nullKey(AsyncCache cache, CacheContext context) { - cache.asMap().keySet().removeAll(Arrays.asList((Object) null)); + cache.asMap().keySet().removeAll(Collections.singletonList((Object) null)); assertThat(cache.synchronous().asMap()).isEqualTo(context.original()); } @@ -1698,7 +1699,7 @@ public void keySet_retainAll_null(AsyncCache cache, CacheContext conte @CheckNoStats @Test(dataProvider = "caches") public void keySet_retainAll_nullKey(AsyncCache cache, CacheContext context) { - cache.asMap().keySet().retainAll(Arrays.asList((Object) null)); + cache.asMap().keySet().retainAll(Collections.singletonList((Object) null)); assertThat(cache).isEmpty(); } @@ -1948,7 +1949,7 @@ public void values_removeAll_null(AsyncCache cache, CacheContext conte @CheckNoStats @Test(dataProvider = "caches") public void values_removeAll_nullValue(AsyncCache cache, CacheContext context) { - cache.asMap().values().removeAll(Arrays.asList((Object) null)); + cache.asMap().values().removeAll(Collections.singletonList((Object) null)); assertThat(cache.synchronous().asMap()).isEqualTo(context.original()); } @@ -2126,7 +2127,7 @@ public void values_retainAll_null(AsyncCache cache, CacheContext conte @CheckNoStats @Test(dataProvider = "caches") public void values_retainAll_nullValue(AsyncCache cache, CacheContext context) { - cache.asMap().values().retainAll(Arrays.asList((Object) null)); + cache.asMap().values().retainAll(Collections.singletonList((Object) null)); assertThat(cache).isEmpty(); } @@ -2410,7 +2411,7 @@ public void entrySet_removeAll_null(AsyncCache cache, CacheContext con @CheckNoStats @Test(dataProvider = "caches") public void entrySet_removeAll_nullEntry(AsyncCache cache, CacheContext context) { - cache.asMap().entrySet().removeAll(Arrays.asList((Object) null)); + cache.asMap().entrySet().removeAll(Collections.singletonList((Object) null)); assertThat(cache.synchronous().asMap()).isEqualTo(context.original()); } @@ -2614,7 +2615,7 @@ public void entrySet_retainAll_null(AsyncCache cache, CacheContext con @CheckNoStats @Test(dataProvider = "caches") public void entrySet_retainAll_nullEntry(AsyncCache cache, CacheContext context) { - cache.asMap().entrySet().retainAll(Arrays.asList((Object) null)); + cache.asMap().entrySet().retainAll(Collections.singletonList((Object) null)); assertThat(cache).isEmpty(); } diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/AsyncTest.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/AsyncTest.java index 2a8290ae4a..233358e41a 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/AsyncTest.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/AsyncTest.java @@ -30,6 +30,7 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; import org.mockito.Mockito; import org.testng.annotations.DataProvider; @@ -80,7 +81,7 @@ public void getWhenSuccessful_success(CompletableFuture future) { @Test public void getWhenSuccessful_success_async() { var future = new CompletableFuture(); - var result = new AtomicInteger(); + var result = new AtomicReference(); ConcurrentTestHarness.execute(() -> { result.set(1); result.set(Async.getWhenSuccessful(future)); diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/BoundedLocalCacheTest.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/BoundedLocalCacheTest.java index c3147e5d70..796e1aa918 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/BoundedLocalCacheTest.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/BoundedLocalCacheTest.java @@ -769,7 +769,8 @@ public void evict_wtinylfu(Cache cache, CacheContext context) { assertThat(context).stats().evictions(6); } - private static void checkReorder(Cache cache, List keys, List expect) { + private static void checkReorder(Cache cache, + Iterable keys, Iterable expect) { for (var key : keys) { var value = cache.getIfPresent(key); assertThat(value).isNotNull(); @@ -777,12 +778,12 @@ private static void checkReorder(Cache cache, List keys, List cache, List keys, List expect) { + private static void checkEvict(Cache cache, Iterable keys, Iterable expect) { keys.forEach(i -> cache.put(i, i)); checkContainsInOrder(cache, expect); } - private static void checkContainsInOrder(Cache cache, List expect) { + private static void checkContainsInOrder(Cache cache, Iterable expect) { var evictionOrder = cache.policy().eviction().orElseThrow().coldest(Integer.MAX_VALUE).keySet(); assertThat(cache).containsExactlyKeys(expect); assertThat(evictionOrder).containsExactlyElementsIn(expect).inOrder(); @@ -2839,7 +2840,7 @@ static final class BadBoundedLocalCache extends BoundedLocalCache { } static final class BadLocalCacheFactory implements LocalCacheFactory { @Override public BoundedLocalCache newInstance(Caffeine builder, - AsyncCacheLoader cacheLoader, boolean async) throws Throwable { + AsyncCacheLoader cacheLoader, boolean async) { throw new IllegalStateException(); } } diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/CacheTest.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/CacheTest.java index 2e377de270..9483f5a9ac 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/CacheTest.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/CacheTest.java @@ -868,7 +868,7 @@ public void invalidateAll_removalListener_writeback(Cache cache, Cache @CacheSpec @CheckNoStats @Test(dataProvider = "caches") - public void cleanup(Cache cache, CacheContext context) { + public void cleanUp(Cache cache, CacheContext context) { cache.cleanUp(); } diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/ExpirationTest.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/ExpirationTest.java index c78d03dd39..4342d0f82a 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/ExpirationTest.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/ExpirationTest.java @@ -42,7 +42,6 @@ import static org.slf4j.event.Level.WARN; import java.time.Duration; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -73,7 +72,9 @@ import com.github.benmanes.caffeine.cache.testing.CheckNoStats; import com.github.benmanes.caffeine.testing.Int; import com.google.common.base.Splitter; +import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Maps; +import com.google.common.collect.Multimaps; import com.google.common.collect.Range; import com.google.common.util.concurrent.Futures; @@ -1217,15 +1218,15 @@ public void compute(Map map, CacheContext context) { return value; })).isEqualTo(value); - var evicted = new ArrayList>(context.original().size()); + var evicted = ArrayListMultimap.create(); var difference = Maps.difference(context.original(), map); - evicted.addAll(difference.entriesOnlyOnRight().entrySet()); - evicted.addAll(difference.entriesOnlyOnLeft().entrySet()); - evicted.add(entry(key, context.original().get(key))); + evicted.putAll(Multimaps.forMap(difference.entriesOnlyOnRight())); + evicted.putAll(Multimaps.forMap(difference.entriesOnlyOnLeft())); + evicted.put(key, context.original().get(key)); assertThat(evicted).hasSize(context.original().size() - map.size() + 1); assertThat(context).notifications().withCause(EXPIRED) - .contains(evicted.toArray(Map.Entry[]::new)) + .contains(evicted.entries()) .exclusively(); if (context.expiryType() == CacheExpiry.MOCKITO) { @@ -1357,15 +1358,15 @@ public void merge(Map map, CacheContext context) { throw new AssertionError("Should never be called"); })).isEqualTo(value); - var evicted = new ArrayList>(context.original().size()); + var evicted = ArrayListMultimap.create(); var difference = Maps.difference(context.original(), map); - evicted.addAll(difference.entriesOnlyOnRight().entrySet()); - evicted.addAll(difference.entriesOnlyOnLeft().entrySet()); - evicted.add(entry(key, context.original().get(key))); + evicted.putAll(Multimaps.forMap(difference.entriesOnlyOnRight())); + evicted.putAll(Multimaps.forMap(difference.entriesOnlyOnLeft())); + evicted.put(key, context.original().get(key)); assertThat(evicted).hasSize(context.original().size() - map.size() + 1); assertThat(context).notifications().withCause(EXPIRED) - .contains(evicted.toArray(Map.Entry[]::new)) + .contains(evicted.entries()) .exclusively(); } diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/ReferenceTest.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/ReferenceTest.java index b745bf969f..253b11f3c6 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/ReferenceTest.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/ReferenceTest.java @@ -39,6 +39,7 @@ import java.util.AbstractMap; import java.util.AbstractMap.SimpleEntry; +import java.util.AbstractMap.SimpleImmutableEntry; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -1300,13 +1301,14 @@ public Object[][] providesReferences() { }; } + @SuppressWarnings("MapEntry") private static List> getExpectedAfterGc( CacheContext context, Map original) { var expected = new ArrayList>(); original.forEach((key, value) -> { key = context.isStrongKeys() ? new Int(key) : null; value = context.isStrongValues() ? new Int(value) : null; - expected.add(new SimpleEntry<>(key, value)); + expected.add(new SimpleImmutableEntry<>(key, value)); }); return expected; } diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/Stresser.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/Stresser.java index 7ae14c4e75..c3d6a635a7 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/Stresser.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/Stresser.java @@ -116,14 +116,16 @@ private void execute() { } private void status() { - int drainStatus; + var evictionLock = local.evictionLock; int pendingWrites; - local.evictionLock.lock(); + int drainStatus; + + evictionLock.lock(); try { pendingWrites = local.writeBuffer.size(); drainStatus = local.drainStatusAcquire(); } finally { - local.evictionLock.unlock(); + evictionLock.unlock(); } var elapsedTime = LocalTime.ofSecondOfDay(stopwatch.elapsed(SECONDS)); @@ -134,8 +136,7 @@ private void status() { System.out.printf(US, "Evictions = %,d%n", cache.stats().evictionCount()); System.out.printf(US, "Size = %,d (max: %,d)%n", local.data.mappingCount(), workload.maxEntries); - System.out.printf(US, "Lock = [%s%n", StringUtils.substringAfter( - local.evictionLock.toString(), "[")); + System.out.printf(US, "Lock = [%s%n", StringUtils.substringAfter(evictionLock.toString(), "[")); System.out.printf(US, "Pending reloads = %,d%n", local.refreshes.size()); System.out.printf(US, "Pending tasks = %,d%n", ForkJoinPool.commonPool().getQueuedSubmissionCount()); @@ -163,8 +164,8 @@ private enum Workload { WRITE(MAX_THREADS, WRITE_MAX_SIZE), REFRESH(MAX_THREADS, TOTAL_KEYS / 4); - private final int maxThreads; - private final int maxEntries; + final int maxThreads; + final int maxEntries; Workload(int maxThreads, int maxEntries) { this.maxThreads = maxThreads; diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/CacheContextSubject.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/CacheContextSubject.java index 8ee8905408..a61b262db9 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/CacheContextSubject.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/CacheContextSubject.java @@ -32,7 +32,7 @@ import java.util.AbstractMap.SimpleEntry; import java.util.Arrays; -import java.util.List; +import java.util.Collection; import java.util.Map; import java.util.Map.Entry; import java.util.function.BiConsumer; @@ -366,7 +366,7 @@ public Exclusive contains(Map map) { } @CanIgnoreReturnValue - public Exclusive contains(List> entries) { + public Exclusive contains(Collection> entries) { return contains(entries.toArray(Map.Entry[]::new)); } diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/CacheSpec.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/CacheSpec.java index 148facf432..b94d036fae 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/CacheSpec.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/CacheSpec.java @@ -31,7 +31,6 @@ import java.lang.annotation.Target; import java.time.Duration; import java.util.Collection; -import java.util.HashMap; import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; @@ -57,6 +56,7 @@ import com.github.benmanes.caffeine.cache.testing.RemovalListeners.ConsumingRemovalListener; import com.github.benmanes.caffeine.testing.ConcurrentTestHarness; import com.github.benmanes.caffeine.testing.Int; +import com.google.common.collect.Maps; import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.testing.TestingExecutors; import com.google.errorprone.annotations.CanIgnoreReturnValue; @@ -471,7 +471,7 @@ enum Loader implements CacheLoader { throw new UnsupportedOperationException(); } @Override public Map loadAll(Set keys) { - var result = new HashMap(keys.size()); + Map result = Maps.newHashMapWithExpectedSize(keys.size()); for (Int key : keys) { result.put(key, key); intern(key); @@ -484,7 +484,7 @@ enum Loader implements CacheLoader { throw new UnsupportedOperationException(); } @Override public Map loadAll(Set keys) throws Exception { - var result = new HashMap(keys.size()); + Map result = Maps.newHashMapWithExpectedSize(keys.size()); for (Int key : keys) { result.put(key, NEGATIVE.load(key)); intern(key); diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/CacheValidationListener.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/CacheValidationListener.java index 63ac22874b..20084fdce1 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/CacheValidationListener.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/CacheValidationListener.java @@ -290,9 +290,11 @@ private static void resetCache(ITestResult testResult) { } private static void clearTestResults(ITestResult testResult) { - var result = (TestResult) testResult; - result.setParameters(EMPTY_PARAMS); - result.setContext(testngContext); + testResult.setParameters(EMPTY_PARAMS); + if (testResult instanceof TestResult) { + var result = (TestResult) testResult; + result.setContext(testngContext); + } } private static void stringifyParams(ITestResult testResult, boolean briefParams) { diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/testing/ConcurrentTestHarness.java b/caffeine/src/test/java/com/github/benmanes/caffeine/testing/ConcurrentTestHarness.java index 2ebf38f509..367c889edb 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/testing/ConcurrentTestHarness.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/testing/ConcurrentTestHarness.java @@ -25,6 +25,7 @@ import java.util.concurrent.ThreadFactory; import java.util.concurrent.atomic.AtomicReferenceArray; +import com.google.common.base.Throwables; import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.common.util.concurrent.Uninterruptibles; import com.google.errorprone.annotations.CanIgnoreReturnValue; @@ -90,10 +91,13 @@ public static TestResult timeTasks(int nThreads, Callable task) { startGate.await(); try { results.set(index, task.call()); + } catch (Exception e) { + Throwables.throwIfUnchecked(e); + throw new RuntimeException(e); } finally { endGate.countDown(); } - } catch (Exception e) { + } catch (InterruptedException e) { throw new RuntimeException(e); } }); diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/testing/LoggingEvents.java b/caffeine/src/test/java/com/github/benmanes/caffeine/testing/LoggingEvents.java index 0d5d293273..4b793c3624 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/testing/LoggingEvents.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/testing/LoggingEvents.java @@ -46,7 +46,7 @@ public final class LoggingEvents extends ForwardingList { private ImmutableList filteredEvents; private boolean exclusive; - private LoggingEvents(List events) { + private LoggingEvents(Iterable events) { this.events = ImmutableList.copyOf(events); this.predicates = new ArrayList<>(); } diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/testing/Threads.java b/caffeine/src/test/java/com/github/benmanes/caffeine/testing/Threads.java index cc5113bdbf..891087f1d4 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/testing/Threads.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/testing/Threads.java @@ -15,20 +15,21 @@ */ package com.github.benmanes.caffeine.testing; +import static com.github.benmanes.caffeine.testing.ConcurrentTestHarness.executor; +import static com.github.benmanes.caffeine.testing.ConcurrentTestHarness.timeTasks; import static com.google.common.collect.ImmutableList.toImmutableList; import static com.google.common.truth.Truth.assertThat; import static java.util.Locale.US; import static org.testng.Assert.fail; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; -import java.util.List; import java.util.Queue; import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; @@ -42,7 +43,6 @@ import com.google.common.base.Throwables; import com.google.common.collect.ImmutableList; import com.google.common.util.concurrent.MoreExecutors; -import com.google.common.util.concurrent.ThreadFactoryBuilder; /** * Shared utilities for multithreaded tests. @@ -61,26 +61,21 @@ private Threads() {} public static void runTest(A collection, ImmutableList> operations) { var failures = new ConcurrentLinkedQueue(); var thrasher = new Thrasher(collection, failures, operations); - Threads.executeWithTimeOut(failures, () -> - ConcurrentTestHarness.timeTasks(Threads.NTHREADS, thrasher)); + Threads.executeWithTimeOut(failures, () -> timeTasks(Threads.NTHREADS, thrasher)); assertThat(failures).isEmpty(); } public static void executeWithTimeOut(Queue failures, Callable task) { - @SuppressWarnings("PMD.CloseResource") - var es = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setDaemon(true).build()); try { - var future = es.submit(task); + var future = executor.submit(task); long timeNS = future.get(TIMEOUT, TimeUnit.SECONDS); logger.debug("\nExecuted in {} second(s)", TimeUnit.NANOSECONDS.toSeconds(timeNS)); } catch (ExecutionException e) { fail("Exception during test: " + e, e); } catch (TimeoutException e) { - handleTimeout(failures, es, e); + handleTimeout(failures, executor, e); } catch (InterruptedException e) { fail("", e); - } finally { - es.shutdown(); } } @@ -114,7 +109,7 @@ public static ImmutableList> workingSets(int nThreads, int it * @param samples the number of variants to create * @param baseline the base working set to build from */ - private static ImmutableList> shuffle(int samples, List baseline) { + private static ImmutableList> shuffle(int samples, Collection baseline) { var workingSets = new ArrayList>(samples); var workingSet = new ArrayList(baseline); for (int i = 0; i < samples; i++) { diff --git a/gradle/config/spotbugs/exclude.xml b/gradle/config/spotbugs/exclude.xml index 9bcda48541..a0e6893371 100644 --- a/gradle/config/spotbugs/exclude.xml +++ b/gradle/config/spotbugs/exclude.xml @@ -289,16 +289,15 @@ - + + + + - - - - @@ -306,7 +305,9 @@ - + @@ -417,8 +418,11 @@ - + @@ -477,4 +481,200 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/guava/src/test/java/com/github/benmanes/caffeine/guava/CaffeinatedGuavaTest.java b/guava/src/test/java/com/github/benmanes/caffeine/guava/CaffeinatedGuavaTest.java index a6e2b1d2e6..ad5af82de7 100644 --- a/guava/src/test/java/com/github/benmanes/caffeine/guava/CaffeinatedGuavaTest.java +++ b/guava/src/test/java/com/github/benmanes/caffeine/guava/CaffeinatedGuavaTest.java @@ -120,8 +120,7 @@ void cacheLoader_null() { @Override public Integer load(Integer key) { throw new UnsupportedOperationException(); } - @Override - public ListenableFuture reload(Integer key, Integer oldValue) { + @Override public ListenableFuture reload(Integer key, Integer oldValue) { return null; } }); diff --git a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/configuration/TypesafeConfigurationTest.java b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/configuration/TypesafeConfigurationTest.java index 1ef6198f0c..03ba869052 100644 --- a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/configuration/TypesafeConfigurationTest.java +++ b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/configuration/TypesafeConfigurationTest.java @@ -29,6 +29,7 @@ import javax.cache.Cache; import javax.cache.Caching; +import javax.cache.configuration.CompleteConfiguration; import javax.cache.expiry.Duration; import javax.cache.expiry.ExpiryPolicy; @@ -287,7 +288,7 @@ static void checkStoreByValue(CaffeineConfiguration config) { assertThat(config.getCopierFactory().create()).isInstanceOf(JavaSerializationCopier.class); } - static void checkListener(CaffeineConfiguration config) { + static void checkListener(CompleteConfiguration config) { var listener = Iterables.getOnlyElement(config.getCacheEntryListenerConfigurations()); assertThat(listener.getCacheEntryListenerFactory().create()) .isInstanceOf(TestCacheEntryListener.class); @@ -297,7 +298,7 @@ static void checkListener(CaffeineConfiguration config) { assertThat(listener.isOldValueRequired()).isTrue(); } - static void checkLazyExpiration(CaffeineConfiguration config) { + static void checkLazyExpiration(CompleteConfiguration config) { ExpiryPolicy expiry = config.getExpiryPolicyFactory().create(); assertThat(expiry.getExpiryForCreation()).isEqualTo(Duration.ONE_MINUTE); assertThat(expiry.getExpiryForUpdate()).isEqualTo(Duration.FIVE_MINUTES); diff --git a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/issues/Issue1065Test.java b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/issues/Issue1065Test.java index 7fb4ce9696..ae0b995755 100644 --- a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/issues/Issue1065Test.java +++ b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/issues/Issue1065Test.java @@ -118,9 +118,10 @@ public void deadlock() throws Exception { fail(i, threads); } } - } finally { executor.shutdown(); executor.awaitTermination(1, TimeUnit.MINUTES); + } finally { + executor.shutdownNow(); } } diff --git a/simulator/src/test/java/com/github/benmanes/caffeine/cache/simulator/admission/bloom/MembershipTest.java b/simulator/src/test/java/com/github/benmanes/caffeine/cache/simulator/admission/bloom/MembershipTest.java index b3e5f8ea3f..e40faf0dac 100644 --- a/simulator/src/test/java/com/github/benmanes/caffeine/cache/simulator/admission/bloom/MembershipTest.java +++ b/simulator/src/test/java/com/github/benmanes/caffeine/cache/simulator/admission/bloom/MembershipTest.java @@ -32,6 +32,7 @@ import com.github.benmanes.caffeine.cache.simulator.membership.FilterType; import com.github.benmanes.caffeine.cache.simulator.membership.Membership; import com.github.benmanes.caffeine.cache.simulator.membership.bloom.BloomFilter; +import com.google.common.base.CaseFormat; import com.google.errorprone.annotations.Var; import com.jakewharton.fliptables.FlipTable; import com.typesafe.config.Config; @@ -53,17 +54,17 @@ public final class MembershipTest { @SuppressWarnings("Varifier") @Test(dataProvider = "filterTypes") - public void bloomFilterTest(FilterType filterType) { + public void bloomFilter(FilterType filterType) { var capacities = new IntArrayList(IntList.of(0, 1)); for (int capacity = 2 << 10; capacity < (2 << 22); capacity <<= 2) { capacities.add(capacity); } var random = new Random(); + var rows = new ArrayList(); for (int capacity : capacities) { long[] input = random.longs(capacity).distinct().toArray(); Config config = getConfig(filterType, capacity); - var rows = new ArrayList(); Membership filter = filterType.create(config); int falsePositives = falsePositives(filter, input); @@ -75,9 +76,9 @@ public void bloomFilterTest(FilterType filterType) { } rows.add(row(filterType, capacity, expectedInsertions, falsePositives, falsePositiveRate)); - if (display) { - printTable(rows); - } + } + if (display) { + printTable(rows); } } @@ -136,7 +137,7 @@ private static Config getConfig(FilterType filterType, int capacity) { private static String[] row(FilterType filterType, int capacity, int expectedInsertions, int falsePositives, double falsePositiveRate) { return new String[] { - filterType.toString(), + CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, filterType.toString()), String.format(US, "%,d", capacity), String.format(US, "%,d", expectedInsertions), String.format(US, "%,d (%.2f %%)", falsePositives, 100 * falsePositiveRate),