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

--enable-preview is included when it shouldn't #933

Closed
anthonyvdotbe opened this issue Jan 15, 2021 · 2 comments
Closed

--enable-preview is included when it shouldn't #933

anthonyvdotbe opened this issue Jan 15, 2021 · 2 comments
Assignees

Comments

@anthonyvdotbe
Copy link

As the title says, see Steps to Reproduce below.

Environment
  • Operating System: Windows 10
  • JDK version: 16
  • Visual Studio Code version: 1.53.0-insider
  • Java extension version: 0.73.0
  • Java Debugger extension version: 0.30.0
Steps To Reproduce
  1. Java: Create Java Project... -> No build tools -> foo -> foo
  2. click Run on the main method in the generated App.java
Current Result

The following command is launched:

& '...\VSCode-win32-x64-1.53.0-insider\data\extensions\vscjava.vscode-java-debug-0.30.0\scripts\launcher.bat' '...\jdk-16\bin\java.exe' '--enable-preview' '-XX:+ShowCodeDetailsInExceptionMessages' '-Dfile.encoding=UTF-8' '-cp' '...\VSCode-win32-x64-1.53.0-insider\data\user-data\User\workspaceStorage\ea3a630f16912c5698c408dd545ca16a\redhat.java\jdt_ws\foo_a53cc022\bin' 'App'

which fails with a LinkageError.

Expected Result

The same, but without --enable-preview in the command, so that the Java program would run.

Additional Informations
@testforstephen
Copy link
Contributor

image

This is what I get when I reproduce these steps. The debugger is just following your project's compliance level to determine whether to append "--enable-preview" flag. The root cause is that Java Language Support detects that your jdk is the latest version and then enables the preview flag when compiling your project, but Java Language Support currently only supports java 15, so the compiled class version is 59.65535 (jdk 15 preview). Using jdk 16 can not run jdk 15 preview classes.

You have to open an issue at vscode-java, tell it's compiler not to enable preview features when the user is using a not supported higher jdk.

@testforstephen
Copy link
Contributor

here is the upstream issue eclipse-jdtls/eclipse.jdt.ls#1644

@testforstephen testforstephen self-assigned this Jan 22, 2021
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