I experience problems when debugging in eclipse. Similar issues are described in a post from more than 4 years ago. It is reported to be solved by some more recent versions of eclipse (STS) but obviously not in my environment. Any suggestions please?

eclipse Version: 2023-09 (4.29.0)
eclipse Build id: 20230907-1323

java version:
openjdk version "20.0.2" 2023-07-18
OpenJDK Runtime Environment GraalVM CE 20.0.2+9.1 (build 20.0.2+9-jvmci-23.0-b15)
OpenJDK 64-Bit Server VM GraalVM CE 20.0.2+9.1 (build 20.0.2+9-jvmci-23.0-b15, mixed mode, sharing)

os version: Microsoft Windows [Version 10.0.22631.2715]

code:

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Test
{
    public static void main(String[] args)
    {
        List<Integer> range = IntStream.rangeClosed(1, 10).boxed().collect(Collectors.toList());
        range.forEach(i -> System.out.println(i));
    }
}

enter image description here

breakpoint at range.forEach(...)

update

for those who searched for the show/hide logical structure button that is referred to in the accepted answer from @marco casallas, here is a snapshot with the button marked red show/hide logical structure button

2

There are 2 answers

0
Marco Casallas On BEST ANSWER

This is not a solution but I noticed and somewhere in the bug email (it seems this was present before) list over eclipse there is a comment mentioning that if you disable "show logical structure" (icon at the left of collapse all) it will let you see the contents of the object, I don't know what "logical structure" does but it worked for me to at least get a view of what was inside my variables image here since i don't have high rep

0
Maurilio Barbosa On

I was having the same problem, but I managed to get it working like before with the logical structure. Try pressing the "three dots" icon View menu right of the "show logical structure" icon on the Variables view, go to Java > Java preferences, then select Logical Structures, add a new type and fill:

  • Qualified type: Browse for java.util.ArrayList in the jdk or jre that you project is using and select it.
  • Description: Write any description for it.
  • Applies to subtypes: should be marked.
  • Structure type: single value.
  • Code: return toArray();

Apply and close, it should be working now, at least for ArrayList objects, but I suspect that the same can be done to other List Objects and Maps.

My eclipse is version is 2024-03 (4.31.0) and my jdk is version 21.

This window can also be found in window > Preferences > Java > Debug > Logical Structures.