0

I run my tests in Spring Tool Suite 4 in debug. (On regular manual test of the code, everything works). In the code I initialize an ArrayList<>.

ArrayList<MyEntity> lst = new ArrayList<MyEntity>()

but the lst variable shows up as null and with the following error message:

Error   The method toArray() is undefined for the type Collection___    

When I try to edit the logical structure it shows:

Type: Collection(java.util.Collection) Show As: Array[contributed by org.eclipse.jdt.debug] 
Preview: return toArray();

This issue only shows up when I try to debug my tests.

1 Answers1

1

Well, I have the same issue on several machines with a lot of different Oracle and OpenJDK JVMs.

  • On the left, failure to display list elements in STS 4.2.2
  • On the right, proper display in STS 3.9.5
  • Both running on the same Windows machine and Oracle JDK 9.0.1

Screen grab of STS 4.2.2 issue and STS 3.9.5 success with JDK 9.0.1

Update

I just updated one of the failing STS4 installations to the latest version, and the problem seems to be gone. The version I received was:

  • STS 4.3.0.RELEASE - Build Id 201906200901
  • That release includes Eclipse JDT 3.18.0.v20190605-1800
Community
  • 1
  • 1
JüR
  • 26
  • 3
  • I havent implemented on my own system, because we managed to avoid problems with this bug, but according to your picture you got the idea of the bug and you found an actual solution. Thank you :) – Kristóf Horváth Jun 25 '19 at 10:54