-
Notifications
You must be signed in to change notification settings - Fork 60
Description
For the following example:
import junit.framework.TestCase;
public class BreakpointsBug extends TestCase
{
public void test1() {
int length;
if (getName() != null) {
length = getName().length();
}
else {
length = 0; // Breakpoint line
}
System.out.println(length);
}
public void test2() {
int length;
if (getName() != null) {
length = getName().length(); // Breakpoint line
}
else {
length = 0;
}
System.out.println(length);
}
}
set breakpoints on the breakpoiints lines; two filled blue circles are shown. Good.
Use the outline view to drag test2() above test1(). Oops the breakpoint in test2() is lost.
Undo. Oops the breakpoint in test2() is still lost.
In order to survive editing, it would seem that each breakpoint should be 'memento'ed by its hierarchical rather than line position. A little experimentation suggests that this is what JDT is doing successfully for many edits within a single editor session. Unfortunately the 'memento' is not respected by undo.
(No doubt related is the problem of preserving breakpiints across non-trivial source code changes resulting from a GIT checkout. This can result in some pretty crazy breakpoints (some of which - Issue #807 are shown but broken). If the 'memento' is something like BreakpointsBug::test2::statement(1)::then there may be a chance of useful migration.)