microsoft / microsoft/vscode-java-debug
Extension incorrectly runs cached `.class` file from another class of same name with no `package`
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ả
Bug report
Suppose there is a file structure:
folder1/
Main.java
folder2/
Main.java
// folder1/Main.java
public class Main {
public static void main(String[] args) {
System.out.println("Main 1");
}
}
// folder2/Main.java
public class Main {
public static void main(String[] args) {
System.out.println("Main 2");
}
}
No package statements; the projects are not connected at all.
When folder1/Main.java is run first, it gives the correct output Main 1.
But if folder2/Main.java is then run, it gives the wrong output of Main 1 instead of Main 2; the first built file is run instead.
folder1/Main.java 'shadows' folder2/Main.java, since the class name is the same and there are no package statements.
Another file structure that causes this is ./Main.java, ./folder/Main.java
This bug is inconvenient when multiple different, unrelated Java projects are in the same workspace.
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 đề bằng cách chạy folder1/Main.java rồi folder2/Main.java, bao gồm cả bố cục ./Main.java và ./folder/Main.java. Theo dõi cách extension chọn các lớp đã biên dịch được lưu trong bộ nhớ đệm; được xem là hoàn tất khi mỗi Main.java không liên quan chạy đầu ra riêng của nó, kể cả sau khi tệp còn lại đã được chạy.
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, vscode
- Lĩnh vực
- developer-experience, devtools
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 45/100