-
Notifications
You must be signed in to change notification settings - Fork 408
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
JDK API leaks despite source/target compatibility settings #620
Comments
|
I have a gradle.build file with the following contents in an otherwise empty project root
Then when I create a .java file with the following contents:
It still provides me with Am I doing something wrong here? |
Ok so this one is a bit tricky. By default, JDT, regardless of the compilation options you provide, always leaks the JDK classes/methods of the JDK used to compile your project (but the same happens with a CLI build). Now, if you were on a Mac AND Java 7 was installed in /Library/Java/JavaVirtualMachines, then jdt.ls would automatically pick it up and use it to provide compilation, content assist for your project, regardless of the Java version the server is started with. That'd solve your issue. One possible fix for jdt.ls would probably be to expose some preferences to set some specific JDKs used for compilation. possible workaround: If jdt.ls is started with Java 9 (or higher), and is used to compile your projects, then there's a way to enable that release flag.
Unfortunately, JDT would still leak Java 9 APIs during autocompletion (that's an upstream issue), but at least you'd get a compilation error as soon as the file is saved. |
Okay, that clears up things, I'll look into the workaround. Thank you so much. |
The more I think about it, the more I think we should probably set |
Why is it even a setting if it does not have any side-effects |
¯\(ツ)/¯ |
Does this Language Server support completions for Java 7 by any chance? If so, should the home key value change in the JavaConfiguration in the initializationOptions for initialize params suffice or is something else to be done as well?
The text was updated successfully, but these errors were encountered: