Skip to content

Commit

Permalink
Support JDK 20
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Stephan202 committed Apr 28, 2023
1 parent 3cfcbfd commit 06777ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ configure([tasks.compileJava]) {
options.release = 8

javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(19)
languageVersion = JavaLanguageVersion.of(20)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,13 @@ static void checkSourceLevel(
@Advice.Argument(value = 1, readOnly = false) Source.Feature feature
) {
if (feature.allowedInSource(Source.JDK8)) {
//noinspection UnusedAssignment
feature = Source.Feature.LAMBDA;
if (Source.MIN.compareTo(Source.JDK8) < 0) {
//noinspection UnusedAssignment
feature = Source.Feature.LAMBDA;
} else {
//noinspection UnusedAssignment
feature = Source.Feature.RECORDS;
}
}
}
}
Expand Down

0 comments on commit 06777ca

Please sign in to comment.