microsoft / microsoft/vscode-java-debug
static variable are not updated in the variable view.
还没有人认领这个 Issue。
- 主要语言
- TypeScript
- 星标
- 591
- 派生
- 429
- 平均合并
- 1 天 9 小时
- 30 天内合并 PR
- 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
- 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;
}
}
- 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());
}
}
- Put a break point on the System.out.println
- Run in debug mode and check in the Variables View - Local if all dog have the same name.
- 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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用 Dog 和 App 示例复现该问题,然后检查 Java 调试器如何填充 Variables View 的 Local 部分,以及如何处理通过该部分进行的编辑。更改 d2 后,将该显示与 watch value 进行比较;完成的标准是所有实例都能自动显示当前共享的 static 名称,或在执行可用的刷新操作后显示该名称。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java, typescript
- 领域
- developer-experience, devtools
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100