I'm trying out Kotlin 2.0.0-RC1 for the first time...
# eap
i
I'm trying out Kotlin 2.0.0-RC1 for the first time and getting:
e: KotlinTest.kt Argument type mismatch: actual type is 'com.mypackage.JavaClass<com.mypackage.OtherJavaClass>', but 'com.mypackage.JavaClass<com.mypackage.OtherJavaClass?>' was expected.
Compiles successfully with 1.9.23. I'm presuming I'll have to provide more details or a reproducer, but I figured I'd start by posting the error in case anyone recognizes it as a known issue.
1
Seems like it might be some sort of issue with an invariant type parameter in Java vs. Kotlin nullability/platform type inference. I'm not familiar with how invariant type parameters and platform types interoperate.
In my test the argument in question was a:
val javaClass: JavaClass<OtherJavaClass> = mockk()
I changed it to:
val javaClass: JavaClass<OtherJavaClass?> = mockk()
...and everything compiles now.
thank you color 1
a
@ianbrandt, can you please share a reproducer if possible? Thank you in advance!