-
Notifications
You must be signed in to change notification settings - Fork 414
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
Support for JDK 14 for Gradle projects #1338
Comments
@manastalukdar You may want to take a look at #1302 and eclipse-jdtls/eclipse.jdt.ls#1360 |
Please... Right now... /Library/Java/JavaVirtualMachines/openjdk-14.jdk/Contents/Home/bin/java --enable-preview -Dfile.encoding=UTF-8 -cp "/Users/gabriel/Library/Application Support/Code/User/workspaceStorage/2cfe7776ea6b5be44832e599c44a91d4/redhat.java/jdt_ws/EvolveN_64cb39b9/bin" ConnectN So the javac and java versions are not aligned (I only have JDK 14 and bothered to check that 13 wasn't there anymore): compiles with v13 and runs with v14 for some reason. If we could disable preview features when compiling, that would be a workaround Thanks |
@manastalukdar you can try to add the following property:
to <your_project>/.settings/org.eclipse.jdt.core.prefs |
The server fix applies the Java 14 patch on JDT 4.15 (See https://marketplace.eclipse.org/content/java-14-support-eclipse-2020-03-415) Known Issues:
|
@manastalukdar sorry but seems like Java 14 support for Gradle is not there yet. Your example uses compileTestJava, which is ignored by Buildship, because Eclipse cannot use different compiler settings for main and test code, nothing we can do about it.
This might be caused by Buildship embedding its own version of the gradle api, as opposed to the version used by the gradle wrapper, but I'm not sure. @donat? |
Exactly. We'll fix this shorly. Check eclipse/buildship#979 for the details. |
Example of build.gradle file supporting Java 14 preview features. Requires Gradle 6.3 and needs to manually invoke apply plugin: 'java'
apply plugin: 'eclipse'
sourceCompatibility = JavaVersion.VERSION_14
targetCompatibility = JavaVersion.VERSION_14
compileJava {
options.compilerArgs += ["--enable-preview"]
}
compileTestJava {
options.compilerArgs += ["--enable-preview"]
}
//Buildship doesn't use that hook (https://discuss.gradle.org/t/when-does-buildship-eclipse-customization-run/20781/2)
//you need to run `gradle eclipse` separately
eclipse.jdt.file.withProperties { props ->
props['org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures']= 'enabled'
props['org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures']= 'ignore'
}
test {
jvmArgs '--enable-preview'
} |
Does not work. Following exception from
|
@manastalukdar this is another issue. Please open a different ticket for that, with exact steps to reproduce (adding a sample project would help a lot). |
@fbricon NPE issue is resolved with latest extension. All good now. Thanks for your help. |
Please add support for JDK 14
Environment
Repro project: https://github.com/manastalukdar/dummy-java (gradle based)
Update: https://twitter.com/VSCodeJava/status/1241478764091133952
The text was updated successfully, but these errors were encountered: