EA-219152 (partially): Support KClass 'unboxing' in debugger

KClass can be 'unboxed' to a plain Java class. Debugger should be aware of this.
Unfortunately, this commit is not enough to fully support this scenario, as it's impossible to invoke KClass methods/extension on java.lang.Class instance. There should be an additional diagnostic that will forbid such calls.
This commit is contained in:
Yan Zhulanow
2020-01-17 19:52:30 +09:00
parent a7071344f5
commit 7490c229ac
4 changed files with 43 additions and 0 deletions
@@ -0,0 +1,23 @@
package test
class Foo
fun main() {
val cls = Foo::class
val cls2 = Foo::class
val cls3 = Foo::class.java
//Breakpoint!
foo(cls2)
}
private fun foo(a: Any?) {}
// EXPRESSION: cls
// RESULT: instance of java.lang.Class(reflected class=test.Foo, id=ID): Ljava/lang/Class;
// EXPRESSION: cls2
// RESULT: instance of kotlin.jvm.internal.ClassReference(id=ID): Lkotlin/jvm/internal/ClassReference;
// EXPRESSION: cls3
// RESULT: instance of java.lang.Class(reflected class=test.Foo, id=ID): Ljava/lang/Class;
@@ -0,0 +1,10 @@
LineBreakpoint created at kClass.kt:11
Run Java
Connected to the target VM
kClass.kt:11
Compile bytecode for cls
Compile bytecode for cls2
Compile bytecode for cls3
Disconnected from the target VM
Process finished with exit code 0