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

HidingField: NoSuchMethodError: com.sun.tools.javac.util.List com.sun.tools.javac.code.Symbol$TypeSymbol.getEnclosedElements() #3895

Closed
remal opened this issue May 9, 2023 · 12 comments

Comments

@remal
Copy link

remal commented May 9, 2023

After upgrading ErrorProne from 2.18.0 to 2.19.0, I get NoSuchMethodError exception for HidingField rule. I'm using JDK 11 to build my project.

Stacktrace:

error: 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.19.0
     BugPattern: (see stack trace)
     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)
  	...
Full stacktrace
error: 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.19.0
     BugPattern: (see stack trace)
     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:449)
  	at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:547)
  	at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:150)
  	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:560)
  	at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:150)
  	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: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:1414)
  	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1361)
  	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.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](https://github.com/remal-gradle-plugins/toolkit/actions/runs/4920440223/jobs/8789264019?pr=358#step:8:58))
  	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.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:98)
  	at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:52)
  	at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:38)
  	at org.gradle.api.internal.tasks.compile.AnnotationProcessorDiscoveringCompiler.execute(AnnotationProcessorDiscoveringCompiler.java:51)
  	at org.gradle.api.internal.tasks.compile.AnnotationProcessorDiscoveringCompiler.execute(AnnotationProcessorDiscoveringCompiler.java:37)
  	at org.gradle.api.internal.tasks.compile.ModuleApplicationNameWritingCompiler.execute(ModuleApplicationNameWritingCompiler.java:46)
  	at org.gradle.api.internal.tasks.compile.ModuleApplicationNameWritingCompiler.execute(ModuleApplicationNameWritingCompiler.java:36)
  	at org.gradle.jvm.toolchain.internal.DefaultToolchainJavaCompiler.execute(DefaultToolchainJavaCompiler.java:57)
  	at org.gradle.api.tasks.compile.JavaCompile.lambda$createToolchainCompiler$3(JavaCompile.java:202)
  	at org.gradle.api.internal.tasks.compile.CleaningJavaCompiler.execute(CleaningJavaCompiler.java:53)
  	at org.gradle.api.internal.tasks.compile.CleaningJavaCompiler.execute(CleaningJavaCompiler.java:32)
  	at org.gradle.api.internal.tasks.compile.CompileJavaBuildOperationReportingCompiler$1.call(CompileJavaBuildOperationReportingCompiler.java:64)
  	at org.gradle.api.internal.tasks.compile.CompileJavaBuildOperationReportingCompiler$1.call(CompileJavaBuildOperationReportingCompiler.java:48)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:[59](https://github.com/remal-gradle-plugins/toolkit/actions/runs/4920440223/jobs/8789264019?pr=358#step:8:60))
  	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
  	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
  	at org.gradle.api.internal.tasks.compile.CompileJavaBuildOperationReportingCompiler.execute(CompileJavaBuildOperationReportingCompiler.java:48)
  	at org.gradle.api.tasks.compile.JavaCompile.performCompilation(JavaCompile.java:220)
  	at org.gradle.api.tasks.compile.JavaCompile.performFullCompilation(JavaCompile.java:191)
  	at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:144)
  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:[62](https://github.com/remal-gradle-plugins/toolkit/actions/runs/4920440223/jobs/8789264019?pr=358#step:8:63))
  	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
  	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:125)
  	at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:45)
  	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
  	at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.execute(IncrementalTaskAction.java:26)
  	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)
  	at org.gradle.api.internal.tasks.execution.TaskExecution$3.run(TaskExecution.java:242)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
  	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
  	at org.gradle.api.internal.tasks.execution.TaskExecution.executeAction(TaskExecution.java:227)
  	at org.gradle.api.internal.tasks.execution.TaskExecution.executeActions(TaskExecution.java:210)
  	at org.gradle.api.internal.tasks.execution.TaskExecution.executeWithPreviousOutputFiles(TaskExecution.java:193)
  	at org.gradle.api.internal.tasks.execution.TaskExecution.execute(TaskExecution.java:166)
  	at org.gradle.internal.execution.steps.ExecuteStep.executeInternal(ExecuteStep.java:105)
  	at org.gradle.internal.execution.steps.ExecuteStep.access$000(ExecuteStep.java:44)
  	at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:59)
  	at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:56)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
  	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
  	at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:56)
  	at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:44)
  	at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:67)
  	at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:37)
  	at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:41)
  	at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:74)
  	at org.gradle.internal.execution.steps.TimeoutStep.executeWithTimeout(TimeoutStep.java:62)
  	at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:53)
  	at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:50)
  	at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:28)
  	at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.executeDelegateBroadcastingChanges(CaptureStateAfterExecutionStep.java:100)
  	at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:72)
  	at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:50)
  	at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:40)
  	at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:29)
  	at org.gradle.internal.execution.steps.BuildCacheStep.executeWithoutCache(BuildCacheStep.java:166)
  	at org.gradle.internal.execution.steps.BuildCacheStep.executeAndStoreInCache(BuildCacheStep.java:139)
  	at org.gradle.internal.execution.steps.BuildCacheStep.lambda$executeWithCache$4(BuildCacheStep.java:106)
  	at java.base/java.util.Optional.orElseGet(Optional.java:369)
  	at org.gradle.internal.execution.steps.BuildCacheStep.lambda$executeWithCache$5(BuildCacheStep.java:106)
  	at org.gradle.internal.Try$Success.map(Try.java:164)
  	at org.gradle.internal.execution.steps.BuildCacheStep.executeWithCache(BuildCacheStep.java:80)
  	at org.gradle.internal.execution.steps.BuildCacheStep.lambda$execute$0(BuildCacheStep.java:69)
  	at org.gradle.internal.Either$Left.fold(Either.java:115)
  	at org.gradle.internal.execution.caching.CachingState.fold(CachingState.java:59)
  	at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:68)
  	at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:46)
  	at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:36)
  	at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:25)
  	at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:36)
  	at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:22)
  	at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:91)
  	at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$2(SkipUpToDateStep.java:55)
  	at java.base/java.util.Optional.orElseGet(Optional.java:369)
  	at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:55)
  	at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:37)
  	at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:65)
  	at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:36)
  	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:37)
  	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:27)
  	at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:76)
  	at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:37)
  	at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:94)
  	at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:49)
  	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:71)
  	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:45)
  	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.executeWithNonEmptySources(SkipEmptyWorkStep.java:177)
  	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:86)
  	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:53)
  	at org.gradle.internal.execution.steps.RemoveUntrackedExecutionStateStep.execute(RemoveUntrackedExecutionStateStep.java:32)
  	at org.gradle.internal.execution.steps.RemoveUntrackedExecutionStateStep.execute(RemoveUntrackedExecutionStateStep.java:21)
  	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:38)
  	at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:36)
  	at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:23)
  	at org.gradle.internal.execution.steps.CleanupStaleOutputsStep.execute(CleanupStaleOutputsStep.java:75)
  	at org.gradle.internal.execution.steps.CleanupStaleOutputsStep.execute(CleanupStaleOutputsStep.java:41)
  	at org.gradle.internal.execution.steps.AssignWorkspaceStep.lambda$execute$0(AssignWorkspaceStep.java:32)
  	at org.gradle.api.internal.tasks.execution.TaskExecution$4.withWorkspace(TaskExecution.java:287)
  	at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:30)
  	at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:21)
  	at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:37)
  	at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:27)
  	at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:47)
  	at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:34)
  	at org.gradle.internal.execution.impl.DefaultExecutionEngine$1.execute(DefaultExecutionEngine.java:64)
  	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:146)
  	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:135)
  	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
  	at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
  	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
  	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:74)
  	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
  	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
  	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
  	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
  	at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
  	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
  	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
  	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:42)
  	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:337)
  	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:324)
  	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:317)
  	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:303)
  	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:4[63](https://github.com/remal-gradle-plugins/toolkit/actions/runs/4920440223/jobs/8789264019?pr=358#step:8:64))
  	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:380)
  	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:[64](https://github.com/remal-gradle-plugins/toolkit/actions/runs/4920440223/jobs/8789264019?pr=358#step:8:65))
  	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:49)
  	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
  	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
  	at java.base/java.lang.Thread.run(Thread.java:[82](https://github.com/remal-gradle-plugins/toolkit/actions/runs/4920440223/jobs/8789264019?pr=358#step:8:83)9)
@remal
Copy link
Author

remal commented May 9, 2023

Looks similar to closed #2092

DenuxPlays added a commit to jasonlessenich/DIH4JDA that referenced this issue May 9, 2023
DenuxPlays added a commit to jasonlessenich/DIH4JDA that referenced this issue May 9, 2023
* Bump com.google.errorprone:error_prone_core from 2.18.0 to 2.19.0

Bumps [com.google.errorprone:error_prone_core](https://github.com/google/error-prone) from 2.18.0 to 2.19.0.
- [Release notes](https://github.com/google/error-prone/releases)
- [Commits](google/error-prone@v2.18.0...v2.19.0)

---
updated-dependencies:
- dependency-name: com.google.errorprone:error_prone_core
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* applied suggested workaround for compiling with jdk 11

See here: google/error-prone#3895 and
google/error-prone#2092

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: -Denux <83671398+DenuxPlays@users.noreply.github.com>
@cushon
Copy link
Collaborator

cushon commented May 9, 2023

For anyone who runs into this, it would be helpful to know if you're seeing issues with checks other than HidingField, or whether disabling it (with -Xep:HidingField:OFF) is enough to fix your build.

The latest release was performed on JDK 17, using -source 11 -source 11 but implicitly using a JDK 17 bootclasspath: fee1ab9

The motivation for that was that there were some javadoc changes that depend on building on a newer version than 11 (7976d8f, ebbf729), so I decided to try building on JDK 17.

There are ways to work around this specific issue with HidingField, but if this is causing more widespread issues we should probably just unwind the javadoc changes again and continue building on JDK 11 (at least until we officially drop support for JDK 11, see #3803).

@msridhar
Copy link
Contributor

msridhar commented May 9, 2023

For us, setting -Xep:HidingField:OFF was enough to fix the build.

@sergeykad
Copy link
Contributor

sergeykad commented May 9, 2023

-Xep:HidingField:OFF fixes the build on Java 17 as well.

@KengoTODA
Copy link

I faced the same issue at https://github.com/spotbugs/spotbugs-gradle-plugin/actions/runs/4930832052/jobs/8812232200?pr=893

For reference, you can use this branch to reproduce this issue.

@remal
Copy link
Author

remal commented May 10, 2023

@cushon is it possible to support both JDK 11 and JDK 17 at the same time?

@moonfruit
Copy link

After disabling HidingField, my project also throws a similar exception java.lang.NoSuchMethodError: 'com.sun.tools.javac.util.List com.sun.tools.javac.code.Symbol$ClassSymbol.getEnclosedElements()' when compiling in Java 11.

Full stacktrace:

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.19.0
     BugPattern: (see stack trace)
     Stack Trace:
     java.lang.NoSuchMethodError: 'com.sun.tools.javac.util.List com.sun.tools.javac.code.Symbol$ClassSymbol.getEnclosedElements()'
  	at com.google.errorprone.util.ASTHelpers.getConstructors(ASTHelpers.java:1146)
  	at com.google.errorprone.bugpatterns.ComputeIfAbsentAmbiguousReference.matchMethodInvocation(ComputeIfAbsentAmbiguousReference.java:74)
  	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:1666)
  	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.scanAndReduce(TreeScanner.java:90)
  	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.visitNewClass(TreeScanner.java:525)
  	at com.google.errorprone.scanner.ErrorProneScanner.visitNewClass(ErrorProneScanner.java:774)
  	at com.google.errorprone.scanner.ErrorProneScanner.visitNewClass(ErrorProneScanner.java:150)
  	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1727)
  	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.visitReturn(TreeScanner.java:469)
  	at com.google.errorprone.scanner.ErrorProneScanner.visitReturn(ErrorProneScanner.java:817)
  	at com.google.errorprone.scanner.ErrorProneScanner.visitReturn(ErrorProneScanner.java:150)
  	at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1570)
  	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.visitBlock(TreeScanner.java:248)
  	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:1048)
  	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.scanAndReduce(TreeScanner.java:90)
  	at jdk.compiler/com.sun.source.util.TreeScanner.visitMethod(TreeScanner.java:206)
  	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:898)
  	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.scanAndReduce(TreeScanner.java:90)
  	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.visitClass(TreeScanner.java:187)
  	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: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.scanAndReduce(TreeScanner.java:90)
  	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.visitClass(TreeScanner.java:187)
  	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: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:560)
  	at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:150)
  	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: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:1414)
  	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1361)
  	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:136)
  	at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:183)
  	at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1140)
  	at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:193)
  	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:126)
  	at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:342)
  	at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:330)
  	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
  	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:175)
  	at org.apache.maven.lifecycle.internal.MojoExecutor.access$000(MojoExecutor.java:76)
  	at org.apache.maven.lifecycle.internal.MojoExecutor$1.run(MojoExecutor.java:163)
  	at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute(DefaultMojosExecutionStrategy.java:39)
  	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:160)
  	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:105)
  	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:73)
  	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:53)
  	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:118)
  	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:261)
  	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:173)
  	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:101)
  	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:827)
  	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:272)
  	at org.apache.maven.cli.MavenCli.main(MavenCli.java:195)
  	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)

