Skip to content

Commit 87cc006

Browse files
committed
Attempting to make JDK 14 work with vscode java.
1 parent c6a2fa2 commit 87cc006

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,5 +383,8 @@
383383
],
384384
"editor.formatOnPaste": true,
385385
"markdown.extension.toc.githubCompatibility": true,
386-
"python.linting.enabled": true
386+
"python.linting.enabled": true,
387+
"editor.codeActionsOnSave": {
388+
"source.fixAll.eslint": true
389+
}
387390
}

build.gradle

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ ext.junitJupiterVersion = '5.5.2'
3030
ext.log4jVersion = '2.9.0'
3131

3232
apply plugin: 'java'
33+
apply plugin: 'eclipse'
3334
apply plugin: 'application'
3435
apply plugin: 'com.github.kt3k.coveralls'
3536

@@ -45,14 +46,29 @@ jacocoTestCoverageVerification {
4546
}
4647
}
4748

49+
50+
sourceCompatibility = JavaVersion.VERSION_14
51+
targetCompatibility = JavaVersion.VERSION_14
52+
53+
compileJava {
54+
options.compilerArgs += ["--enable-preview"]
55+
}
56+
4857
compileTestJava {
49-
sourceCompatibility = 14
50-
targetCompatibility = 14
51-
options.compilerArgs += ['-parameters', '-g']
58+
options.compilerArgs += ['-parameters', '-g', '--enable-preview']
59+
}
60+
61+
//Buildship doesn't use that hook (https://discuss.gradle.org/t/when-does-buildship-eclipse-customization-run/20781/2)
62+
//you need to run `gradle eclipse` separately
63+
eclipse.jdt.file.withProperties { props ->
64+
props['org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures']= 'enabled'
65+
props['org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures']= 'ignore'
5266
}
5367

5468
// gradle support from JUnit5 team that we removed after gradle native support for JUnit5: http://junit.org/junit5/docs/current/user-guide/#running-tests-build-gradle
5569
test {
70+
jvmArgs '--enable-preview'
71+
5672
// https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html
5773
// Enable JUnit 5 (Gradle 4.6+).
5874
useJUnitPlatform {

0 commit comments

Comments
 (0)