From f6e4f73a43296ee0cc5cf4ab34e20a9b2551ec56 Mon Sep 17 00:00:00 2001 From: Ben Manes Date: Tue, 24 Oct 2023 23:57:22 -0700 Subject: [PATCH] run the test suite against the latest jdk --- .github/workflows/build.yml | 16 ++++++++++------ .../benmanes/caffeine/cache/LocalAsyncCache.java | 3 +-- .../benmanes/caffeine/cache/AsyncCacheTest.java | 3 ++- .../java-library-caffeine-conventions.gradle.kts | 2 +- .../testing-caffeine-conventions.gradle.kts | 2 +- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8638d190f1..ab0b64020e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,9 @@ name: build +on: + pull_request: {} + push: + branches: [master, v2.dev, v3.dev] permissions: read-all -on: [ push, pull_request ] env: GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }} @@ -60,13 +63,13 @@ jobs: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Prepare GraalVM - if: matrix.java == 'GraalVM' + if: env.JAVA_VERSION == 'GraalVM' shell: bash run: echo "GRADLE_ARGS=--no-build-cache" >> $GITHUB_ENV - name: Compile uses: ./.github/actions/run-gradle with: - java: ${{ matrix.java }} + java: ${{ env.JAVA_VERSION }} early-access: ${{ env.EA_JDK }} token: ${{ secrets.GITHUB_TOKEN }} arguments: check -x test ${{ env.GRADLE_ARGS }} @@ -139,7 +142,7 @@ jobs: - simulator:check - jcache:check - guava:check - java: [ 11 ] + java: [ 11, 21 ] env: JAVA_VERSION: ${{ matrix.java }} steps: @@ -151,10 +154,11 @@ jobs: allowed-endpoints: ${{ env.ALLOWED_ENDPOINTS }} - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Run tests (${{ matrix.suite }}) + - name: Run tests (${{ env.JAVA_VERSION }}) uses: ./.github/actions/run-gradle + if: (env.JAVA_VERSION == env.PUBLISH_JDK) || !contains(matrix.suite, 'Guava') with: - java: ${{ matrix.java }} + java: ${{ env.JAVA_VERSION }} arguments: ${{ matrix.suite }} token: ${{ secrets.GITHUB_TOKEN }} - name: Format Test Artifact Name diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncCache.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncCache.java index 4d49af10db..a228fcf4b1 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncCache.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncCache.java @@ -26,7 +26,6 @@ import java.util.AbstractSet; import java.util.Collection; import java.util.Collections; -import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; @@ -119,7 +118,7 @@ default CompletableFuture> getAll(Iterable keys, int initialCapacity = calculateHashMapCapacity(keys); var futures = new LinkedHashMap>(initialCapacity); - var proxies = new HashMap>(initialCapacity); + var proxies = new LinkedHashMap>(initialCapacity); for (K key : keys) { if (futures.containsKey(key)) { continue; diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/AsyncCacheTest.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/AsyncCacheTest.java index 347586ec16..9b99e1b838 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/AsyncCacheTest.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/AsyncCacheTest.java @@ -880,9 +880,10 @@ public void getAllBifunction_early_success(AsyncCache cache, CacheCont var bulk = new CompletableFuture>(); var result = cache.getAll(context.absentKeys(), (keysToLoad, executor) -> bulk); var future = cache.asMap().get(key); + future.complete(value); + bulk.complete(context.absent()); // obtrudes the future's value - bulk.complete(context.absent()); assertThat(future).succeedsWith(context.absent().get(key)); assertThat(result.join()).containsExactlyEntriesIn(context.absent()); assertThat(cache.synchronous().asMap()).containsAtLeastEntriesIn(context.absent()); diff --git a/gradle/plugins/src/main/kotlin/lifecycle/java-library-caffeine-conventions.gradle.kts b/gradle/plugins/src/main/kotlin/lifecycle/java-library-caffeine-conventions.gradle.kts index 4252712046..eb7ec6deef 100644 --- a/gradle/plugins/src/main/kotlin/lifecycle/java-library-caffeine-conventions.gradle.kts +++ b/gradle/plugins/src/main/kotlin/lifecycle/java-library-caffeine-conventions.gradle.kts @@ -30,9 +30,9 @@ tasks.withType().configureEach { languageVersion = java.toolchain.languageVersion } + options.compilerArgs.addAll(listOf("-proc:full", "-Xmaxerrs", "500", "-Xmaxwarns", "500")) options.compilerArgs.add("-Xlint:all,-processing,-exports,-auxiliaryclass," + "-requires-automatic,-requires-transitive-automatic") - options.compilerArgs.addAll(listOf("-Xmaxerrs", "500", "-Xmaxwarns", "500")) options.encoding = "UTF-8" } diff --git a/gradle/plugins/src/main/kotlin/lifecycle/testing-caffeine-conventions.gradle.kts b/gradle/plugins/src/main/kotlin/lifecycle/testing-caffeine-conventions.gradle.kts index 345e877cc9..2e509c9210 100644 --- a/gradle/plugins/src/main/kotlin/lifecycle/testing-caffeine-conventions.gradle.kts +++ b/gradle/plugins/src/main/kotlin/lifecycle/testing-caffeine-conventions.gradle.kts @@ -33,7 +33,7 @@ dependencies { } tasks.withType().configureEach { - jvmArgs("-XX:SoftRefLRUPolicyMSPerMB=0") + jvmArgs("-XX:SoftRefLRUPolicyMSPerMB=0", "-XX:+EnableDynamicAgentLoading", "-Xshare:off") if ("debug" in systemProperties) { jvmArgs("-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005") }