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/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..d1052c1723 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,8 @@ 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 (javaVersion.canCompileOrRun(21)) { options.compilerArgs.add("-proc:full") }