From 8dcb4ab5bb9719e4a5aabd7d564787fc1e4867c9 Mon Sep 17 00:00:00 2001 From: Natalia Ukhorskaya Date: Fri, 26 Dec 2014 15:04:44 +0300 Subject: [PATCH] Debugger: suppress UNSAFE_CALL diagnostic in debug mode --- .../debugger/DiagnosticSuppressorForDebugger.kt | 3 ++- .../testData/debugger/tinyApp/outs/unsafeCall.out | 9 +++++++++ .../src/evaluate/singleBreakpoint/unsafeCall.kt | 15 +++++++++++++++ .../KotlinEvaluateExpressionTestGenerated.java | 6 ++++++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 idea/testData/debugger/tinyApp/outs/unsafeCall.out create mode 100644 idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/unsafeCall.kt diff --git a/idea/src/org/jetbrains/jet/plugin/debugger/DiagnosticSuppressorForDebugger.kt b/idea/src/org/jetbrains/jet/plugin/debugger/DiagnosticSuppressorForDebugger.kt index daea75ac728..414f99644fb 100644 --- a/idea/src/org/jetbrains/jet/plugin/debugger/DiagnosticSuppressorForDebugger.kt +++ b/idea/src/org/jetbrains/jet/plugin/debugger/DiagnosticSuppressorForDebugger.kt @@ -31,7 +31,8 @@ public class DiagnosticSuppressorForDebugger : DiagnosticsWithSuppression.Diagno val diagnosticFactory = diagnostic.getFactory() return diagnosticFactory == Errors.INVISIBLE_MEMBER || diagnosticFactory == Errors.INVISIBLE_REFERENCE || - diagnosticFactory == Errors.INVISIBLE_SETTER + diagnosticFactory == Errors.INVISIBLE_SETTER || + diagnosticFactory == Errors.UNSAFE_CALL } return false diff --git a/idea/testData/debugger/tinyApp/outs/unsafeCall.out b/idea/testData/debugger/tinyApp/outs/unsafeCall.out new file mode 100644 index 00000000000..8a0d7bdccb6 --- /dev/null +++ b/idea/testData/debugger/tinyApp/outs/unsafeCall.out @@ -0,0 +1,9 @@ +LineBreakpoint created at unsafeCall.kt:8 +!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!;!CUSTOM_LIBRARY!;!RT_JAR! unsafeCall.UnsafeCallPackage +Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' +unsafeCall.kt:8 +Compile bytecode for s1.length() +Compile bytecode for s2.length() +Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' + +Process finished with exit code 0 diff --git a/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/unsafeCall.kt b/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/unsafeCall.kt new file mode 100644 index 00000000000..23605c9d853 --- /dev/null +++ b/idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/unsafeCall.kt @@ -0,0 +1,15 @@ +package unsafeCall + +// this test is used also to check more than one file for package in JetPositionManager:prepareTypeMapper. see forTests/simple.kt +fun main(args: Array) { + val s1: String? = "a" + val s2: String? = null + //Breakpoint! + args.size +} + +// EXPRESSION: s1.length() +// RESULT: 1: I + +// EXPRESSION: s2.length() +// RESULT: java.lang.NullPointerException: Ljava/lang/NullPointerException; \ No newline at end of file diff --git a/idea/tests/org/jetbrains/jet/plugin/debugger/evaluate/KotlinEvaluateExpressionTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/debugger/evaluate/KotlinEvaluateExpressionTestGenerated.java index 2a0f7e6aa76..decf76b2ec0 100644 --- a/idea/tests/org/jetbrains/jet/plugin/debugger/evaluate/KotlinEvaluateExpressionTestGenerated.java +++ b/idea/tests/org/jetbrains/jet/plugin/debugger/evaluate/KotlinEvaluateExpressionTestGenerated.java @@ -208,6 +208,12 @@ public class KotlinEvaluateExpressionTestGenerated extends AbstractKotlinEvaluat doSingleBreakpointTest(fileName); } + @TestMetadata("unsafeCall.kt") + public void testUnsafeCall() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/unsafeCall.kt"); + doSingleBreakpointTest(fileName); + } + @TestMetadata("vars.kt") public void testVars() throws Exception { String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/vars.kt");