@Stephan202
Copy link
Contributor

We're also seeing this issue in PicnicSupermarket/error-prone-support#621. In our case -Xep:HidingField:OFF is enough to fix the build.

@cushon
Copy link
Collaborator

cushon commented May 10, 2023

I am planning to look at using maven toolchains or similar so we have a way to test the artifacts built on JDK 17 running on JDK 11. If anyone has pointers for the best way of going about that, suggestions are welcome!

If you see similar crashes that don't look like the two below, please report them in the bug:

     java.lang.NoSuchMethodError: 'com.sun.tools.javac.util.List com.sun.tools.javac.code.Symbol$ClassSymbol.getEnclosedElements()'
  	at com.google.errorprone.util.ASTHelpers.getConstructors(ASTHelpers.java:1146)
     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)

@Stephan202
Copy link
Contributor

I am planning to look at using maven toolchains or similar so we have a way to test the artifacts built on JDK 17 running on JDK 11. If anyone has pointers for the best way of going about that, suggestions are welcome!

Ah, we have a PR open that does this (well, s/artifacts/bytecode/, but I assume that suffices to catch this case). Here is the relevant section. It is not necessary to explicitly configure toolchains.xml, because actions/setup-java transparently generates that file with an entry for each configured JDK. This shows how to configure more than one JDK.

