Hello, I'm using Mockative (<https://github.com/m...
# ksp
m
Hello, I'm using Mockative (https://github.com/mockative/mockative), which relies on KSP, to mock in a multiplatform lib's unit tests, but I'm getting the following error when running them:
Cannot inline bytecode built with JVM target 17 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
in lines such as
Copy code
@Mock
val someService = mock(classOf<SomeService>())
How can I specify this '-jvm-target'? Currently using kotlin multiplatform 1.9.0 and ksp 1.9.0-1.0.13 plugins. The kmp module is configured with:
Copy code
kotlin {
    targetHierarchy.default()
    androidTarget {
        compilations.all {
            kotlinOptions {
                languageVersion = "1.6"
                apiVersion = "1.6"
                jvmTarget = "1.8"
            }
        }
    }
    iosX64()
    iosArm64()
    iosSimulatorArm64()

...
}

...

android {
...
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
}
Sorry if this is not at all related to ksp.
n
Hi @Miguel Oliveira. I'm the author of Mockative. Which version are you using?
m
The latest one, 2.0.0
n
I see. I was able to reproduce the issue and will release a fix today. Thanks for discovering this issue 🙂
I have released version
2.0.1
this morning that aims to address the issue you're experiencing. Please let me know if it resolves your issue 🙂
m
@Nicklas Jensen it does solve it! Thank you very much for such a quick fix 🙌
🙏🏻 1