microsoft / microsoft/vscode-java-debug
ArrayList get(int) Object Error
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ả
Error produced in debugger
Breakpoint condition 'test.get(0).get(0).equals("Work0")' error: Cannot evaluate because of compilation error(s): The method get(int) is undefined for the type Object.
Breakpoint created on line with System.out.println("End") used in debugger
test.get(0).get(0).equals("Work0")
Consolidated code
import java.util.ArrayList;
public class ArrayList2D {
public static void main(String[] args) {
ArrayList<ArrayList> test = new ArrayList<ArrayList>();
ArrayList subTest = new ArrayList();
subTest.add("Work0");
subTest.add("Work1");
subTest.add("Work2");
test.add(subTest);
System.out.println("Full ArrayList: " + test);
System.out.println("Targetted location of ArrayList: " + test.get(0).get(0));
if (test.get(0).get(0).equals("Work0")) {
System.out.println("Breakpoint should work!");
}
System.out.println("End");
}
}
Code Output without Debugger
Full ArrayList: [[Work0, Work1, Work2]]
Targetted location of ArrayList: Work0
Breakpoint should work!
End
Environment
- Operating System: Windows 10 x64
- JDK version: JDK 13.0.2
- Visual Studio Code version: 1.51.1
- Java extension version: 0.12.0
- Java Debugger extension version: 0.29.0
Steps To Reproduce
- Run consolidated code
- Setup a breakpoint at the End printout with test.get(0).get(0).equals("Work0")
Current Result
test.get(0).get(0): Cannot evaluate because of compilation error(s): The method get(int) is undefined for the type Object.
Expected Result
test.get(0).get(0): "Work0"
Additional Information
I have a program that uses 2D ArrayLists, and I commonly will track down issues utilizing the debugger. I have not used the debugger in a few months, but since I came back to my setup (same breakpoints as before) the debugger has changed behavior.
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
Bắt đầu bằng cách tái hiện vấn đề với mã ArrayList2D hợp nhất, JDK 13.0.2 và tiện ích mở rộng Java Debugger, sau đó lần theo quá trình đánh giá biểu thức điều kiện của trình gỡ lỗi cho test.get(0).get(0). Issue được hoàn tất khi điều kiện breakpoint được đánh giá thành công và hiển thị "Work0" thay vì báo rằng get(int) không được định nghĩa cho Object.
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
- 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