Skip to content

Commit 06777ca

Browse files
committed
Support JDK 20
The JDK 20 release does not recognize the `LAMBDA` feature enum constant. Falling back to the `RECORDS` enum constant should guarantee support for the next few JDK releases.
1 parent 3cfcbfd commit 06777ca

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

example/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ configure([tasks.compileJava]) {
77
options.release = 8
88

99
javaCompiler = javaToolchains.compilerFor {
10-
languageVersion = JavaLanguageVersion.of(19)
10+
languageVersion = JavaLanguageVersion.of(20)
1111
}
1212
}
1313

jabel-javac-plugin/src/main/java/com/github/bsideup/jabel/JabelCompilerPlugin.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,13 @@ static void checkSourceLevel(
173173
@Advice.Argument(value = 1, readOnly = false) Source.Feature feature
174174
) {
175175
if (feature.allowedInSource(Source.JDK8)) {
176-
//noinspection UnusedAssignment
177-
feature = Source.Feature.LAMBDA;
176+
if (Source.MIN.compareTo(Source.JDK8) < 0) {
177+
//noinspection UnusedAssignment
178+
feature = Source.Feature.LAMBDA;
179+
} else {
180+
//noinspection UnusedAssignment
181+
feature = Source.Feature.RECORDS;
182+
}
178183
}
179184
}
180185
}

0 commit comments

Comments
 (0)