@cushon
Copy link
Collaborator

cushon commented May 10, 2023

Thanks @Stephan202, that was extremely helpful! I was able to reproduce the crashes following your example.

copybara-service bot pushed a commit that referenced this issue May 10, 2023
…n JDK 11, and prepare to add test coverage for that configuration

Thanks to Stephan202's suggestion in #3895 (comment)

#3895

PiperOrigin-RevId: 530929411
copybara-service bot pushed a commit that referenced this issue May 10, 2023
…n JDK 11, and prepare to add test coverage for that configuration

Thanks to Stephan202's suggestion in #3895 (comment)

#3895

PiperOrigin-RevId: 530929411
copybara-service bot pushed a commit that referenced this issue May 10, 2023
…n JDK 11, and prepare to add test coverage for that configuration

Thanks to Stephan202's suggestion in #3895 (comment)

#3895

PiperOrigin-RevId: 530929411
copybara-service bot pushed a commit that referenced this issue May 10, 2023
…n JDK 11, and prepare to add test coverage for that configuration

Thanks to Stephan202's suggestion in #3895 (comment)

#3895

PiperOrigin-RevId: 530957571
copybara-service bot pushed a commit that referenced this issue May 10, 2023
*** Reason for rollback ***

Just testing

*** Original change description ***

