redhat-developer / redhat-developer/vscode-java
The java builder should use the correct compiler compliance to build the project
@snjeza ci sta già lavorando.
Dal 20/2/2020.
- Lingua principale
- TypeScript
- Stelle
- 2.3k
- Fork
- 547
- Merge medio
- 20h 1m
- PR unite (30g)
- 11
Descrizione
Environment
- Operating System: MacOS and Windows 10
- JDK version: any
- Visual Studio Code version: 1.41.x or 1.42.0-insider
- Java extension version: 0.57.0
Steps To Reproduce
- Have java.home to point to JDK 13, and launch the language server.
- Have Java 8 installed in the machine.
- Configure multiple JDKs in the user setting.
"java.configuration.runtimes": [
{
"name": "JavaSE-13",
"path": "C:\\Program Files\\Java\\jdk-13.0.1"
},
{
"name": "JavaSE-1.8",
"path": "C:\\Program Files\\AdoptOpenJDK\\jdk-8.0.242.08-hotspot"
}
]
- Open an eclipse Java 8 project 26.environmentVariables.zip
.

Current Result:
See the screenshot above, the PROBLEMS viewlet reports a warning on the project: "The compiler compliance specified is 13 but a JRE 1.8 is used". This means the classfile built by the ls is targeting to java 13, that would make it not able to be launched in JDK 8.
Besides, the debugger has fixed a bug https://github.com/microsoft/vscode-java-debug/issues/753 about using the project's Java runtime to launch the application. The latest debugger would fail at this case.
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: EnvrionmentVariable has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:757)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)
Expected
The language server should generate the compatible .class files with the project's Java Runtime.
// @fbricon @snjeza
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Valutazione
Questa issue non è ancora stata valutata.