Why are some variables highlighted when debugging in eclipse?
8,507
It highlights variables whose values changed since the last step
So if I set the breakpoint inside a method, call it multiple times with different inputs, and resume repeatedly with F8, only the changed variables will be highlighted.
Try it out with:
public class Main {
static Integer f(Integer i, Integer i2) {
// Breakpoint here.
return i + i2;
}
public static void main(String[] args) {
Integer i0 = 0;
Integer i1 = 1;
Integer i2 = 2;
Integer i3 = 3;
f(i0, i1);
// F8
// None highlighted.
f(i0, i1);
// F8
// i2 highlighted.
f(i0, i2);
// F8
// i1 highlighted.
f(i1, i2);
// F8
// Both highlighted.
f(i3, i3);
}
}
The appearance of the changed variables can be modified as discussed at: https://stackoverflow.com/questions/11728040/eclipse-variables-window-changed-value-color
Related videos on Youtube
Author by
user350426
Updated on September 18, 2022Comments
-
user350426 over 1 year
I have bright yellow highlight on some variable values in debug perspective. They are not being watched. (Cannot show image as <10 reps.)
-
Frank Thomas almost 10 yearsare they all instances of the same variable?
-
user350426 almost 10 yearsyes - sorry for delay Frank
-