https://kotlinlang.org logo
Title
r

Rohan Maity

06/08/2022, 7:54 AM
Does kotlin-kapt 1.6 support java 14?
t

tapchicoma

06/08/2022, 9:33 AM
what do mean by "support Java 14"? 🤔
r

Rohan Maity

06/08/2022, 9:42 AM
I mean does kotlin kapt work with java 14
t

tapchicoma

06/08/2022, 9:42 AM
should
r

Rohan Maity

06/08/2022, 9:44 AM
I have a multi module project and all the modules are set to java 14, java home is 14 and gradle is also using java 14 but for one module kotlin-kapt complains that
bad class file. File is 58.0 but should be 55.0
So my hunch was somehow kotlin-kapt is picking up java 11 only thats why this complaint
t

tapchicoma

06/08/2022, 10:46 AM
without reproducer project hard to tell what is the issue
Does your project use JVM toolchain to set JDK 14?
r

Rohan Maity

06/08/2022, 10:49 AM
No
t

tapchicoma

06/08/2022, 10:50 AM
please try to add toolchain configuration and see your project compiles
r

Rohan Maity

06/08/2022, 10:51 AM
Ok let me try this
This actually worked
👍 1
Thanks @tapchicoma
Earlier I was using this
java {
        sourceCompatibility = JavaVersion.VERSION_14
        targetCompatibility = JavaVersion.VERSION_14
    }

    tasks.compileKotlin {
        kotlinOptions {
            jvmTarget = "14"
        }
    }

    tasks.compileTestKotlin {
        kotlinOptions {
            jvmTarget = "14"
        }
    }
but this did not work
but using the toolchain did work