From c2bc5f00390b6c32a92b5a3749d9eef6a3b862a1 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Fri, 15 May 2015 17:31:48 +0300 Subject: [PATCH] IDEA-140341 Debugger stops in anonymous class constructor --- .../debugger/ui/breakpoints/LineBreakpoint.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/LineBreakpoint.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/LineBreakpoint.java index b56bd0912709..eeb4ad5482fe 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/LineBreakpoint.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/LineBreakpoint.java @@ -67,6 +67,7 @@ import javax.swing.*; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.regex.Pattern; public class LineBreakpoint extends BreakpointWithHighlighter { private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.ui.breakpoints.LineBreakpoint"); @@ -188,8 +189,16 @@ public class LineBreakpoint extends BreakpointWithHighlighter { updateUI(); } + private static Pattern ourAnonymousPattern = Pattern.compile(".*\\$\\d*$"); + private static boolean isAnonymousClass(ReferenceType classType) { + if (classType instanceof ClassType) { + return ourAnonymousPattern.matcher(classType.name()).matches(); + } + return false; + } + protected boolean acceptLocation(DebugProcessImpl debugProcess, ReferenceType classType, Location loc) { - return true; + return !(loc.method().isConstructor() && isAnonymousClass(classType)); } private boolean isInScopeOf(DebugProcessImpl debugProcess, String className) {