diff --git a/eval4j/src/org/jetbrains/eval4j/jdi/jdiEval.kt b/eval4j/src/org/jetbrains/eval4j/jdi/jdiEval.kt index ecb4d71bb5a..f43e92fcba7 100644 --- a/eval4j/src/org/jetbrains/eval4j/jdi/jdiEval.kt +++ b/eval4j/src/org/jetbrains/eval4j/jdi/jdiEval.kt @@ -89,6 +89,18 @@ class JDIEval( } } + fun loadClassByName(name: String, classLoader: ClassLoaderReference): jdi_Type { + val dimensions = name.count { it == '[' } + val baseTypeName = if (dimensions > 0) name.substring(0, name.indexOf('[')) else name + + val baseType = primitiveTypes[baseTypeName] ?: Type.getType("L$baseTypeName;").asReferenceType(classLoader) + + return if (dimensions == 0) + baseType + else + Type.getType("[".repeat(dimensions) + baseType.asType().descriptor).asReferenceType(classLoader) + } + override fun loadString(str: String): Value = vm.mirrorOf(str).asValue() override fun newInstance(classType: Type): Value { @@ -413,18 +425,7 @@ class JDIEval( return argumentTypes() } catch (e: ClassNotLoadedException) { - return argumentTypeNames()!!.map { - name -> - val dimensions = name.count { it == '[' } - val baseTypeName = if (dimensions > 0) name.substring(0, name.indexOf('[')) else name - - val baseType = primitiveTypes[baseTypeName] ?: Type.getType("L$baseTypeName;").asReferenceType(declaringType().classLoader()) - - if (dimensions == 0) - baseType - else - Type.getType("[".repeat(dimensions) + baseType.asType().descriptor).asReferenceType(declaringType().classLoader()) - } + return argumentTypeNames()!!.map { name -> loadClassByName(name, declaringType().classLoader()) } } } } diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluationBuilder.kt b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluationBuilder.kt index d946f5cccdb..d42205f9ccf 100644 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluationBuilder.kt +++ b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluationBuilder.kt @@ -280,7 +280,7 @@ class KotlinEvaluator(val codeFragment: KtCodeFragment, val sourcePosition: Sour .zip(argumentTypes) .map { (value, type) -> // Make argument type classes prepared for sure - eval.loadClass(type, classLoader) + eval.loadClassByName(type.className, classLoader) boxOrUnboxArgumentIfNeeded(eval, value, type).asJdiValue(vm, type) } diff --git a/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/compilingEvaluator/ceLambda.kt b/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/compilingEvaluator/ceLambda.kt index 69c9596a8f0..1c3a0de779e 100644 --- a/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/compilingEvaluator/ceLambda.kt +++ b/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/compilingEvaluator/ceLambda.kt @@ -14,3 +14,6 @@ fun foo(p: () -> Int) = p() // EXPRESSION: foo { a } // RESULT: 1: I +// EXPRESSION: foo { args.size } +// RESULT: 0: I + diff --git a/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/compilingEvaluator/ceLambda.out b/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/compilingEvaluator/ceLambda.out index b89f4a7ad25..e1404dfa671 100644 --- a/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/compilingEvaluator/ceLambda.out +++ b/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/compilingEvaluator/ceLambda.out @@ -4,6 +4,7 @@ Connected to the target VM ceLambda.kt:6 Compile bytecode for foo { 1 } Compile bytecode for foo { a } +Compile bytecode for foo { args.size } Disconnected from the target VM Process finished with exit code 0