Hi there,
Is there reason why this code won’t compile?
``
//Test.kt
fun main(args : Array<String>) {
val cls : Class<> = javaClass<Class<>>()
println(cls.getSuperclass())
}
bash> bin/kotlinc-jvm -output . -src Test.kt
ERROR: /Users/zemian/apps/kotlinc/Test.kt: (3, 15) Unresolved reference: getSuperclass
exec() finished with COMPILATION_ERROR return code
But if I remove explicit type and let it infer, then it compiles fine.
``
val cls = javaClass<Class<*>>()
println(cls.getSuperclass())
So what’s so special about “Class<*>” that it won’t resolve “getSuperclass”?
Thanks,
Zemian