IDEA-220029 Step into does not filter out privately accessed methods

GitOrigin-RevId: f45b9cafa32672cf03c5a9ed2cbef8549520e3f4
This commit is contained in:
Egor Ushakov
2019-08-07 16:05:50 +03:00
committed by intellij-monorepo-bot
parent 9fe7f9ba61
commit 64dba7e767
@@ -376,28 +376,9 @@ public class JavaSmartStepIntoHandler extends JvmSmartStepIntoHandler {
.select(MethodSmartStepTarget.class)
.filter(target -> !target.needsBreakpointRequest())
.toList();
visitLinesInstructions(frameProxy.location(), true, lines, (opcode, owner, name, desc, itf, ordinal) -> {
if (name.startsWith("access$")) { // bridge method
ReferenceType cls = ContainerUtil.getFirstItem(virtualMachine.classesByName(owner));
if (cls != null) {
Method method = DebuggerUtils.findMethod(cls, name, desc);
if (method != null) {
MethodBytecodeUtil.visit(method, new MethodVisitor(Opcodes.API_VERSION) {
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
if ("java/lang/AbstractMethodError".equals(owner)) {
return;
}
removeMatchingMethod(methodTargets, owner, name, desc, ordinal, debugProcess);
}
}, false);
}
}
}
else {
removeMatchingMethod(methodTargets, owner, name, desc, ordinal, debugProcess);
}
});
visitLinesInstructions(frameProxy.location(), true, lines,
(opcode, owner, name, desc, itf, ordinal) ->
removeMatchingMethod(methodTargets, owner, name, desc, ordinal, debugProcess));
if (!methodTargets.isEmpty()) {
return Collections.emptyList();
}
@@ -491,7 +472,26 @@ public class JavaSmartStepIntoHandler extends JvmSmartStepIntoHandler {
String key = owner + "." + name + desc;
int currentCount = myCounter.get(key);
myCounter.put(key, currentCount + 1);
visitor.visitMethodInsn(opcode, owner, name, desc, itf, currentCount);
if (name.startsWith("access$")) { // bridge method
ReferenceType cls = ContainerUtil.getFirstItem(location.virtualMachine().classesByName(owner));
if (cls != null) {
Method method = DebuggerUtils.findMethod(cls, name, desc);
if (method != null) {
MethodBytecodeUtil.visit(method, new MethodVisitor(Opcodes.API_VERSION) {
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
if ("java/lang/AbstractMethodError".equals(owner)) {
return;
}
visitor.visitMethodInsn(opcode, owner, name, desc, itf, currentCount);
}
}, false);
}
}
}
else {
visitor.visitMethodInsn(opcode, owner, name, desc, itf, currentCount);
}
}
}
}, true);