microsoft / microsoft/vscode-java-debug

static variable are not updated in the variable view.

オープン
#1,344 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

ai-triaged bug enhancement variables
主要言語
TypeScript
スター
591
フォーク
429
平均マージ
1日 9時間
マージ済み PR(30日)
19

説明

The static variables of an instance of a class are not updated in the variable view if another instance is changed.

Environment
  • Operating System: Windows 10
  • JDK version: JDK 1.8.311
  • Visual Studio Code version: 1.78.2
  • Java extension version: Language Support for Java(TM) by Red Hat v1.18.0
  • Java Debugger extension version: 0.50.0
Steps To Reproduce
  1. Create a simple class with a static variable as:
public class Dog {
    private static String name;
    private int age;

    public Dog(String name, int age) {
        Dog.name = name;
        this.age = age;
    }

    public static String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

}
  1. In the main create 3 instance of class Dog :
public class App {
    public static void main(String[] args) throws Exception {
        Dog d1 = new Dog("Medor", 3);
        Dog d2 = new Dog("Rex", 5);
        Dog d3 = new Dog("Fifi", 1);

        System.out.println("Dog 1 name : " + d1.getName());
    }
}
  1. Put a break point on the System.out.println
  2. Run in debug mode and check in the Variables View - Local if all dog have the same name.
  3. Edit the name of d2
Current Result

Only the name of d2 is changed and no possibility to update the name of the other dog. We can see if we add a watch that the name of the other dog changes correctly but not in the Variable view.

Expected Result

In the Variable view the name of all instance of dog should be updated, automatically or with a refresh button

Additional Informations

Very important for teachers to explains what happen with static variables.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Dog と App の例で問題を再現し、その後、Java デバッガーが Variables View の Local セクションにどのように値を設定し、そこから行った編集をどのように処理するかを調べます。d2 を変更した後のその表示を watch value と比較します。完了の条件は、利用可能な更新操作の後、または自動的に、すべてのインスタンスに現在の共有 static 名が表示されることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java, typescript
領域
developer-experience, devtools
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。