microsoft / microsoft/vscode-java-debug

ArrayList get(int) Object Error

未關閉
#916 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

ai-triaged bug evaluation
主要語言
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
  1. Run consolidated code
  2. 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.

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 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

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。