Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isJSpecifyMode: JCTree$JCMethodInvocation cannot be cast to class VariableTree #996

Closed
ben-manes opened this issue Jul 14, 2024 · 2 comments · Fixed by #1001
Closed

isJSpecifyMode: JCTree$JCMethodInvocation cannot be cast to class VariableTree #996

ben-manes opened this issue Jul 14, 2024 · 2 comments · Fixed by #1001
Assignees

Comments

@ben-manes
Copy link

I tried enabling jspecify mode (without using the annotations) and observed the following errors. It was a warning free build without this change (build scan).

warnings and build failure
> Task :caffeine:compileJava
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java:333: warning: [NullAway] passing @Nullable parameter 'this.executor' where @NonNull is required
    requireState(this.executor == null, "executor was already set to %s", this.executor);
                                                                              ^
    (see http://t.uber.com/nullaway )
  Did you mean '@SuppressWarnings("NullAway") @CanIgnoreReturnValue'?
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java:362: warning: [NullAway] passing @Nullable parameter 'this.scheduler' where @NonNull is required
    requireState(this.scheduler == null, "scheduler was already set to %s", this.scheduler);
                                                                                ^
    (see http://t.uber.com/nullaway )
  Did you mean '@SuppressWarnings("NullAway") @CanIgnoreReturnValue'?
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java:477: warning: [NullAway] passing @Nullable parameter 'this.weigher' where @NonNull is required
    requireState(this.weigher == null, "weigher was already set to %s", this.weigher);
                                                                            ^
    (see http://t.uber.com/nullaway )
  Did you mean '@SuppressWarnings("NullAway") @CanIgnoreReturnValue'?
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java:528: warning: [NullAway] passing @Nullable parameter 'keyStrength' where @NonNull is required
    requireState(keyStrength == null, "Key strength was already set to %s", keyStrength);
                                                                            ^
    (see http://t.uber.com/nullaway )
  Did you mean '@SuppressWarnings("NullAway") @CanIgnoreReturnValue'?
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java:558: warning: [NullAway] passing @Nullable parameter 'valueStrength' where @NonNull is required
    requireState(valueStrength == null, "Value strength was already set to %s", valueStrength);
                                                                                ^
    (see http://t.uber.com/nullaway )
  Did you mean '@SuppressWarnings("NullAway") @CanIgnoreReturnValue'?
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java:595: warning: [NullAway] passing @Nullable parameter 'valueStrength' where @NonNull is required
    requireState(valueStrength == null, "Value strength was already set to %s", valueStrength);
                                                                                ^
    (see http://t.uber.com/nullaway )
  Did you mean '@SuppressWarnings("NullAway") @CanIgnoreReturnValue'?
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java:753: warning: [NullAway] passing @Nullable parameter 'this.expiry' where @NonNull is required
    requireState(this.expiry == null, "Expiry was already set to %s", this.expiry);
                                                                          ^
    (see http://t.uber.com/nullaway )
  Did you mean '@SuppressWarnings("NullAway") @CanIgnoreReturnValue'?
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java:857: warning: [NullAway] passing @Nullable parameter 'this.ticker' where @NonNull is required
    requireState(this.ticker == null, "Ticker was already set to %s", this.ticker);
                                                                          ^
    (see http://t.uber.com/nullaway )
  Did you mean '@SuppressWarnings("NullAway") @CanIgnoreReturnValue'?
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java:908: warning: [NullAway] passing @Nullable parameter 'this.evictionListener' where @NonNull is required
        "eviction listener was already set to %s", this.evictionListener);
                                                       ^
    (see http://t.uber.com/nullaway )
  Did you mean '@SuppressWarnings("NullAway") @CanIgnoreReturnValue'?
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java:960: warning: [NullAway] passing @Nullable parameter 'this.removalListener' where @NonNull is required
        "removal listener was already set to %s", this.removalListener);
                                                      ^
    (see http://t.uber.com/nullaway )
  Did you mean '@SuppressWarnings("NullAway") @CanIgnoreReturnValue'?
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncCache.java:444: warning: [NullAway] Writing @Nullable expression into array with @NonNull contents.
        result[0] = (oldValue == null) ? null : remappingFunction.apply(k, oldValue);
                  ^
    (see http://t.uber.com/nullaway )
  Did you mean 'result[0] = @SuppressWarnings("NullAway") (oldValue == null) ? null : remappingFunction.apply(k, oldValue);'?
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncCache.java:816: error: An unhandled exception was thrown by the Error Prone static analysis plugin.
          oldValue[0] = Async.getIfReady(oldValueFuture);
                      ^
     Please report this at https://github.com/google/error-prone/issues/new and include the following:

     error-prone version: 2.28.0
     BugPattern: NullAway
     Stack Trace:
     java.lang.ClassCastException: class com.sun.tools.javac.tree.JCTree$JCMethodInvocation cannot be cast to class com.sun.source.tree.VariableTree (com.sun.tools.javac.tree.JCTree$JCMethodInvocation and com.sun.source.tree.VariableTree are in module jdk.compiler of loader 'app')
        at com.uber.nullaway.ErrorBuilder.addSuppressWarningsFix(ErrorBuilder.java:294)
        at com.uber.nullaway.ErrorBuilder.addSuggestedSuppression(ErrorBuilder.java:231)
        at com.uber.nullaway.ErrorBuilder.createErrorDescription(ErrorBuilder.java:139)
        at com.uber.nullaway.NullAway.matchAssignment(NullAway.java:516)
        at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:449)
        at com.google.errorprone.scanner.ErrorProneScanner.visitAssignment(ErrorProneScanner.java:504)
        at com.google.errorprone.scanner.ErrorProneScanner.visitAssignment(ErrorProneScanner.java:150)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCAssign.accept(JCTree.java:2051)
        at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
        at jdk.compiler/com.sun.source.util.TreeScanner.visitExpressionStatement(TreeScanner.java:502)
        at com.google.errorprone.scanner.ErrorProneScanner.visitExpressionStatement(ErrorProneScanner.java:633)
        at com.google.errorprone.scanner.ErrorProneScanner.visitExpressionStatement(ErrorProneScanner.java:150)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1592)
        at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
        at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:96)
        at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:111)
        at jdk.compiler/com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:272)
        at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:520)
        at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:150)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1103)
        at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
        at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:96)
        at jdk.compiler/com.sun.source.util.TreeScanner.visitLambdaExpression(TreeScanner.java:646)
        at com.google.errorprone.scanner.ErrorProneScanner.visitLambdaExpression(ErrorProneScanner.java:702)
        at com.google.errorprone.scanner.ErrorProneScanner.visitLambdaExpression(ErrorProneScanner.java:150)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1978)
        at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
        at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:96)
        at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:111)
        at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:119)
        at jdk.compiler/com.sun.source.util.TreeScanner.visitMethodInvocation(TreeScanner.java:590)
        at com.google.errorprone.scanner.ErrorProneScanner.visitMethodInvocation(ErrorProneScanner.java:751)
        at com.google.errorprone.scanner.ErrorProneScanner.visitMethodInvocation(ErrorProneScanner.java:150)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1813)
        at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
        at jdk.compiler/com.sun.source.util.TreeScanner.visitExpressionStatement(TreeScanner.java:502)
        at com.google.errorprone.scanner.ErrorProneScanner.visitExpressionStatement(ErrorProneScanner.java:633)
        at com.google.errorprone.scanner.ErrorProneScanner.visitExpressionStatement(ErrorProneScanner.java:150)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1592)
        at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
        at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:96)
        at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:111)
        at jdk.compiler/com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:272)
        at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:520)
        at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:150)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1103)
        at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
        at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:96)
        at jdk.compiler/com.sun.source.util.TreeScanner.visitForLoop(TreeScanner.java:321)
        at com.google.errorprone.scanner.ErrorProneScanner.visitForLoop(ErrorProneScanner.java:640)
        at com.google.errorprone.scanner.ErrorProneScanner.visitForLoop(ErrorProneScanner.java:150)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCForLoop.accept(JCTree.java:1209)
        at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
        at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:96)
        at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:111)
        at jdk.compiler/com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:272)
        at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:520)
        at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:150)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1103)
        at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
        at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:96)
        at jdk.compiler/com.sun.source.util.TreeScanner.visitMethod(TreeScanner.java:224)
        at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:740)
        at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:150)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:953)
        at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
        at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:96)
        at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:111)
        at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:119)
        at jdk.compiler/com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:203)
        at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:548)
        at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:150)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:860)
        at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
        at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:96)
        at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:111)
        at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:119)
        at jdk.compiler/com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:203)
        at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:548)
        at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:150)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:860)
        at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
        at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:111)
        at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:119)
        at jdk.compiler/com.sun.source.util.TreeScanner.visitCompilationUnit(TreeScanner.java:152)
        at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:560)
        at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:150)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:614)
        at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:60)
        at com.google.errorprone.scanner.Scanner.scan(Scanner.java:58)
        at com.google.errorprone.scanner.ErrorProneScannerTransformer.apply(ErrorProneScannerTransformer.java:43)
        at com.google.errorprone.ErrorProneAnalyzer.finished(ErrorProneAnalyzer.java:156)
        at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:132)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1397)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1344)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:933)
        at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
        at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
        at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
        at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
        at org.gradle.internal.compiler.java.IncrementalCompileTask.call(IncrementalCompileTask.java:92)
        at org.gradle.api.internal.tasks.compile.AnnotationProcessingCompileTask.call(AnnotationProcessingCompileTask.java:94)
        at org.gradle.api.internal.tasks.compile.ResourceCleaningCompilationTask.call(ResourceCleaningCompilationTask.java:57)
        at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:76)
        at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:46)
        at org.gradle.api.internal.tasks.compile.daemon.AbstractIsolatedCompilerWorkerExecutor$CompilerWorkAction.execute(AbstractIsolatedCompilerWorkerExecutor.java:78)
        at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
        at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:54)
        at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:48)
        at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:100)
        at org.gradle.workers.internal.AbstractClassLoaderWorker.executeInClassLoader(AbstractClassLoaderWorker.java:48)
        at org.gradle.workers.internal.FlatClassLoaderWorker.run(FlatClassLoaderWorker.java:32)
        at org.gradle.workers.internal.FlatClassLoaderWorker.run(FlatClassLoaderWorker.java:22)
        at org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:104)
        at org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:73)
        at org.gradle.process.internal.worker.request.WorkerAction$1.call(WorkerAction.java:146)
        at org.gradle.process.internal.worker.child.WorkerLogEventListener.withWorkerLoggingProtocol(WorkerLogEventListener.java:41)
        at org.gradle.process.internal.worker.request.WorkerAction.lambda$run$0(WorkerAction.java:143)
        at org.gradle.internal.operations.CurrentBuildOperationRef.with(CurrentBuildOperationRef.java:85)
        at org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:135)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
        at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
        at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:414)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:48)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:840)
