Repository navigation
Closed
Description
Description of the problem:
After upgrading errorprone from 2.4.0 to 2.5.0 following is reported in [my project's] maven build (with JDK8, JDK11, JDK12 or JDK13):
An unhandled exception was thrown by the Error Prone static analysis plugin.
Please report this at https://github.com/google/error-prone/issues/new and include the following:
error-prone version: 2.5.0
BugPattern: HidingField
Stack Trace:
java.lang.NoSuchMethodError: 'com.sun.tools.javac.util.List com.sun.tools.javac.code.Symbol$TypeSymbol.getEnclosedElements()'
at com.google.errorprone.bugpatterns.HidingField.matchClass(HidingField.java:73)
at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:450)
at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:548)
at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:151)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:808)
at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
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:105)
at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:113)
at jdk.compiler/com.sun.source.util.TreeScanner.visitCompilationUnit(TreeScanner.java:144)
at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:561)
at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:151)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:591)
at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:56)
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:152)
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:1418)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1365)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:960)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:147)
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.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:126)
at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:174)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1134)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:187)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.maven.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:39)
at org.apache.maven.wrapper.WrapperExecutor.execute(WrapperExecutor.java:122)
at org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:61)
The same code works fine with JDK14 and JDK15.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
What version of Error Prone are you using?
2.5.0
Have you found anything relevant by searching the web?
Reacted by Michael Fullan, Zac Sweers, john-rak, Tord Svensson, Pascal Schumacher, Philipp Wendler, Michał Sobkiewicz, André Kelpe, lgemeinhardt, Chanseok Oh and 4 more
Metadata
Metadata
Assignees
Labels
No labels
Activity
cushon commentedon Jan 12, 2021
This release was built against a newer JDK and picked up this backwards-incompatible change: openjdk/jdk@827e5e3#diff-9b6c5d86aacec00206bfcdbfc12caa41fbb0812426c4f2fd290c3fb1873a532fR840
I can work around that specific example, but if there are a lot more examples of this we should go back to building the release against JDK 8.
Do you mind disabling that particular check with
-Xep:HidingField:OFFas an experiment, to see if there are other crashes?ZacSweers commentedon Jan 12, 2021
Our codebase appears to compile with that disabled
pzygielo commentedon Jan 12, 2021
The same on my side - with
-Xep:HidingField:OFFbuild completes with no other error.lgemeinhardt commentedon Jan 13, 2021
This issue looks similar, even if the BugPattern is ComputeIfAbsentAmbiguousReference
chanseokoh commentedon Jan 13, 2021
Same error here. Using JDK 8.
cushon commentedon Jan 14, 2021
Thanks for the additional reports. #2092 (comment) looks like a distinct issue with the same root cause.
I'm going to release a 2.5.1 built on JDK 8 that will resolve this issue.
cushon commentedon Jan 15, 2021
https://github.com/google/error-prone/releases/tag/v2.5.1
tbroyer commentedon Jan 15, 2021
Fwiw, the release notes mention JDK 8, but it's also an issue with JDK 11 (or apparently any version before JDK 15 according to the JDK commit you linked to).
That said, thanks for the fix and the release!
cushon commentedon Jan 15, 2021
@tbroyer I updated the relnotes, thanks for the correction!
msridhar commentedon May 8, 2023
@cushon FYI I just saw this issue on JDK 11 when trying to update from Error Prone 2.18.0 to Error Prone 2.19.0. Is this unexpected? We can disable the
HidingFieldcheck for now as a workaround.applied suggested workaround for compiling with jdk 11
Bump com.google.errorprone:error_prone_core from 2.18.0 to 2.19.0 (#133)
Apply workaround to compiling with JDK 11 by disable the HidingField …
cushon commentedon May 9, 2023
@msridhar thanks, let's track the new occurrence of this in #3895