redhat-developer / redhat-developer/vscode-java
The java builder should use the correct compiler compliance to build the project
@snjeza がすでに取り組んでいます。
2020年2月20日 から。
- 主要言語
- TypeScript
- スター
- 2.3k
- フォーク
- 546
- 平均マージ
- 20時間 1分
- マージ済み PR(30日)
- 11
説明
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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
評価
この issue はまだ評価されていません。