Debugger: Pass files with inline functions to backend (KT-36404)

This commit is contained in:
Yan Zhulanow
2020-02-13 22:23:00 +09:00
parent 85a5e5241f
commit 0afd73b95c
5 changed files with 87 additions and 7 deletions
@@ -310,6 +310,11 @@ public class KotlinEvaluateExpressionTestGenerated extends AbstractKotlinEvaluat
runTest("idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/kt31709.kt");
}
@TestMetadata("kt36404.kt")
public void testKt36404() throws Exception {
runTest("idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/kt36404.kt");
}
@TestMetadata("kt5554OnlyIntsShouldBeCoerced.kt")
public void testKt5554OnlyIntsShouldBeCoerced() throws Exception {
runTest("idea/jvm-debugger/jvm-debugger-test/testData/evaluation/singleBreakpoint/kt5554OnlyIntsShouldBeCoerced.kt");
@@ -0,0 +1,53 @@
// FILE: lib/Application.java
package lib;
import org.jetbrains.annotations.NotNull;
import java.util.function.Supplier;
public interface Application {
static Application getInstance() {
return new Application() {
@Override
public void runReadAction(@NotNull Runnable runnable) {
runnable.run();
}
@Override
public <T> T runReadAction(@NotNull Fun<T> computation) {
return computation.invoke();
}
};
}
void runReadAction(@NotNull Runnable runnable);
<T> T runReadAction(@NotNull Fun<T> computation);
}
// FILE: lib/Fun.java
package lib;
public interface Fun<T> {
T invoke();
}
// FILE: lib/foo.kt
package lib
inline fun <R> runReadAction(crossinline runnable: () -> R): R {
return Application.getInstance().runReadAction(Fun { runnable() })
}
// FILE: test.kt
package test
import lib.*
fun main() {
//Breakpoint!
println(runReadAction { "hello" })
}
// EXPRESSION: runReadAction { "hello" }
// RESULT: "hello": Ljava/lang/String;
@@ -0,0 +1,10 @@
LineBreakpoint created at test.kt:8
Run Java
Connected to the target VM
test.kt:8
Compile bytecode for runReadAction { "hello" }
test.kt:8
Disconnected from the target VM
Process finished with exit code 0
hello