microsoft / microsoft/vscode-java-debug
ArrayList get(int) Object Error
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 591
- Forks
- 429
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 19
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the consolidated ArrayList2D code, JDK 13.0.2, and the Java Debugger extension, then trace the debugger's conditional-expression evaluation for test.get(0).get(0). The issue is done when the breakpoint condition evaluates successfully and displays "Work0" instead of reporting that get(int) is undefined for Object.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100