diff --git a/caffeine/build.gradle.kts b/caffeine/build.gradle.kts index 1441c07949..33c99a2d34 100644 --- a/caffeine/build.gradle.kts +++ b/caffeine/build.gradle.kts @@ -83,14 +83,18 @@ dependencies { val compileCodeGenJava by tasks.existing(JavaCompile::class) { classpath = sourceSets["main"].runtimeClasspath + sourceSets["main"].output dependsOn(tasks.compileJava) - options.isDebug = false - options.errorprone { - disable("FieldMissingNullable") - disable("MissingOverride") - disable("MemberName") - disable("Varifier") - nullaway.disable() + options.apply { + compilerArgs.remove("-parameters") + isDebug = false + + errorprone { + disable("FieldMissingNullable") + disable("MissingOverride") + disable("MemberName") + disable("Varifier") + nullaway.disable() + } } } diff --git a/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/LocalCacheFactoryGenerator.java b/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/LocalCacheFactoryGenerator.java index ec02741647..24b398fe5f 100644 --- a/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/LocalCacheFactoryGenerator.java +++ b/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/LocalCacheFactoryGenerator.java @@ -117,7 +117,7 @@ private void reformat() throws IOException { .filter(path -> path.endsWith(".java")) .collect(toImmutableList()); ToolProvider.findFirst("google-java-format").ifPresent(formatter -> { - int result = formatter.run(System.err, System.out, + int result = formatter.run(System.out, System.err, Stream.concat(Stream.of("-i"), files.stream()).toArray(String[]::new)); checkState(result == 0, "Java formatting failed with %s exit code", result); }); diff --git a/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/NodeFactoryGenerator.java b/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/NodeFactoryGenerator.java index 65d5714197..89a53b7026 100644 --- a/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/NodeFactoryGenerator.java +++ b/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/NodeFactoryGenerator.java @@ -119,7 +119,7 @@ private void reformat() throws IOException { .filter(path -> path.endsWith(".java")) .collect(toImmutableList()); ToolProvider.findFirst("google-java-format").ifPresent(formatter -> { - int result = formatter.run(System.err, System.out, + int result = formatter.run(System.out, System.err, Stream.concat(Stream.of("-i"), files.stream()).toArray(String[]::new)); checkState(result == 0, "Java formatting failed with %s exit code", result); }); 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 bb229747aa..7b9237f41c 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 @@ -200,7 +200,7 @@ default void handleCompletion(K key, CompletableFuture valueFuture, long startTime, boolean recordMiss) { var completed = new AtomicBoolean(); valueFuture.whenComplete((value, error) -> { - if (!completed.compareAndSet(false, true)) { + if (!completed.compareAndSet(/* expectedValue= */ false, /* newValue= */ true)) { // Ignore multiple invocations due to ForkJoinPool retrying on delays return; } 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 a77f408291..42d54382ab 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 @@ -2562,7 +2562,8 @@ public void cacheFactory_noSuchMethod() { public void cacheFactory_brokenConstructor() { var builder = Caffeine.newBuilder(); var factory = LocalCacheFactory.loadFactory("BoundedLocalCacheTest$BadBoundedLocalCache"); - assertThrows(IllegalStateException.class, () -> factory.newInstance(builder, null, false)); + assertThrows(IllegalStateException.class, () -> factory.newInstance(builder, + /* cacheLoader= */ null, /* isAsync= */ false)); } @Test(groups = "isolated") @@ -2650,7 +2651,7 @@ public void nodeFactory_badConstructor() { @Test public void nodeFactory_classNotFound() { var expected = assertThrows(IllegalStateException.class, () -> - NodeFactory.loadFactory(/* className */ "")); + NodeFactory.loadFactory(/* className= */ "")); assertThat(expected).hasCauseThat().isInstanceOf(ClassNotFoundException.class); } diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/CaffeineSpecGuavaTest.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/CaffeineSpecGuavaTest.java index 7fb6033717..aa2b2fc4dd 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/CaffeineSpecGuavaTest.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/CaffeineSpecGuavaTest.java @@ -39,9 +39,9 @@ public class CaffeineSpecGuavaTest extends TestCase { public void testParse_empty() { CaffeineSpec spec = parse(""); - assertEquals(spec.initialCapacity, UNSET_INT); - assertEquals(spec.maximumSize, UNSET_INT); - assertEquals(spec.maximumWeight, UNSET_INT); + assertThat(spec.initialCapacity).isEqualTo(UNSET_INT); + assertThat(spec.maximumSize).isEqualTo(UNSET_INT); + assertThat(spec.maximumWeight).isEqualTo(UNSET_INT); assertNull(spec.keyStrength); assertNull(spec.valueStrength); assertNull(spec.expireAfterAccess); @@ -52,9 +52,9 @@ public void testParse_empty() { public void testParse_initialCapacity() { CaffeineSpec spec = parse("initialCapacity=10"); - assertEquals(10, spec.initialCapacity); - assertEquals(spec.maximumSize, UNSET_INT); - assertEquals(spec.maximumWeight, UNSET_INT); + assertThat(spec.initialCapacity).isEqualTo(10); + assertThat(spec.maximumSize).isEqualTo(UNSET_INT); + assertThat(spec.maximumWeight).isEqualTo(UNSET_INT); assertNull(spec.keyStrength); assertNull(spec.valueStrength); assertNull(spec.expireAfterWrite); @@ -71,8 +71,8 @@ public void testParse_initialCapacityRepeated() { public void testParse_maximumSize() { CaffeineSpec spec = parse("maximumSize=9000"); - assertEquals(spec.initialCapacity, UNSET_INT); - assertEquals(9000, spec.maximumSize); + assertThat(spec.initialCapacity).isEqualTo(UNSET_INT); + assertThat(spec.maximumSize).isEqualTo(9000); assertNull(spec.keyStrength); assertNull(spec.valueStrength); assertNull(spec.expireAfterWrite); @@ -88,8 +88,8 @@ public void testParse_maximumSizeRepeated() { public void testParse_maximumWeight() { CaffeineSpec spec = parse("maximumWeight=9000"); - assertEquals(spec.initialCapacity, UNSET_INT); - assertEquals(9000, spec.maximumWeight); + assertThat(spec.initialCapacity).isEqualTo(UNSET_INT); + assertThat(spec.maximumWeight).isEqualTo(9000); assertNull(spec.keyStrength); assertNull(spec.valueStrength); assertNull(spec.expireAfterWrite); @@ -109,10 +109,10 @@ public void testParse_maximumSizeAndMaximumWeight() { public void testParse_weakKeys() { CaffeineSpec spec = parse("weakKeys"); - assertEquals(spec.initialCapacity, UNSET_INT); - assertEquals(spec.maximumSize, UNSET_INT); - assertEquals(spec.maximumWeight, UNSET_INT); - assertEquals(Strength.WEAK, spec.keyStrength); + assertThat(spec.initialCapacity).isEqualTo(UNSET_INT); + assertThat(spec.maximumSize).isEqualTo(UNSET_INT); + assertThat(spec.maximumWeight).isEqualTo(UNSET_INT); + assertThat(spec.keyStrength).isEqualTo(Strength.WEAK); assertNull(spec.valueStrength); assertNull(spec.expireAfterWrite); assertNull(spec.expireAfterAccess); @@ -131,11 +131,11 @@ public void testParse_repeatedKeyStrength() { public void testParse_softValues() { CaffeineSpec spec = parse("softValues"); - assertEquals(spec.initialCapacity, UNSET_INT); - assertEquals(spec.maximumSize, UNSET_INT); - assertEquals(spec.maximumWeight, UNSET_INT); + assertThat(spec.initialCapacity).isEqualTo(UNSET_INT); + assertThat(spec.maximumSize).isEqualTo(UNSET_INT); + assertThat(spec.maximumWeight).isEqualTo(UNSET_INT); assertNull(spec.keyStrength); - assertEquals(Strength.SOFT, spec.valueStrength); + assertThat(spec.valueStrength).isEqualTo(Strength.SOFT); assertNull(spec.expireAfterWrite); assertNull(spec.expireAfterAccess); assertNull(spec.refreshAfterWrite); @@ -149,11 +149,11 @@ public void testParse_softValuesCannotHaveValue() { public void testParse_weakValues() { CaffeineSpec spec = parse("weakValues"); - assertEquals(spec.initialCapacity, UNSET_INT); - assertEquals(spec.maximumSize, UNSET_INT); - assertEquals(spec.maximumWeight, UNSET_INT); + assertThat(spec.initialCapacity).isEqualTo(UNSET_INT); + assertThat(spec.maximumSize).isEqualTo(UNSET_INT); + assertThat(spec.maximumWeight).isEqualTo(UNSET_INT); assertNull(spec.keyStrength); - assertEquals(Strength.WEAK, spec.valueStrength); + assertThat(spec.valueStrength).isEqualTo(Strength.WEAK); assertNull(spec.expireAfterWrite); assertNull(spec.expireAfterAccess); assertNull(spec.refreshAfterWrite); @@ -177,12 +177,12 @@ public void testParse_repeatedValueStrength() { public void testParse_writeExpirationDays() { CaffeineSpec spec = parse("expireAfterWrite=10d"); - assertEquals(spec.initialCapacity, UNSET_INT); - assertEquals(spec.maximumSize, UNSET_INT); - assertEquals(spec.maximumWeight, UNSET_INT); + assertThat(spec.initialCapacity).isEqualTo(UNSET_INT); + assertThat(spec.maximumSize).isEqualTo(UNSET_INT); + assertThat(spec.maximumWeight).isEqualTo(UNSET_INT); assertNull(spec.keyStrength); assertNull(spec.valueStrength); - assertEquals(Duration.ofDays(10), spec.expireAfterWrite); + assertThat(spec.expireAfterWrite).isEqualTo(Duration.ofDays(10)); assertNull(spec.expireAfterAccess); assertNull(spec.refreshAfterWrite); assertCaffeineEquivalence( @@ -191,21 +191,21 @@ public void testParse_writeExpirationDays() { public void testParse_writeExpirationHours() { CaffeineSpec spec = parse("expireAfterWrite=150h"); - assertEquals(Duration.ofHours(150), spec.expireAfterWrite); + assertThat(spec.expireAfterWrite).isEqualTo(Duration.ofHours(150)); assertCaffeineEquivalence( Caffeine.newBuilder().expireAfterWrite(150L, TimeUnit.HOURS), Caffeine.from(spec)); } public void testParse_writeExpirationMinutes() { CaffeineSpec spec = parse("expireAfterWrite=10m"); - assertEquals(Duration.ofMinutes(10), spec.expireAfterWrite); + assertThat(spec.expireAfterWrite).isEqualTo(Duration.ofMinutes(10)); assertCaffeineEquivalence( Caffeine.newBuilder().expireAfterWrite(10L, TimeUnit.MINUTES), Caffeine.from(spec)); } public void testParse_writeExpirationSeconds() { CaffeineSpec spec = parse("expireAfterWrite=10s"); - assertEquals(Duration.ofSeconds(10), spec.expireAfterWrite); + assertThat(spec.expireAfterWrite).isEqualTo(Duration.ofSeconds(10)); assertCaffeineEquivalence( Caffeine.newBuilder().expireAfterWrite(10L, TimeUnit.SECONDS), Caffeine.from(spec)); } @@ -217,27 +217,27 @@ public void testParse_writeExpirationRepeated() { public void testParse_accessExpirationDays() { CaffeineSpec spec = parse("expireAfterAccess=10d"); - assertEquals(spec.initialCapacity, UNSET_INT); - assertEquals(spec.maximumSize, UNSET_INT); - assertEquals(spec.maximumWeight, UNSET_INT); + assertThat(spec.initialCapacity).isEqualTo(UNSET_INT); + assertThat(spec.maximumSize).isEqualTo(UNSET_INT); + assertThat(spec.maximumWeight).isEqualTo(UNSET_INT); assertNull(spec.keyStrength); assertNull(spec.valueStrength); assertNull(spec.expireAfterWrite); - assertEquals(Duration.ofDays(10), spec.expireAfterAccess); + assertThat(spec.expireAfterAccess).isEqualTo(Duration.ofDays(10)); assertCaffeineEquivalence( Caffeine.newBuilder().expireAfterAccess(10L, TimeUnit.DAYS), Caffeine.from(spec)); } public void testParse_accessExpirationHours() { CaffeineSpec spec = parse("expireAfterAccess=150h"); - assertEquals(Duration.ofHours(150), spec.expireAfterAccess); + assertThat(spec.expireAfterAccess).isEqualTo(Duration.ofHours(150)); assertCaffeineEquivalence( Caffeine.newBuilder().expireAfterAccess(150L, TimeUnit.HOURS), Caffeine.from(spec)); } public void testParse_accessExpirationMinutes() { CaffeineSpec spec = parse("expireAfterAccess=10m"); - assertEquals(Duration.ofMinutes(10), spec.expireAfterAccess); + assertThat(spec.expireAfterAccess).isEqualTo(Duration.ofMinutes(10)); assertCaffeineEquivalence( Caffeine.newBuilder().expireAfterAccess(10L, TimeUnit.MINUTES), Caffeine.from(spec)); @@ -245,7 +245,7 @@ public void testParse_accessExpirationMinutes() { public void testParse_accessExpirationSeconds() { CaffeineSpec spec = parse("expireAfterAccess=10s"); - assertEquals(Duration.ofSeconds(10), spec.expireAfterAccess); + assertThat(spec.expireAfterAccess).isEqualTo(Duration.ofSeconds(10)); assertCaffeineEquivalence( Caffeine.newBuilder().expireAfterAccess(10L, TimeUnit.SECONDS), Caffeine.from(spec)); @@ -272,8 +272,8 @@ public void testParse_recordStatsRepeated() { public void testParse_accessExpirationAndWriteExpiration() { CaffeineSpec spec = parse("expireAfterAccess=10s,expireAfterWrite=9m"); - assertEquals(Duration.ofMinutes(9), spec.expireAfterWrite); - assertEquals(Duration.ofSeconds(10), spec.expireAfterAccess); + assertThat(spec.expireAfterWrite).isEqualTo(Duration.ofMinutes(9)); + assertThat(spec.expireAfterAccess).isEqualTo(Duration.ofSeconds(10)); assertCaffeineEquivalence( Caffeine.newBuilder() .expireAfterAccess(10L, TimeUnit.SECONDS) @@ -284,13 +284,13 @@ public void testParse_accessExpirationAndWriteExpiration() { public void testParse_multipleKeys() { CaffeineSpec spec = parse("initialCapacity=10,maximumSize=20," + "weakKeys,weakValues,expireAfterAccess=10m,expireAfterWrite=1h"); - assertEquals(10, spec.initialCapacity); - assertEquals(20, spec.maximumSize); - assertEquals(spec.maximumWeight, UNSET_INT); - assertEquals(Strength.WEAK, spec.keyStrength); - assertEquals(Strength.WEAK, spec.valueStrength); - assertEquals(Duration.ofHours(1), spec.expireAfterWrite); - assertEquals(Duration.ofMinutes(10), spec.expireAfterAccess); + assertThat(spec.initialCapacity).isEqualTo(10); + assertThat(spec.maximumSize).isEqualTo(20); + assertThat(spec.maximumWeight).isEqualTo(UNSET_INT); + assertThat(spec.keyStrength).isEqualTo(Strength.WEAK); + assertThat(spec.valueStrength).isEqualTo(Strength.WEAK); + assertThat(spec.expireAfterWrite).isEqualTo(Duration.ofHours(1)); + assertThat(spec.expireAfterAccess).isEqualTo(Duration.ofMinutes(10)); Caffeine expected = Caffeine.newBuilder() .initialCapacity(10) .maximumSize(20) @@ -304,12 +304,12 @@ public void testParse_multipleKeys() { public void testParse_whitespaceAllowed() { CaffeineSpec spec = parse(" initialCapacity=10,\nmaximumSize=20,\t\r" + "weakKeys \t ,softValues \n , \r expireAfterWrite \t = 15s\n\n"); - assertEquals(10, spec.initialCapacity); - assertEquals(20, spec.maximumSize); - assertEquals(spec.maximumWeight, UNSET_INT); - assertEquals(Strength.WEAK, spec.keyStrength); - assertEquals(Strength.SOFT, spec.valueStrength); - assertEquals(Duration.ofSeconds(15), spec.expireAfterWrite); + assertThat(spec.initialCapacity).isEqualTo(10); + assertThat(spec.maximumSize).isEqualTo(20); + assertThat(spec.maximumWeight).isEqualTo(UNSET_INT); + assertThat(spec.keyStrength).isEqualTo(Strength.WEAK); + assertThat(spec.valueStrength).isEqualTo(Strength.SOFT); + assertThat(spec.expireAfterWrite).isEqualTo(Duration.ofSeconds(15)); assertNull(spec.expireAfterAccess); Caffeine expected = Caffeine.newBuilder() .initialCapacity(10) diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/issues/Solr10141Test.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/issues/Solr10141Test.java index d2d20d822c..88279b338b 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/issues/Solr10141Test.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/issues/Solr10141Test.java @@ -67,7 +67,7 @@ public void eviction() { RemovalListener listener = (k, v, removalCause) -> { assertThat(v.key).isEqualTo(k); - if (!v.live.compareAndSet(true, false)) { + if (!v.live.compareAndSet(/* expectedValue= */ true, /* newValue= */ false)) { throw new RuntimeException(String.format(US, "listener called more than once! k=%s, v=%s, removalCause=%s", k, v, removalCause)); } @@ -144,7 +144,7 @@ public void clear() { RemovalListener listener = (k, v, removalCause) -> { assertThat(v.key).isEqualTo(k); - if (!v.live.compareAndSet(true, false)) { + if (!v.live.compareAndSet(/* expectedValue= */ true, /* newValue= */ false)) { throw new RuntimeException(String.format(US, "listener called more than once! k=%s, v=%s, removalCause=%s", k, v, removalCause)); } 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 20084fdce1..3351814974 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 @@ -97,7 +97,8 @@ public void beforeInvocation(IInvokedMethod method, ITestResult testResult) { .forEach(logger -> logger.setEnabledLevels(TRACE_LEVELS)); TestLoggerFactory.clear(); - if (beforeCleanup.get() || !beforeCleanup.compareAndSet(false, true)) { + if (beforeCleanup.get() + || !beforeCleanup.compareAndSet(/* expectedValue= */ false, /* newValue= */ true)) { return; } diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/jsr166/JSR166TestCase.java b/caffeine/src/test/java/com/github/benmanes/caffeine/jsr166/JSR166TestCase.java index 615cc254e2..9a255cff09 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/jsr166/JSR166TestCase.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/jsr166/JSR166TestCase.java @@ -1982,7 +1982,7 @@ void checkEmpty(BlockingQueue q) { assertNull(q.peek()); assertNull(q.poll()); assertNull(q.poll(randomExpiredTimeout(), randomTimeUnit())); - assertEquals(q.toString(), "[]"); + assertEquals("[]" ,q.toString()); assertTrue(Arrays.equals(q.toArray(), new Object[0])); assertFalse(q.iterator().hasNext()); try { diff --git a/examples/coalescing-bulkloader-reactor/gradle/wrapper/gradle-wrapper.properties b/examples/coalescing-bulkloader-reactor/gradle/wrapper/gradle-wrapper.properties index e7da39c493..7933f486b9 100644 --- a/examples/coalescing-bulkloader-reactor/gradle/wrapper/gradle-wrapper.properties +++ b/examples/coalescing-bulkloader-reactor/gradle/wrapper/gradle-wrapper.properties @@ -1,4 +1,4 @@ -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-3-bin.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/examples/graal-native/gradle/wrapper/gradle-wrapper.properties b/examples/graal-native/gradle/wrapper/gradle-wrapper.properties index e7da39c493..7933f486b9 100644 --- a/examples/graal-native/gradle/wrapper/gradle-wrapper.properties +++ b/examples/graal-native/gradle/wrapper/gradle-wrapper.properties @@ -1,4 +1,4 @@ -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-3-bin.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/examples/hibernate/gradle/wrapper/gradle-wrapper.properties b/examples/hibernate/gradle/wrapper/gradle-wrapper.properties index e7da39c493..7933f486b9 100644 --- a/examples/hibernate/gradle/wrapper/gradle-wrapper.properties +++ b/examples/hibernate/gradle/wrapper/gradle-wrapper.properties @@ -1,4 +1,4 @@ -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-3-bin.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/examples/indexable/gradle/wrapper/gradle-wrapper.properties b/examples/indexable/gradle/wrapper/gradle-wrapper.properties index e7da39c493..7933f486b9 100644 --- a/examples/indexable/gradle/wrapper/gradle-wrapper.properties +++ b/examples/indexable/gradle/wrapper/gradle-wrapper.properties @@ -1,4 +1,4 @@ -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-3-bin.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/examples/resilience-failsafe/gradle/wrapper/gradle-wrapper.properties b/examples/resilience-failsafe/gradle/wrapper/gradle-wrapper.properties index e7da39c493..7933f486b9 100644 --- a/examples/resilience-failsafe/gradle/wrapper/gradle-wrapper.properties +++ b/examples/resilience-failsafe/gradle/wrapper/gradle-wrapper.properties @@ -1,4 +1,4 @@ -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-3-bin.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/examples/write-behind-rxjava/gradle/wrapper/gradle-wrapper.properties b/examples/write-behind-rxjava/gradle/wrapper/gradle-wrapper.properties index e7da39c493..7933f486b9 100644 --- a/examples/write-behind-rxjava/gradle/wrapper/gradle-wrapper.properties +++ b/examples/write-behind-rxjava/gradle/wrapper/gradle-wrapper.properties @@ -1,4 +1,4 @@ -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-3-bin.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 230a125d8b..7bb06e2640 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -8,7 +8,7 @@ bouncycastle-jdk18on = "1.79" cache2k = "2.6.1.Final" caffeine = "3.1.8" checker-framework = "3.48.2" -checkstyle = "10.20.0" +checkstyle = "10.20.1" coherence = "22.06.2" commons-collections4 = "4.4" commons-compress = "1.27.1" diff --git a/gradle/plugins/src/main/kotlin/lifecycle/java-library.caffeine.gradle.kts b/gradle/plugins/src/main/kotlin/lifecycle/java-library.caffeine.gradle.kts index 36a0ee9b47..03e6db295b 100644 --- a/gradle/plugins/src/main/kotlin/lifecycle/java-library.caffeine.gradle.kts +++ b/gradle/plugins/src/main/kotlin/lifecycle/java-library.caffeine.gradle.kts @@ -38,7 +38,11 @@ tasks.withType().configureEach { } options.compilerArgs.addAll(listOf("-Xlint:all", "-Xlint:-auxiliaryclass", "-Xlint:-classfile", - "-Xlint:-exports", "-Xlint:-processing", "-Xlint:-removal", "-Xlint:-requires-automatic")) + "-Xlint:-exports", "-Xlint:-processing", "-Xlint:-removal", "-Xlint:-requires-automatic", + "-parameters")) + if (isCI()) { + options.compilerArgs.add("-Werror") + } if (javaVersion.canCompileOrRun(21)) { options.compilerArgs.add("-proc:full") } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e7da39c493..7933f486b9 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,4 +1,4 @@ -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-rc-3-bin.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/CacheProxyTest.java b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/CacheProxyTest.java index 7fd35995fb..4fb48b4bcd 100644 --- a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/CacheProxyTest.java +++ b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/CacheProxyTest.java @@ -128,7 +128,7 @@ public void load_cacheLoaderException() { var e = new CacheLoaderException(); CompletionListener completionListener = Mockito.mock(); doThrow(e).when(completionListener).onCompletion(); - jcache.loadAll(keys, true, completionListener); + jcache.loadAll(keys, /* replaceExistingValues= */ true, completionListener); verify(completionListener).onException(e); } diff --git a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/event/EventDispatcherTest.java b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/event/EventDispatcherTest.java index 7521ba417c..d277676bd0 100644 --- a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/event/EventDispatcherTest.java +++ b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/event/EventDispatcherTest.java @@ -81,8 +81,9 @@ public void afterTest() { @Test public void register_noListener() { - var configuration = - new MutableCacheEntryListenerConfiguration(null, null, false, false); + var configuration = new MutableCacheEntryListenerConfiguration( + /* listenerFactory= */ null, /* filterFactory= */ null, + /* isOldValueRequired= */ false, /* isSynchronous= */ false); var dispatcher = new EventDispatcher(Runnable::run); dispatcher.register(configuration); assertThat(dispatcher.dispatchQueues).isEmpty(); @@ -92,7 +93,8 @@ public void register_noListener() { public void register_twice() { var dispatcher = new EventDispatcher(Runnable::run); var configuration = new MutableCacheEntryListenerConfiguration<>( - () -> createdListener, null, false, false); + () -> createdListener, /* filterFactory= */ null, + /* isOldValueRequired= */ false, /* isSynchronous= */ false); dispatcher.register(configuration); dispatcher.register(configuration); assertThat(dispatcher.dispatchQueues).hasSize(1); @@ -101,11 +103,14 @@ public void register_twice() { @Test public void register_equality() { var c1 = new MutableCacheEntryListenerConfiguration<>( - () -> createdListener, null, false, false); + () -> createdListener, /* filterFactory= */ null, + /* isOldValueRequired= */ false, /* isSynchronous= */ false); var c2 = new MutableCacheEntryListenerConfiguration<>( - c1.getCacheEntryListenerFactory(), null, false, false); + c1.getCacheEntryListenerFactory(), /* filterFactory= */ null, + /* isOldValueRequired= */ false, /* isSynchronous= */ false); var c3 = new MutableCacheEntryListenerConfiguration<>( - c1.getCacheEntryListenerFactory(), null, true, true); + c1.getCacheEntryListenerFactory(), /* filterFactory= */ null, + /* isOldValueRequired= */ true, /* isSynchronous= */ true); new EqualsTester() .addEqualityGroup( @@ -122,7 +127,8 @@ public void register_equality() { public void deregister() { var dispatcher = new EventDispatcher(Runnable::run); var configuration = new MutableCacheEntryListenerConfiguration<>( - () -> createdListener, null, false, false); + () -> createdListener, /* filterFactory= */ null, + /* isOldValueRequired= */ false, /* isSynchronous= */ false); dispatcher.register(configuration); dispatcher.deregister(configuration); assertThat(dispatcher.dispatchQueues).isEmpty(); @@ -193,7 +199,8 @@ public void ordered() { var listener = new ConsumingCacheListener(); var dispatcher = new EventDispatcher(executor); dispatcher.register(new MutableCacheEntryListenerConfiguration<>( - () -> listener, null, false, false)); + () -> listener, /* filterFactory= */ null, + /* isOldValueRequired= */ false, /* isSynchronous= */ false)); dispatcher.publishCreated(cache, 1, 2); dispatcher.publishUpdated(cache, 1, 2, 3); @@ -252,7 +259,8 @@ public void parallel_keys() { var dispatcher = new EventDispatcher(executor); dispatcher.register(new MutableCacheEntryListenerConfiguration<>( - () -> listener, null, false, false)); + () -> listener, /* filterFactory= */ null, + /* isOldValueRequired= */ false, /* isSynchronous= */ false)); dispatcher.publishCreated(cache, 1, 1); dispatcher.publishCreated(cache, 2, 2); execute.set(true); @@ -287,9 +295,11 @@ public void parallel_listeners() { var dispatcher = new EventDispatcher(executor); dispatcher.register(new MutableCacheEntryListenerConfiguration<>( - () -> consumer, null, false, false)); + () -> consumer, /* filterFactory= */ null, + /* isOldValueRequired= */ false, /* isSynchronous= */ false)); dispatcher.register(new MutableCacheEntryListenerConfiguration<>( - () -> waiter, null, false, false)); + () -> waiter, /* filterFactory= */ null, + /* isOldValueRequired= */ false, /* isSynchronous= */ false)); dispatcher.publishCreated(cache, 1, 2); execute.set(true); @@ -331,7 +341,8 @@ public void awaitSynchronous_nested() { pendingFutures.addAll(secondary.pending.get()); var configuration = new MutableCacheEntryListenerConfiguration<>( - () -> listener, null, /* isOldValueRequired= */ false, /* isSynchronous= */ true); + () -> listener, /* filterFactory= */ null, + /* isOldValueRequired= */ false, /* isSynchronous= */ false); primary.register(configuration); int key = 1; diff --git a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/event/JCacheEntryEventTest.java b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/event/JCacheEntryEventTest.java index cb13f01b74..3112441b48 100644 --- a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/event/JCacheEntryEventTest.java +++ b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/event/JCacheEntryEventTest.java @@ -44,7 +44,8 @@ public final class JCacheEntryEventTest { @BeforeTest public void before() throws Exception { MockitoAnnotations.openMocks(this).close(); - event = new JCacheEntryEvent<>(cache, EventType.CREATED, 1, true, 2, 3); + event = new JCacheEntryEvent<>(cache, EventType.CREATED, + 1, /* hasOldValue= */ true, 2, 3); } @Test @@ -59,7 +60,8 @@ public void unwrap() { @Test public void isOldValueAvailable_false() { - var entry = new JCacheEntryEvent<>(cache, EventType.CREATED, 1, false, null, 3); + var entry = new JCacheEntryEvent<>(cache, EventType.CREATED, + 1, /* hasOldValue= */ false, null, 3); assertThat(entry.isOldValueAvailable()).isFalse(); } diff --git a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/event/JCacheEvictionListenerTest.java b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/event/JCacheEvictionListenerTest.java index 0b561edcb2..174ddf9c75 100644 --- a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/event/JCacheEvictionListenerTest.java +++ b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/event/JCacheEvictionListenerTest.java @@ -58,7 +58,8 @@ public void before() throws Exception { statistics.enable(true); dispatcher.register(new MutableCacheEntryListenerConfiguration<>( - () -> entryListener, null, false, false)); + /* listenerFactory= */ () -> entryListener, /* filterFactory= */ null, + /* isOldValueRequired= */ false, /* isSynchronous= */ false)); } @DataProvider