How do Kotlin versions map to Java versions? Will gradle and Kotlin make my bytecode compiled from Kotlin magically work in JVM version matching the Kotlin version?

Hello, picked up Kotlin a few hours ago. Consider:

build.gradle
---
plugins {
    id "org.jetbrains.kotlin.jvm" version "1.8.0"
}

repositories {
    mavenCentral()
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:1.8.0"
}

I know that Kotlin 1.8 targets Java version down to Java 8. So if my project uses the above gradle.build, will it compile into Java-8 compatible bytecode?

Posted Jun 10, 2024, 8:25 PM UTC

69

Comments aren't archived yet

This post had 9 comments on Reddit. Comments for this period haven't been loaded into the archive yet.