New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
value class check - catch KotlinReflectionInternalError #922
Conversation
Some help for creating a test case: What triggered the issue for me was using private fun handleFailure(request: Supplier<MyResponse>):
Supplier<Either<SomeDeviation, MyResponse>>
return Supplier {
val response = request.get()
checkThatResponseIsNotFailure(response)
} where it is defined as @FunctionalInterface
public interface Supplier<T> {
/**
* Gets a result.
*
* @return a result
*/
T get();
} The equivalent in kotlin to It crashed on the return line with kotlin.reflect.jvm.internal.KotlinReflectionInternalError: Unresolved class: class com.mypackage.aproject.MyClass$$Lambda$607/0x000000080103d4c8
at kotlin.reflect.jvm.internal.KClassImpl.reportUnresolvedClass(KClassImpl.kt:328)
at kotlin.reflect.jvm.internal.KClassImpl.access$reportUnresolvedClass(KClassImpl.kt:44)
at kotlin.reflect.jvm.internal.KClassImpl$Data$descriptor$2.invoke(KClassImpl.kt:56)
at kotlin.reflect.jvm.internal.KClassImpl$Data$descriptor$2.invoke(KClassImpl.kt:48)
at kotlin.reflect.jvm.internal.ReflectProperties$LazySoftVal.invoke(ReflectProperties.java:93)
at kotlin.reflect.jvm.internal.ReflectProperties$Val.getValue(ReflectProperties.java:32)
at kotlin.reflect.jvm.internal.KClassImpl$Data.getDescriptor(KClassImpl.kt:48)
at kotlin.reflect.jvm.internal.KClassImpl.getDescriptor(KClassImpl.kt:182)
at kotlin.reflect.jvm.internal.KClassImpl.isValue(KClassImpl.kt:290)
at io.mockk.core.ValueClassSupport.isValue_safe(ValueClassSupport.kt:63)
at io.mockk.core.ValueClassSupport.getBoxedValue(ValueClassSupport.kt:20)
at io.mockk.proxy.jvm.advice.Interceptor.call(Interceptor.kt:22) I used And my code works if I downgrade to |
Amazing, thanks @krissrex - I will give it a go |
@aSemy public enum JavaEnum {
A {
public String toString() {
return "aaa";
}
}
} class MockTarget {
fun func(): JavaEnum = JavaEnum.A
}
fun main() {
val mock = mockk<MockTarget>()
every { mock.func() } returns JavaEnum.A
mock.func() // throws KotlinReflectionInternalError
}
|
can we release this? 🙏 |
It was released 5 days ago on 1.13.1 |
might fix #868
caused by #913?not caused by #913, it seemsKotlinReflectionInternalError
was never caught...This is a draft because I want to make a test for this to make sure it doesn't happen again. See https://youtrack.jetbrains.com/issue/KT-41373 for reproductions.Test added