diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/BreakpointListenerConnector.kt b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/BreakpointListenerConnector.kt new file mode 100644 index 00000000000..0a95fa11613 --- /dev/null +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/BreakpointListenerConnector.kt @@ -0,0 +1,18 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.debugger.breakpoints + +import com.intellij.debugger.engine.DebugProcessImpl +import com.intellij.openapi.progress.util.ProgressWindow +import com.intellij.xdebugger.breakpoints.XBreakpoint +import com.intellij.xdebugger.breakpoints.XBreakpointListener + +object BreakpointListenerConnector { + @JvmStatic + fun subscribe(debugProcess: DebugProcessImpl, indicator: ProgressWindow, listener: XBreakpointListener>) { + debugProcess.project.messageBus.connect(indicator).subscribe(XBreakpointListener.TOPIC, listener) + } +} \ No newline at end of file diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/BreakpointListenerConnector.kt.182 b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/BreakpointListenerConnector.kt.182 new file mode 100644 index 00000000000..6b261a9a36b --- /dev/null +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/BreakpointListenerConnector.kt.182 @@ -0,0 +1,18 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.debugger.breakpoints + +import com.intellij.debugger.engine.DebugProcessImpl +import com.intellij.openapi.progress.util.ProgressWindow +import com.intellij.xdebugger.XDebuggerManager +import com.intellij.xdebugger.breakpoints.XBreakpoint +import com.intellij.xdebugger.breakpoints.XBreakpointListener + +object BreakpointListenerConnector { + fun subscribe(debugProcess: DebugProcessImpl, indicator: ProgressWindow, listener: XBreakpointListener>) { + XDebuggerManager.getInstance(debugProcess.project).breakpointManager.addBreakpointListener(listener, indicator) + } +} \ No newline at end of file diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFunctionBreakpoint.java b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFunctionBreakpoint.java index 6c1379ec2fd..3e29f348b08 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFunctionBreakpoint.java +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFunctionBreakpoint.java @@ -67,6 +67,7 @@ import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; import java.util.function.BiConsumer; +import java.util.stream.Stream; // This class is copied from com.intellij.debugger.ui.breakpoints.MethodBreakpoint. // Changed parts are marked with '// MODIFICATION: ' comments. @@ -165,7 +166,7 @@ public class KotlinFunctionBreakpoint extends BreakpointWithHighlighter { - if (DebuggerUtilsImpl.instanceOf(referenceType, baseType)) { + if (instanceOf(referenceType, baseType)) { createRequestForPreparedClassEmulated(breakpoint, debugProcess, referenceType, false); } }, null); @@ -204,7 +205,7 @@ public class KotlinFunctionBreakpoint extends BreakpointWithHighlighter processPreparedSubTypes(baseType, (subType, classesByName) -> @@ -688,7 +689,7 @@ public class KotlinFunctionBreakpoint extends BreakpointWithHighlighter inheritance.putValue(st, type)); + supertypes(type).forEach(st -> inheritance.putValue(st, type)); } catch (ObjectCollectedException ignored) { } @@ -720,4 +721,25 @@ public class KotlinFunctionBreakpoint extends BreakpointWithHighlighter instanceOf(t, superType)); + } + + private static Stream supertypes(ReferenceType type) { + if (type instanceof InterfaceType) { + return ((InterfaceType)type).superinterfaces().stream(); + } else if (type instanceof ClassType) { + return StreamEx.ofNullable(((ClassType)type).superclass()).prepend(((ClassType)type).interfaces()); + } + return StreamEx.empty(); + } + // MODIFICATION: End }