I enabled the new 1.5 experimental features as outlined below using the "compileKotlin" block with language/api verison as 1.5. This works except I get errors on an additional test sourceSet "Task :compileLongTestKotlin FAILED" "Class 'xx' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler. I had the same issue with my test folder so added "compileTestKotlin" block with the 1.5 options which worked. Adding the same for my additional sourceset results in "Could not find method compileLongTestKotlin()"
https://blog.jetbrains.com/kotlin/2021/02/new-language-features-preview-in-kotlin-1-4-30/#sealed-interfaces
m
Marc Knaup
02/07/2021, 7:23 PM
How do you set language version 1.5 exactly?
All source sets and projects that depends on 1.5 code also need to have language version 1.5 set.
a
Andrew
02/07/2021, 7:27 PM
Just with this in build.gradle
compileKotlin {
kotlinOptions {
languageVersion = "1.5"
apiVersion = "1.5"
}
}
And then unit tests didn't work until I added
compileTestKotlin {
kotlinOptions {
languageVersion = "1.5"
apiVersion = "1.5"
}
}
But now I have a 3rd sourceSet (another type of test) which I can't get to work. This is all the same project/module
v
Vampire
02/07/2021, 7:51 PM
Can you share an MCVE that reproduces your problem? Then it is much easier to maybe see your problem.