microsoft / microsoft/vscode-java-debug
static variable are not updated in the variable view.
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- TypeScript
- Star
- 591
- Fork
- 429
- Merge trung bình
- 1 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 19
Mô tả
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.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Tái hiện vấn đề với các ví dụ Dog và App, sau đó kiểm tra cách trình gỡ lỗi Java điền vào phần Local của Variables View và xử lý các chỉnh sửa được thực hiện thông qua đó. So sánh phần hiển thị này với watch value sau khi thay đổi d2; hoàn tất khi tất cả các instance tự động hiển thị tên static dùng chung hiện tại hoặc hiển thị tên đó sau một thao tác làm mới khả dụng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java, typescript
- Lĩnh vực
- developer-experience, devtools
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100