Community
Participate
Working Groups
We may be able to enhance method exit breakpoints by converting the method exit request to line breakpoints on corresponding return statements. Would require use of AST to locate return statements.
Deferred
Could also benefit from this pending feature: "Add a method filter to MethodEntryRequest and MethodExitRequest" http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6447614
As of now 'LATER' and 'REMIND' resolutions are no longer supported. Please reopen this bug if it is still valid for you.
Reopening, request is still valid. I just wanted to use a MethodExit breakpoint on java.util.Arrays#sort(Object[]) to find broken compare implementations. But it was unusably slow, probably due to the abundance of calls to Arrays#copyOf(..). Fortunately, I could reuse the breakpoint condition and just use it in line breakpoints at the end of java.util.ComparableTimSort#sort(Object[], int, int) and on the early returns of that method. That performed well. Object[] sorted= arg0; int l = sorted.length; for (int i= 0; i < l; i++) { for (int j= 0; j < l; j++) { Comparable oi= (Comparable) sorted[i]; Comparable oj= (Comparable) sorted[j]; int c= oi.compareTo(oj); if (i < j) { if (c > 0 || c == 0 && !oi.equals(oj)) { System.out.println(i+","+j+","+c+ "\n"+oi + "\n"+oj); return true; } } else if (i == j) { if (c != 0) { System.out.println(i+","+j+","+c+ "\n"+oi + "\n"+oj); return true; } } else { if (c < 0 || c == 0 && !oi.equals(oj)) { System.out.println(i+","+j+","+c+ "\n"+oi + "\n"+oj); return true; } } } } return false;
I can confirm that code is executed many times slower when a method exit breakpoint is used. Today I wanted to debug a void method which was ending with a for loop. As there was no statement after the loop where I could have set a checkpoint I decided to set a method exit breakpoint. The performance of the method slowed down so much that I even restarted my machine because I could not explain what was going on. During the next debug session I was waiting once more for the loop to finish an I decided to deselect the Exit property of the breakpoint. Immediately the loop completed. This gave me a hint to search for this bug report.