microsoft / microsoft/vscode-java-debug
ArrayList get(int) Object Error
还没有人认领这个 Issue。
- 主要语言
- TypeScript
- 星标
- 591
- 派生
- 429
- 平均合并
- 1 天 9 小时
- 30 天内合并 PR
- 19
描述
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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先使用整合后的 ArrayList2D 代码、JDK 13.0.2 和 Java Debugger 扩展重现该问题,然后跟踪调试器对 test.get(0).get(0) 的条件表达式求值过程。当断点条件成功求值并显示 "Work0",而不是报告 get(int) 对 Object 未定义时,该 Issue 即完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java, typescript
- 领域
- devtools
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100