Fix handling of source compatibility with recent Java versions

See gh-1443
This commit is contained in:
Dawid Kreft 2023-07-18 14:29:07 +02:00 committed by Stephane Nicoll
parent 68ca360125
commit 6464c7df28
2 changed files with 5 additions and 3 deletions

View File

@ -100,7 +100,7 @@ public class KotlinDslGradleBuildWriter extends GradleBuildWriter {
if (generation >= 1 && generation <= 10) {
sb.append("VERSION_1_").append(generation);
}
else if (generation <= 17) {
else if (generation <= 24) {
sb.append("VERSION_").append(generation);
}
else {

View File

@ -57,7 +57,7 @@ class KotlinDslGradleBuildWriterTests extends GradleBuildWriterTests {
@ParameterizedTest
@MethodSource("sourceCompatibilityParameters")
void gradleBuildWithSourceCompatibility15(String sourceCompatibility, String javaVersionConstant) {
void gradleBuildWithSourceCompatibilities(String sourceCompatibility, String javaVersionConstant) {
GradleBuild build = new GradleBuild();
build.settings().sourceCompatibility(sourceCompatibility);
assertThat(write(build)).contains("""
@ -82,7 +82,9 @@ class KotlinDslGradleBuildWriterTests extends GradleBuildWriterTests {
Arguments.arguments("15", "JavaVersion.VERSION_15"),
Arguments.arguments("16", "JavaVersion.VERSION_16"),
Arguments.arguments("17", "JavaVersion.VERSION_17"),
Arguments.arguments("18", "JavaVersion.VERSION_HIGHER"));
Arguments.arguments("18", "JavaVersion.VERSION_18"),
Arguments.arguments("24", "JavaVersion.VERSION_24"),
Arguments.arguments("25", "JavaVersion.VERSION_HIGHER"));
}
@Test