為什麼在eclipse中調試時有些變數會高亮?

為什麼在eclipse中調試時有些變數會高亮?

我在調試角度的一些變數值上有亮黃色突出顯示。他們沒有被監視。 (無法將影像顯示為 <10 次。)

答案1

它突出顯示自上一步以來值發生變化的變量

因此,如果我在方法內設定斷點,使用不同的輸入多次呼叫它,然後使用 F8 重複恢復,則只有更改的變數才會被反白。

試試一下:

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);
    }
}

可以按照以下討論修改已更改變數的外觀:https://stackoverflow.com/questions/11728040/eclipse-variables-window-changed-value-color

相關內容