Evaluate expression: fix exception when default package is used
#KT-5555 Fixed
This commit is contained in:
@@ -78,7 +78,7 @@ object KotlinEvaluationBuilder: EvaluatorBuilder {
|
||||
}
|
||||
|
||||
val packageName = file.getPackageDirective()?.getFqName()?.asString()
|
||||
if (packageName != null) {
|
||||
if (packageName != null && packageName.isNotEmpty()) {
|
||||
codeFragment.addImportsFromString("import $packageName.*")
|
||||
}
|
||||
return ExpressionEvaluatorImpl(KotlinEvaluator(codeFragment as JetCodeFragment, position))
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
LineBreakpoint created at .kt.kt:5
|
||||
!JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !APP_PATH!\classes;!KOTLIN_RUNTIME!;!RT_JAR! _DefaultPackage
|
||||
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||
.kt.kt:4
|
||||
Compile bytecode for 1 + 1
|
||||
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||
|
||||
Process finished with exit code 0
|
||||
@@ -0,0 +1,9 @@
|
||||
// Test evaluate expression for default package
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
//Breakpoint!
|
||||
args.size
|
||||
}
|
||||
|
||||
// EXPRESSION: 1 + 1
|
||||
// RESULT: 2: I
|
||||
+5
@@ -138,6 +138,11 @@ public class KotlinEvaluateExpressionTestGenerated extends AbstractKotlinEvaluat
|
||||
doSingleBreakpointTest("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/vars.kt");
|
||||
}
|
||||
|
||||
@TestMetadata(".kt.kt")
|
||||
public void test_kt() throws Exception {
|
||||
doSingleBreakpointTest("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/.kt.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/debugger/tinyApp/src/evaluate/multipleBreakpoints")
|
||||
|
||||
Reference in New Issue
Block a user