Fix binary compatibility issues when building on JDK 17 and running on JDK 11, and prepare to add test coverage for that configuration

Thanks to Stephan202's suggestion in #3895 (comment)

#3895

PiperOrigin-RevId: 530962639
copybara-service bot pushed a commit that referenced this issue May 10, 2023
*** Reason for rollback ***

Just testing

*** Original change description ***

Fix binary compatibility issues when building on JDK 17 and running on JDK 11, and prepare to add test coverage for that configuration

Thanks to Stephan202's suggestion in #3895 (comment)

#3895

PiperOrigin-RevId: 530962639
@cushon
Copy link
Collaborator

cushon commented May 10, 2023

I pushed a 2.19.1 release with the fix: https://github.com/google/error-prone/releases/tag/v2.19.1

The binary compatibility issue was fixed in 5da8e9a, and we now have test coverage that would have prevented this (thanks @Stephan202's for the pointers!)

@cushon cushon closed this as completed May 10, 2023
msridhar added a commit to uber/NullAway that referenced this issue Jul 15, 2023
…779)

Error Prone ran into a similar issue in
google/error-prone#3895. We re-use the same
fix, and also add a CI job to test this case. We could avoid this
problem by only building releases on JDK 11, but might as well fix to
avoid that requirement.
copybara-service bot pushed a commit that referenced this issue Jul 31, 2023
See #4026.  `Symbol.getEnclosedElements()` is another method that can cause compatibility issues across JDK versions (#3895).

Fixes #4027

FUTURE_COPYBARA_INTEGRATE_REVIEW=#4027 from msridhar:asthelperssuggestions-getenclosedelements b4c01ba
PiperOrigin-RevId: 552505468
copybara-service bot pushed a commit that referenced this issue Jul 31, 2023
See #4026.  `Symbol.getEnclosedElements()` is another method that can cause compatibility issues across JDK versions (#3895).

Fixes #4027

COPYBARA_INTEGRATE_REVIEW=#4027 from msridhar:asthelperssuggestions-getenclosedelements b4c01ba
PiperOrigin-RevId: 552510760
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

7 participants