limit location filtering by method name to java files only

This commit is contained in:
Eugene Zhuravlev
2013-10-28 18:02:12 +01:00
parent 0bb806473e
commit acf05c7364
@@ -211,7 +211,8 @@ public class LineBreakpoint extends BreakpointWithHighlighter {
protected boolean acceptLocation(DebugProcessImpl debugProcess, ReferenceType classType, Location loc) {
final OwnerMethod owner = myOwnerMethod;
if (owner != null) {
if (owner != null && owner.isJavaFile) {
// Additional filtering applicable to java files only.
// Consider:
// proc(()->{System.out.println("Task 1");}, ()->{System.out.println("Task 2");}); <breakpoint at this line>
//
@@ -445,7 +446,7 @@ public class LineBreakpoint extends BreakpointWithHighlighter {
@Override
public OwnerMethod compute() {
final PsiMethod method = DebuggerUtilsEx.findPsiMethod(file, offset);
return method != null? new OwnerMethod(method) : null;
return method != null? new OwnerMethod(method, file instanceof PsiJavaFile) : null;
}
});
}
@@ -583,14 +584,16 @@ public class LineBreakpoint extends BreakpointWithHighlighter {
@NotNull
final String name;
final boolean isConstructor;
final boolean isJavaFile;
OwnerMethod(@NotNull PsiMethod method) {
this(method.getName(), method.isConstructor());
OwnerMethod(@NotNull PsiMethod method, boolean isJavaFile) {
this(method.getName(), method.isConstructor(), isJavaFile);
}
OwnerMethod(@NotNull String name, boolean isConstructor) {
OwnerMethod(@NotNull String name, boolean isConstructor, boolean isJavaFile) {
this.name = name;
this.isConstructor = isConstructor;
this.isJavaFile = isJavaFile;
}
boolean matches(Location loc) {