From 469aedb132bd6fdcac75646ef2cb8e15cf2ea95d Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Wed, 17 May 2017 15:27:34 +0300 Subject: [PATCH] IDEA-169057 Emulated method breakpoints does not work with decompiled code --- .../com/intellij/debugger/impl/DebuggerUtilsEx.java | 4 ++-- .../com/intellij/debugger/jdi/MethodBytecodeUtil.java | 2 +- .../debugger/ui/breakpoints/MethodBreakpoint.java | 10 +++++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsEx.java b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsEx.java index 28b90c0a0159..affac13a73a5 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsEx.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsEx.java @@ -590,13 +590,13 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils { return new SigReader(s).getSignature(); } - @NotNull + @Nullable public static List allLineLocations(Method method) { try { return method.allLineLocations(); } catch (AbsentInformationException ignored) { - return Collections.emptyList(); + return null; } } diff --git a/java/debugger/impl/src/com/intellij/debugger/jdi/MethodBytecodeUtil.java b/java/debugger/impl/src/com/intellij/debugger/jdi/MethodBytecodeUtil.java index fad2fcf534d8..7318b1414e45 100644 --- a/java/debugger/impl/src/com/intellij/debugger/jdi/MethodBytecodeUtil.java +++ b/java/debugger/impl/src/com/intellij/debugger/jdi/MethodBytecodeUtil.java @@ -201,7 +201,7 @@ public class MethodBytecodeUtil { dos.write(bytecodes); // code dos.writeShort(0); // exception_table_length List locations = withLineNumbers ? DebuggerUtilsEx.allLineLocations(method) : Collections.emptyList(); - if (!locations.isEmpty()) { + if (!ContainerUtil.isEmpty(locations)) { dos.writeShort(1); // attributes_count dos.writeShort(cw.newUTF8("LineNumberTable")); dos.writeInt(2 * locations.size() + 2); diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/MethodBreakpoint.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/MethodBreakpoint.java index 6ab93c6116af..82eb6a59bf9d 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/MethodBreakpoint.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/MethodBreakpoint.java @@ -200,17 +200,21 @@ public class MethodBreakpoint extends BreakpointWithHighlighter allLineLocations = DebuggerUtilsEx.allLineLocations(method); - if (!allLineLocations.isEmpty()) { + if (allLineLocations == null) { // no line numbers + breakpoint.disableEmulation(); + return; + } + if (!ContainerUtil.isEmpty(allLineLocations)) { if (breakpoint.isWatchEntry()) { createLocationBreakpointRequest(breakpoint, ContainerUtil.getFirstItem(allLineLocations), debugProcess); }