in initializer-generator/src/main/java/io/spring/start/site/project/JavaVersionProjectDescriptionCustomizer.java [65:155]
public void customize(MutableProjectDescription description) {
String javaVersion = description.getLanguage().jvmVersion();
if (UNSUPPORTED_VERSIONS.contains(javaVersion)) {
updateTo(description, "1.8");
return;
}
springNativeHandler().accept(description);
Integer javaGeneration = determineJavaGeneration(javaVersion);
if (javaGeneration == null) {
return;
}
Version platformVersion = description.getPlatformVersion();
// Spring Boot 3 requires Java 17
if (javaGeneration < 17 && SPRING_BOOT_3_0_0_OR_LATER.match(platformVersion)) {
updateTo(description, "17");
return;
}
// 13 support only as of Gradle 6
if (javaGeneration == 13 && description.getBuildSystem() instanceof GradleBuildSystem
&& !GRADLE_6.match(platformVersion)) {
updateTo(description, "11");
}
// 15 support only as of 2.2.11
if (javaGeneration == 15 && !SPRING_BOOT_2_3_0_OR_LATER.match(platformVersion)) {
updateTo(description, "11");
}
if (javaGeneration == 16) {
// Full Support as of Spring Boot 2.5 only.
// 16 support as of Kotlin 1.5
if (description.getLanguage() instanceof KotlinLanguage
&& !SPRING_BOOT_2_5_0_OR_LATER.match(platformVersion)) {
updateTo(description, "11");
}
// 16 support as of Gradle 7
if (description.getBuildSystem() instanceof GradleBuildSystem
&& !SPRING_BOOT_2_5_0_OR_LATER.match(platformVersion)) {
updateTo(description, "11");
}
// Groovy 3 only available as of 2.5
if (description.getLanguage() instanceof GroovyLanguage
&& !SPRING_BOOT_2_5_0_OR_LATER.match(platformVersion)) {
updateTo(description, "11");
}
// 16 support only as of 2.4.4
if (!SPRING_BOOT_2_4_4_OR_LATER.match(platformVersion)) {
updateTo(description, "11");
}
}
if (javaGeneration == 17) {
// Java 17 support as of Spring Boot 2.5.5
if (!SPRING_BOOT_2_5_5_OR_LATER.match(platformVersion)) {
updateTo(description, "11");
}
// Kotlin 1.6 only
if (description.getLanguage() instanceof KotlinLanguage
&& !SPRING_BOOT_2_6_0_OR_LATER.match(platformVersion)) {
updateTo(description, "11");
}
}
if (javaGeneration == 18) {
// Java 17 support as of Spring Boot 2.5.11
if (!SPRING_BOOT_2_5_11_OR_LATER.match(platformVersion)) {
updateTo(description, "17");
}
// Kotlin support to be determined
if (description.getLanguage() instanceof KotlinLanguage) {
if (!SPRING_BOOT_2_6_0_OR_LATER.match(platformVersion)) {
updateTo(description, "11");
}
else {
updateTo(description, "17");
}
}
}
if (javaGeneration == 19) {
// Java 18 support as of Spring Boot 2.6.12
if (!SPRING_BOOT_2_6_12_OR_LATER.match(platformVersion)) {
updateTo(description, "17");
}
// Kotlin support to be determined
if (description.getLanguage() instanceof KotlinLanguage) {
if (!SPRING_BOOT_2_6_0_OR_LATER.match(platformVersion)) {
updateTo(description, "11");
}
else {
updateTo(description, "17");
}
}
}
}