What is mean java.lang.NoSuchMethodError: kotlin.jvm.internal.Intrinsics.reifyClassLiteral?


#1

 

package reified

import java.util.*
import kotlin.reflect.KClass

val valuesInjectFnc = HashMap<KClass<out Any>, Any>()

inline fun <reified T : Any> registerFnc(noinline value: Function0<T>) {
  valuesInjectFnc[T::class] = value
}

inline fun <reified T : Any> injectFnc(): Lazy<Function0<T>> = lazy(LazyThreadSafetyMode.NONE) {
  (valuesInjectFnc[T::class] ?: throw Exception(“no inject ${T::class.simpleName})) as Function0<T>
}

class Box

class Boxer{
  val box:()->Box by injectFnc()
}

fun main(args: Array<String>) {
  val box = Box()
  registerFnc({box})
  println(Boxer().box())
}

Actual:

Exception in thread "main" java.lang.NoSuchMethodError: kotlin.jvm.internal.Intrinsics.reifyClassLiteral(Ljava/lang/String;)V      at reified.MainKt$injectFnc$1.invoke(Main.kt:13)      at reified.MainKt$injectFnc$1.invoke(Main.kt)      at kotlin.UnsafeLazyImpl.getValue(Lazy.kt:148)      at kotlin.LazyKt.get(Lazy.kt:77)      at reified.Boxer.getBox(Main.kt)      at reified.MainKt.main(Main.kt:25)      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)      at java.lang.reflect.Method.invoke(Method.java:497)      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

Expected: No err.

What is mean this err? How to avoid?


#2

Which versions of the Kotlin plugin and the runtime are you using?


#3

Oh, kotlin 0.14.449.Idea141.12, idea 141.2735.


#4

What's the version of the Kotlin Runtime library included in your project? Ideally it should be the same as the plugin


#5

I use this C:Users${user}.IntelliJIdea14configpluginsKotlinkotlinclibkotlin-runtime.jar. I check MANIFEST.MF in this jar:

Implementation-Version: 0.14.449

#6

This seems to me like a bug, please report it to the tracker at youtrack.jetbrains.com. Thank you!


#7

I created, https://youtrack.jetbrains.com/issue/KT-9637