I know how to set a watchpoint for a field (right click variable in variables view -> watch). But the execution pauses on access/modification of that field of ALL objects of that type.
How can one just pause execution when a certain field of a SPECIFIC OBJECT is accessed or modified?
To make it more clear:
class A { int a; }
public static void main(String[] args) {
List<A> myList = new ArrayList<A>();
// assume a lot of A's are added here
A interestingA = new A();
myList.add(someIndex, interestingA);
for(A a : myList) {
a.a = 42; // debugger shall stop here, but only,
// if it is the interesting A
}
}
Obviously I cannot set a breakpoint there, because I would have to click on continue a lot of times. Furthermore, interestingA may be modified from other spots I am not aware of and in that case debugger should stop too.