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

False positive warnings and errors #3807

Open
WillsterJohnson opened this issue Oct 8, 2024 · 1 comment
Open

False positive warnings and errors #3807

WillsterJohnson opened this issue Oct 8, 2024 · 1 comment

Comments

@WillsterJohnson
Copy link

When loading a java project, the extension reports hundreds of warnings and errors. once those files are opened, the nonsenese warnings and errors disappear.
If at any point all java files are closed, the nonsense warnings and errors reappear.

The only way to get rid of them is to open every file they appear in.

Environment
  • Operating System: MacOS 14.5
  • Visual Studio Code version: 1.95.0
  • Java extension version: 1.35.1
$ java -version
openjdk version "22.0.2" 2024-07-16
OpenJDK Runtime Environment Zulu22.32+15-CA (build 22.0.2+9)
OpenJDK 64-Bit Server VM Zulu22.32+15-CA (build 22.0.2+9, mixed mode, sharing)
Steps To Reproduce
  1. Open a relatively large java project
  2. observe nonsense errors and warnings

Dozens of warnings for file ArrayList.java

No issues found in file after opening

@sworthiness
Copy link

sworthiness commented Dec 6, 2024

I am also suffering from this problem

Version: 1.95.3
Release: 24321
Commit: dc5a551c256719475d2d0959270e3836c9bbb632
Date: 2024-11-16T09:16:49.983Z
Electron: 32.2.5
ElectronBuildId: undefined
Chromium: 128.0.6613.186
Node.js: 20.18.0
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.19045
Project is compiled at JDK17; LS is run with JDK23

Looking in the LS logs the following is seen:

!ENTRY org.eclipse.jdt.core 4 0 2024-12-06 13:56:44.603
!MESSAGE compilation failed
!STACK 0
com.sun.tools.javac.util.ClientCodeException: java.lang.NoSuchFieldError: Class com.sun.tools.javac.parser.Tokens$Comment$CommentStyle does not have member field 'com.sun.tools.javac.parser.Tokens$Comment$CommentStyle JAVADOC'
	at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$WrappedTaskListener.finished(ClientCodeWrapper.java:880)
	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:1432)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1389)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:977)
	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:897)
	at org.eclipse.jdt.internal.javac.JavacCompiler.compile(JavacCompiler.java:183)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:441)
	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:250)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:372)
	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:118)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:314)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:220)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:1077)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:296)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:352)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:441)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:444)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:555)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:503)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:585)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:207)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:300)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Whenever the project is re-built/re-compiled this error is seen followed by many many others (presumably caused by this one)

This is a known bug and has been fixed in openjdk/jdk@0a58cff#diff-b0022dadcf17a9350521e4292b68668246c32423d90633ce91f8dc350eb78c70R277-R280

But as far as i can tell, is not available yet in JDK23-GA ?

I've tried running the Language Server with early access JDK24, but there are other incompatibilities that i don't have the time to look into. Neither is it really a good work around :(

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