mbonnin
01/19/2023, 10:53 AMWhen there is no explicit information about the jvmTarget value in the build script, its default value is null, and the compiler translates it to the default value 1.8. The targetCompatibility equals a current Gradle's JDK version
If the default value is 1.8
, how come targetCompatibility
is Gradle's JDK? Is there a difference between jvmTarget
and targetCompatibility
?tapchicoma
01/19/2023, 12:24 PMJavaCompile
by default has targetCompatibility
value set to current Gradle JDK version, while Kotlin jvmTarget
is always 1.8
(but not with Gradle 8.+).
So if you are running Gradle build with JDK 11 - your compiled Java and Kotlin classes will have different class versionmbonnin
01/19/2023, 12:25 PMtapchicoma
01/19/2023, 12:25 PMtargetCompatiblity
and jvmTarget
valuesmbonnin
01/19/2023, 12:26 PMtapchicoma
01/19/2023, 12:26 PMnull
leading to such differencetapchicoma
01/19/2023, 12:26 PMtapchicoma
01/19/2023, 12:27 PMmbonnin
01/19/2023, 12:28 PMmbonnin
01/19/2023, 12:28 PMmbonnin
01/19/2023, 12:28 PMtapchicoma
01/19/2023, 12:29 PM