What bytecode will Kotlin compiller produce if jvmToolchain is set to 11 and jvmTarget to 1.8?

188 Views Asked by At

I have a Kotlin project that I want to compile to Java 1.8 bytecode so that it could also be used on Android as well. I use the com.vanniktech.maven.publish Gradle plugin to publish the library to Maven Central. This plugin works only when I set jvmToolchain to 11. However I can still set jvmTarget to 1.8. This way, my configuration would look like this:

compileKotlin {
    kotlinOptions.jvmTarget = '1.8'
}

kotlin {
    jvmToolchain(11)
}

This works, but I am not sure what bytecode it would produce. It also gives compilation warning asking me to set both values to the same version.

Question: What version of bytecode will Gradle project produce if jvmToolchain is set to 11 and jvmTarget to 1.8?

Alliteratively, how can I make it produce Java 1.8 bytecode in a different way? (If I am doing something wrong).

0

There are 0 best solutions below