question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HidingField: NoSuchMethodError: 'com.sun.tools.javac.util.List com.sun.tools.javac.code.Symbol$TypeSymbol.getEnclosedElements

See original GitHub issue

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?

#1529

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:14
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
cushoncommented, Jan 14, 2021

Thanks for the additional reports. https://github.com/google/error-prone/issues/2092#issuecomment-759474409 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Accessing com.sun.tools.javac.util from Java 9 - Stack Overflow
I just looked up that class and didn't see anything that explains why a developer could need that list class instead of just...
Read more >
com.sun.tools.javac.util.JavacMessages.add - Java Bug System
NoSuchMethodError : com.sun.tools.javac.util.JavacMessages.add(Lcom/sun/tools/javac/util/JavacMessages$ResourceBundleHelper;)V
Read more >
KaptJavaLog fails on Java 17 due to removed constructor in ...
20:kapt (kapt) on project quarkus-hibernate-orm-panache-kotlin: Compilation failure java.lang.NoSuchMethodError: 'void com.sun.tools.javac.util.Log.< ...
Read more >
void com.sun.tools.javac.util.Log.<init>in .dump files ... - Apache
NoSuchMethodError : 'void com.sun.tools.javac.util.Log.<init>in .dump files when running NetBeans with JDK17+26. Status: Assignee: Priority:.
Read more >
Uses of Class com.sun.tools.javac.util.List - javadoc.io
The attributes values, as pairs. Fields in com.sun.tools.javac.code with type parameters of type List. Modifier and Type ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found