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

An unhandled exception was thrown by the Error Prone static analysis plugin. NoSuchMethod error #4370

Closed
Bezkup opened this issue Apr 17, 2024 · 3 comments

Comments

@Bezkup
Copy link

Bezkup commented Apr 17, 2024

Hello!
I was trying to compile a Java project and this popped up suddenly and Maven told me to post this issue :D

error-prone version: 2.10.0
[ERROR]      BugPattern: ReferenceEquality
[ERROR]      Stack Trace:
[ERROR]      com.google.common.util.concurrent.ExecutionError: 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)'
[ERROR]         at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2049)
[ERROR]         at com.google.common.cache.LocalCache.get(LocalCache.java:3951)
[ERROR]         at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3974)
[ERROR]         at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4935)
[ERROR]         at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4941)
[ERROR]         at com.google.errorprone.dataflow.DataFlow.methodDataflow(DataFlow.java:176)
[ERROR]         at com.google.errorprone.dataflow.DataFlow.expressionDataflow(DataFlow.java:236)
[ERROR]         at com.google.errorprone.dataflow.nullnesspropagation.NullnessAnalysis.getNullness(NullnessAnalysis.java:59)
[ERROR]         at com.google.errorprone.bugpatterns.AbstractReferenceEquality.getNullness(AbstractReferenceEquality.java:182)
[ERROR]         at com.google.errorprone.bugpatterns.AbstractReferenceEquality.addFixes(AbstractReferenceEquality.java:103)
[ERROR]         at com.google.errorprone.bugpatterns.AbstractReferenceEquality.matchBinary(AbstractReferenceEquality.java:78)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:449)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitBinary(ErrorProneScanner.java:512)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitBinary(ErrorProneScanner.java:150)
[ERROR]         at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBinary.accept(JCTree.java:2185)
[ERROR]         at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.visitParenthesized(TreeScanner.java:662)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitParenthesized(ErrorProneScanner.java:799)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitParenthesized(ErrorProneScanner.java:150)
[ERROR]         at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCParens.accept(JCTree.java:2041)
[ERROR]         at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.visitIf(TreeScanner.java:486)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitIf(ErrorProneScanner.java:654)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitIf(ErrorProneScanner.java:150)
[ERROR]         at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIf.accept(JCTree.java:1584)
[ERROR]         at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:111)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:272)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:520)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:150)
[ERROR]         at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1104)
[ERROR]         at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:96)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.visitEnhancedForLoop(TreeScanner.java:338)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitEnhancedForLoop(ErrorProneScanner.java:620)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitEnhancedForLoop(ErrorProneScanner.java:150)
[ERROR]         at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCEnhancedForLoop.accept(JCTree.java:1246)
[ERROR]         at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:96)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:111)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:272)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:520)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:150)
[ERROR]         at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1104)
[ERROR]         at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:96)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.visitIf(TreeScanner.java:487)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitIf(ErrorProneScanner.java:654)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitIf(ErrorProneScanner.java:150)
[ERROR]         at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIf.accept(JCTree.java:1584)
[ERROR]         at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:111)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:272)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:520)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:150)
[ERROR]         at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1104)
[ERROR]         at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:96)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.visitEnhancedForLoop(TreeScanner.java:338)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitEnhancedForLoop(ErrorProneScanner.java:620)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitEnhancedForLoop(ErrorProneScanner.java:150)
[ERROR]         at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCEnhancedForLoop.accept(JCTree.java:1246)
[ERROR]         at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:96)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:111)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:272)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:520)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitBlock(ErrorProneScanner.java:150)
[ERROR]         at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1104)
[ERROR]         at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:96)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.visitMethod(TreeScanner.java:224)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:740)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitMethod(ErrorProneScanner.java:150)
[ERROR]         at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:948)
[ERROR]         at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:96)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:111)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:119)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:203)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:548)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:150)
[ERROR]         at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:855)
[ERROR]         at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:111)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:119)
[ERROR]         at jdk.compiler/com.sun.source.util.TreeScanner.visitCompilationUnit(TreeScanner.java:152)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:560)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:150)
[ERROR]         at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:623)
[ERROR]         at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:66)
[ERROR]         at com.google.errorprone.scanner.Scanner.scan(Scanner.java:58)
[ERROR]         at com.google.errorprone.scanner.ErrorProneScannerTransformer.apply(ErrorProneScannerTransformer.java:43)
[ERROR]         at com.google.errorprone.ErrorProneAnalyzer.finished(ErrorProneAnalyzer.java:152)
[ERROR]         at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:133)
[ERROR]         at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1436)
[ERROR]         at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1383)
[ERROR]         at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:963)
[ERROR]         at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:319)
[ERROR]         at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:178)
[ERROR]         at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64)
[ERROR]         at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:50)
[ERROR]   Caused by: 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)'
[ERROR]         at org.checkerframework.errorprone.javacutil.trees.TreeBuilder.buildIteratorMethodAccess(TreeBuilder.java:122)
[ERROR]         at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.visitEnhancedForLoop(CFGTranslationPhaseOne.java:2358)
[ERROR]         at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.visitEnhancedForLoop(CFGTranslationPhaseOne.java:198)
[ERROR]         at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCEnhancedForLoop.accept(JCTree.java:1246)
[ERROR]         at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
[ERROR]         at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.visitBlock(CFGTranslationPhaseOne.java:2062)
[ERROR]         at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.visitBlock(CFGTranslationPhaseOne.java:198)
[ERROR]         at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1104)
[ERROR]         at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:66)
[ERROR]         at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.process(CFGTranslationPhaseOne.java:428)
[ERROR]         at org.checkerframework.errorprone.dataflow.cfg.builder.CFGTranslationPhaseOne.process(CFGTranslationPhaseOne.java:467)
[ERROR]         at org.checkerframework.errorprone.dataflow.cfg.builder.CFGBuilder.build(CFGBuilder.java:70)
[ERROR]         at com.google.errorprone.dataflow.DataFlow$2.load(DataFlow.java:127)
[ERROR]         at com.google.errorprone.dataflow.DataFlow$2.load(DataFlow.java:95)
[ERROR]         at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3529)
[ERROR]         at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2278)
[ERROR]         at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2155)
[ERROR]         at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2045)
[ERROR]         ... 125 more
@cushon
Copy link
Collaborator

cushon commented Apr 17, 2024

Can you try updating to the latest version of Error Prone?

@Bezkup
Copy link
Author

Bezkup commented Apr 20, 2024

Hi! Thanks for the response. The 2.26.1 version now works, which is strange because the older version works on my work laptop with Arch Linux, OpenJDK 17, and the latest Maven version. However, on this laptop with Pop_OS and the same JDK and Maven versions, it doesn't compile.

@cushon
Copy link
Collaborator

cushon commented Apr 20, 2024

I think the fix in the newer versions of Error Prone was #3843

the older version works on my work laptop with Arch Linux, OpenJDK 17, and the latest Maven version. However, on this laptop with Pop_OS and the same JDK and Maven versions, it doesn't compile.

The NoSuchMethodError is from a change in a javac API in the JDK, so it might be worth double-checking those environments are using exactly the same JDK version? If they aren't, that would explain the difference.

Either way, the solution to the crash is to use the latest version of Error Prone.

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