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

Bug when migrating to Java 21 #4115

Closed
mcopes73 opened this issue Sep 24, 2023 · 2 comments
Closed

Bug when migrating to Java 21 #4115

mcopes73 opened this issue Sep 24, 2023 · 2 comments

Comments

@mcopes73
Copy link

 error-prone version: 2.22.0
 BugPattern: (see stack trace)
 Stack Trace:
 java.lang.NoSuchMethodError: 'com.sun.tools.javac.tree.JCTree$JCExpression com.sun.tools.javac.tree.TreeMaker.Select(com.sun.tools.javac.tree.JCTree$JCExpression, com.sun.tools.javac.code.Symbol)'
    at org.checkerframework.errorprone.javacutil.trees.TreeBuilder.buildValueOfMethodAccess(TreeBuilder.java:392)
    at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.box(CFGTranslationPhaseOne.java:872)
    at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.commonConvert(CFGTranslationPhaseOne.java:1187)
    at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.methodInvocationConvert(CFGTranslationPhaseOne.java:1232)
    at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.convertCallArguments(CFGTranslationPhaseOne.java:1310)
    at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.visitMethodInvocation(CFGTranslationPhaseOne.java:1453)
    at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.visitMethodInvocation(CFGTranslationPhaseOne.java:198)
    at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1832)
    at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.scan(CFGTranslationPhaseOne.java:550)
    at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.convertCallArguments(CFGTranslationPhaseOne.java:1309)
    at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.visitMethodInvocation(CFGTranslationPhaseOne.java:1453)
    at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.visitMethodInvocation(CFGTranslationPhaseOne.java:198)
    at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1832)
    at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.scan(CFGTranslationPhaseOne.java:550)
    at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.visitExpressionStatement(CFGTranslationPhaseOne.java:2767)
    at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.visitExpressionStatement(CFGTranslationPhaseOne.java:198)
    at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1611)
    at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.scan(CFGTranslationPhaseOne.java:550)
    at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.visitBlock(CFGTranslationPhaseOne.java:2218)
    at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.visitBlock(CFGTranslationPhaseOne.java:198)
    at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1104)
    at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.scan(CFGTranslationPhaseOne.java:550)
    at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.process(CFGTranslationPhaseOne.java:447)
    at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.process(CFGTranslationPhaseOne.java:498)
    at org.checkerframework.errorprone.dataflow.cfg.builder.CFGBuilder.build(CFGBuilder.java:73)
    at com.google.errorprone.dataflow.DataFlow$2.load(DataFlow.java:125)
    at com.google.errorprone.dataflow.DataFlow$2.load(DataFlow.java:93)
    at com.github.benmanes.caffeine.cache.LocalLoadingCache.lambda$newMappingFunction$3(LocalLoadingCache.java:197)
    at com.github.benmanes.caffeine.cache.BoundedLocalCache.lambda$doComputeIfAbsent$13(BoundedLocalCache.java:2451)
    at java.base/java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1916)
    at com.github.benmanes.caffeine.cache.BoundedLocalCache.doComputeIfAbsent(BoundedLocalCache.java:2449)
    at com.github.benmanes.caffeine.cache.BoundedLocalCache.computeIfAbsent(BoundedLocalCache.java:2432)
    at com.github.benmanes.caffeine.cache.LocalCache.computeIfAbsent(LocalCache.java:107)
    at com.github.benmanes.caffeine.cache.LocalLoadingCache.get(LocalLoadingCache.java:57)
    at com.google.errorprone.dataflow.DataFlow.methodDataflow(DataFlow.java:172)
    at com.google.errorprone.dataflow.DataFlow.expressionDataflow(DataFlow.java:229)
    at com.palantir.baseline.errorprone.safety.SafetyAnalysis.of(SafetyAnalysis.java:35)
    at com.palantir.baseline.errorprone.IllegalSafeLoggingArgument.matchCtorOrMethodInvocation(IllegalSafeLoggingArgument.java:164)
    at com.palantir.baseline.errorprone.IllegalSafeLoggingArgument.matchMethodInvocation(IllegalSafeLoggingArgument.java:113)
    at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:449)
    at com.google.errorprone.scanner.ErrorProneScanner.visitMethodInvocation(ErrorProneScanner.java:746)
    at com.google.errorprone.scanner.ErrorProneScanner.visitMethodInvocation(ErrorProneScanner.java:150)
    at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1832)
    at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
    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:591)
    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:1832)
    at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
    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:503)
    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:1611)
    at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
    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:1104)
    at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
    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:948)
    at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
    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:855)
    at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
    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:623)
    at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:66)
    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:133)
    at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1435)
    at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1382)
    at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:965)
    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:55)
    at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:39)
    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:96)
    at org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:65)
    at org.gradle.process.internal.worker.request.WorkerAction$1.call(WorkerAction.java:138)
    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:135)
    at org.gradle.internal.operations.CurrentBuildOperationRef.with(CurrentBuildOperationRef.java:80)
    at org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:127)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    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:47)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1583)
@cushon
Copy link
Collaborator

cushon commented Sep 24, 2023

The signature change in com.sun.tools.javac.tree.TreeMaker.Select affecting the Checker Framework dataflow library is same underlying issue as #3843

From

 java.lang.NoSuchMethodError: 'com.sun.tools.javac.tree.JCTree$JCExpression com.sun.tools.javac.tree.TreeMaker.Select(com.sun.tools.javac.tree.JCTree$JCExpression, com.sun.tools.javac.code.Symbol)'
    at org.checkerframework.errorprone.javacutil.trees.TreeBuilder.buildValueOfMethodAccess(TreeBuilder.java:392)

This is using a version of org.checkerframework.errorprone.javacutil.trees.TreeBuilder that doesn't have the fix from eisop/checker-framework@d64da60

Do you know which version of dataflow-errorprone is being used in this build?

@cushon
Copy link
Collaborator

cushon commented Sep 24, 2023

Please re-open if updating the dataflow-errorprone version doesn't fix the crash.

Note that there were some API changes in the latest dataflow version, e.g. this is the commit that updated Error Prone to use the latest version, so if there are plugin checks being used in this build they may also need updating: https://github.com/google/error-prone/pull/3918/files#diff-e885c0981e1bc1aaf09bfff2d2b1a5cf367a63933dbb6acb48655aab7d951d7e

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

No branches or pull requests

2 participants