https://kotlinlang.org logo
Title
l

LeoColman

04/08/2020, 3:14 PM
I'm not sure if this is really related to Kotest. This piece of code I see in every kotlin project
a

Attila Domokos

04/08/2020, 3:17 PM
Which one? The
jvmTarget
?
l

LeoColman

04/08/2020, 3:18 PM
Yes
Usually targetting JVM 8 tho hahah
a

Attila Domokos

04/08/2020, 3:19 PM
I see.
l

LeoColman

04/08/2020, 3:20 PM
That usually means that your gradle project is targetting 1.6
While Kotest was compiled with 1.8
And for that reason you can't inline the code, as they're not compatible
Not sure if that's just that tho. But this error have a big question at StackOverflow hahah
a

Attila Domokos

04/08/2020, 3:22 PM
This is a noob quesiton: so this setting is not going to target a specific jvm, it just gives directives to the Kotlin compiler to generate more modern (possibly Jvm 1.8 compatible) byte code.
m

Mike

04/08/2020, 3:26 PM
As Leonardo said, Kotlintest was compiled against 1.6 before, and if you don't explicitly state a jvmTarget, then the Kotlin compiler uses 1.6. Kotest is compiled against 1.8. Your project is still targeting 1.6. So you can't use the
inline
from a 1.8 on the 1.6 JVM. What you put with
withType<Test>
will target only test tasks. Hopefully that helps. Are you targetting older versions of Android, or still using JDK 1.6 for your dev? Otherwise, may as well target 1.8 as there are a number of JVM improvements that allow for 'better' bytecode generation.
a

Attila Domokos

04/08/2020, 3:27 PM
Thank you for the info! This and reading up on it helped a ton. 💯
s

sam

04/08/2020, 3:37 PM
Could we compile kotest to 1.6?
I'm not sure if we're using anything from 1.8 specifically? We might be.
a

Attila Domokos

04/08/2020, 3:37 PM
shouldThrow
was the only thing complaining.
s

sam

04/08/2020, 3:37 PM
that comes from kotest-assertions
it might be that entire package not sure