1 error
11 warnings

> Task :caffeine:compileJava FAILED
reproduction steps

./gradlew build -x test

diff --git a/gradle/plugins/src/main/kotlin/quality/errorprone.caffeine.gradle.kts b/gradle/plugins/src/main/kotlin/quality/errorprone.caffeine.gradle.kts
index 4470462f..22af94a0 100644
--- a/gradle/plugins/src/main/kotlin/quality/errorprone.caffeine.gradle.kts
+++ b/gradle/plugins/src/main/kotlin/quality/errorprone.caffeine.gradle.kts
@@ -71,6 +71,7 @@ tasks.withType<JavaCompile>().configureEach {
       checkOptionalEmptiness = true
       suggestSuppressions = true
       checkContracts = true
+      isJSpecifyMode = true
     }
   }
 }
@msridhar msridhar self-assigned this Jul 14, 2024
@ben-manes
Copy link
Author

I noticed the addSuppressWarningsFix in the stack trace, so I tried disabling suggestSuppressions and the build was successful. I have not reviewed the warnings to determine if they make sense.

caffeine git:(master) gradle build -x test
executing gradlew instead of gradle
Configuration on demand is an incubating feature.
Calculating task graph as no cached configuration is available for tasks: build

> Task :caffeine:compileJava
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java:333: warning: [NullAway] passing @Nullable parameter 'this.executor' where @NonNull is required
    requireState(this.executor == null, "executor was already set to %s", this.executor);
                                                                              ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java:362: warning: [NullAway] passing @Nullable parameter 'this.scheduler' where @NonNull is required
    requireState(this.scheduler == null, "scheduler was already set to %s", this.scheduler);
                                                                                ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java:477: warning: [NullAway] passing @Nullable parameter 'this.weigher' where @NonNull is required
    requireState(this.weigher == null, "weigher was already set to %s", this.weigher);
                                                                            ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java:528: warning: [NullAway] passing @Nullable parameter 'keyStrength' where @NonNull is required
    requireState(keyStrength == null, "Key strength was already set to %s", keyStrength);
                                                                            ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java:558: warning: [NullAway] passing @Nullable parameter 'valueStrength' where @NonNull is required
    requireState(valueStrength == null, "Value strength was already set to %s", valueStrength);
                                                                                ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java:595: warning: [NullAway] passing @Nullable parameter 'valueStrength' where @NonNull is required
    requireState(valueStrength == null, "Value strength was already set to %s", valueStrength);
                                                                                ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java:753: warning: [NullAway] passing @Nullable parameter 'this.expiry' where @NonNull is required
    requireState(this.expiry == null, "Expiry was already set to %s", this.expiry);
                                                                          ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java:857: warning: [NullAway] passing @Nullable parameter 'this.ticker' where @NonNull is required
    requireState(this.ticker == null, "Ticker was already set to %s", this.ticker);
                                                                          ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java:908: warning: [NullAway] passing @Nullable parameter 'this.evictionListener' where @NonNull is required
        "eviction listener was already set to %s", this.evictionListener);
                                                       ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java:960: warning: [NullAway] passing @Nullable parameter 'this.removalListener' where @NonNull is required
        "removal listener was already set to %s", this.removalListener);
                                                      ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncCache.java:444: warning: [NullAway] Writing @Nullable expression into array with @NonNull contents.
        result[0] = (oldValue == null) ? null : remappingFunction.apply(k, oldValue);
                  ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncCache.java:816: warning: [NullAway] Writing @Nullable expression into array with @NonNull contents.
          oldValue[0] = Async.getIfReady(oldValueFuture);
                      ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalLoadingCache.java:115: warning: [NullAway] Writing @Nullable expression into array with @NonNull contents.
        oldValue[0] = cache().getIfPresentQuietly(key);
                    ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalLoadingCache.java:183: warning: [NullAway] returning @Nullable expression from method with @NonNull return type
        return cacheLoader.load(key);
        ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java:2106: warning: [NullAway] Writing @Nullable expression into array with @NonNull contents.
        value[0] = n.getValue();
                 ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java:2446: warning: [NullAway] Writing @Nullable expression into array with @NonNull contents.
        oldValue[0] = n.getValue();
                    ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java:2490: warning: [NullAway] Writing @Nullable expression into array with @NonNull contents.
        oldKey[0] = node.getKey();
                  ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java:2491: warning: [NullAway] Writing @Nullable expression into array with @NonNull contents.
        oldValue[0] = node.getValue();
                    ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java:2535: warning: [NullAway] Writing @Nullable expression into array with @NonNull contents.
        nodeKey[0] = n.getKey();
                   ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java:2536: warning: [NullAway] Writing @Nullable expression into array with @NonNull contents.
        oldValue[0] = n.getValue();
                    ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java:2540: warning: [NullAway] Writing @Nullable expression into array with @NonNull contents.
          oldValue[0] = null;
                      ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java:2593: warning: [NullAway] Writing @Nullable expression into array with @NonNull contents.
        nodeKey[0] = n.getKey();
                   ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java:2594: warning: [NullAway] Writing @Nullable expression into array with @NonNull contents.
        prevValue[0] = n.getValue();
                     ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java:2702: warning: [NullAway] Writing @Nullable expression into array with @NonNull contents.
        nodeKey[0] = n.getKey();
                   ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java:2704: warning: [NullAway] Writing @Nullable expression into array with @NonNull contents.
        oldValue[0] = n.getValue();
                    ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java:2875: warning: [NullAway] Writing @Nullable expression into array with @NonNull contents.
        nodeKey[0] = n.getKey();
                   ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java:2876: warning: [NullAway] Writing @Nullable expression into array with @NonNull contents.
        oldValue[0] = n.getValue();
                    ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java:3185: warning: [NullAway] passing @Nullable parameter 'node.getValue()' where @NonNull is required
    V value = transformer.apply(node.getValue());
                                             ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java:3999: warning: [NullAway] passing @Nullable parameter 'cache.getIfPresentQuietly(key)' where @NonNull is required
      return transformer.apply(cache.getIfPresentQuietly(key));
                                                        ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java:4523: warning: [NullAway] referenced method returns @Nullable, but functional interface method java.util.function.Function.apply(T) returns @NonNull
        Function<CompletableFuture<V>, V> transformer = Async::getIfReady;
                                                        ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java:4576: warning: [NullAway] referenced method returns @Nullable, but functional interface method java.util.function.Function.apply(T) returns @NonNull
        Function<CompletableFuture<V>, V> transformer = Async::getIfReady;
                                                        ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/CaffeineSpec.java:242: warning: [NullAway] passing @Nullable parameter 'valueStrength' where @NonNull is required
    requireArgument(valueStrength == null, "%s was already set to %s", key, valueStrength);
                                                                            ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncLoadingCache.java:257: warning: [NullAway] Writing @Nullable expression into array with @NonNull contents.
        oldValueFuture[0] = asyncCache.cache().getIfPresentQuietly(key);
                          ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/UnboundedLocalCache.java:260: warning: [NullAway] Writing @Nullable expression into array with @NonNull contents.
        notificationValue[0] = null;
                             ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/UnboundedLocalCache.java:261: warning: [NullAway] Writing @Nullable expression into array with @NonNull contents.
        notificationKey[0] = null;
                           ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/UnboundedLocalCache.java:1074: warning: [NullAway] passing @Nullable parameter 'cache.data.get(key)' where @NonNull is required
      return transformer.apply(cache.data.get(key));
                                             ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/UnboundedLocalCache.java:1077: warning: [NullAway] passing @Nullable parameter 'cache.data.get(key)' where @NonNull is required
      V value = transformer.apply(cache.data.get(key));
                                                ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/UnboundedLocalCache.java:1191: warning: [NullAway] referenced method returns @Nullable, but functional interface method java.util.function.Function.apply(T) returns @NonNull
      Function<CompletableFuture<V>, V> transformer = Async::getIfReady;
                                                      ^
    (see http://t.uber.com/nullaway )
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/UnboundedLocalCache.java:1245: warning: [NullAway] referenced method returns @Nullable, but functional interface method java.util.function.Function.apply(T) returns @NonNull
      Function<CompletableFuture<V>, V> transformer = Async::getIfReady;
                                                      ^
    (see http://t.uber.com/nullaway )
39 warnings

> Task :jcache:compileJava
/Users/ben/projects/caffeine/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheFactory.java:209: warning: [NullAway] unbound instance method reference cannot be used, as first parameter of functional interface method java.util.function.Function.apply(T) is @Nullable
          Optional.ofNullable(config.getCacheLoaderFactory()).map(Factory::create);
                                                                  ^
    (see http://t.uber.com/nullaway )
1 warning

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.9/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD SUCCESSFUL in 1m 17s
54 actionable tasks: 25 executed, 29 up-to-date

Publishing build scan...
https://caffeine.gradle-enterprise.cloud/s/44bmxntmxwjle

Configuration cache entry discarded because incompatible tasks were found: ':caffeine:forbiddenApisCodeGen', ':guava:forbiddenApisTest', ':jcache:forbiddenApisTestResources', ':caffeine:forbiddenApisTest', ':jcache:forbiddenApisMain', ':guava:forbiddenApisMain', ':caffeine:forbiddenApisJmh', ':caffeine:forbiddenApisMain', ':jcache:forbiddenApisTest', ':simulator:forbiddenApisTest', ':simulator:forbiddenApisMain', ':caffeine:forbiddenApisJavaPoet'.

@msridhar
Copy link
Collaborator

Thanks a lot for testing @ben-manes. We haven't tested combining JSpecify mode with suggest suppressions so there's likely a bug there. I'll look over the other warnings you are seeing and report back, but most likely they are due to incomplete support for some language feature or incomplete library models, both of which we are working on. Still I'll try to make sure there are open issues on these things that we can refer to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants