microsoft / microsoft/vscode-java-debug

ArrayList get(int) Object Error

Abierto
#916 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

ai-triaged bug evaluation
Lenguaje dominante
TypeScript
Estrellas
591
Forks
429
Merge medio
1 d 9 h
PR fusionados (30 d)
19

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza reproduciendo el problema con el código consolidado de ArrayList2D, JDK 13.0.2 y la extensión Java Debugger; después, sigue la evaluación de la expresión condicional del depurador para test.get(0).get(0). El issue estará terminado cuando la condición del breakpoint se evalúe correctamente y muestre "Work0" en lugar de informar de que get(int) no está definido para Object.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java, typescript
Área
devtools
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.