The test was sometimes failing with ClassNotLoadedException of java.time.LocalDateTime. VirtualMachine.visibleClasses() returns all visible classes, even if not yet prepared. However, if one of those classes is an array type and ArrayType.componentType() is called on it, it may not find the component type if it is not already prepared. Callers of ArrayType.componentType() need to properly handle the thrown ClassNotLoadedException in this case.
The test now produces the following output instead of failing: [21:27:16.65] debugger > Getting visibleClasses list. [21:27:16.69] debugger > Searching for debuggee's ReferenceType in the list... [21:27:16.85] debugger > ClassNotLoadedException while getting componentType() of array class java.time.LocalDateTime[] (no class loader) [21:27:16.112] debugger > visibleclasses002a ClassType is found in visibleClasses() list of ClassLoaderReference mirror. [21:27:16.114] debugger > visibleclasses002a[] ArrayType is found in visibleClasses() list of ClassLoaderReference mirror. [21:27:16.119] debugger > visibleclasses002a[][] ArrayType is found in visibleClasses() list of ClassLoaderReference mirror. Tested in Valhalla with --enable-preview and usagetracker, which is where this commonly shows up. Also tested by modifying the debuggee to create the situation where LocalDateTime is loaded but not prepared (see diff in the CR). Ran tier2 and tier5 svc tests. --------- - [x] I confirm that I make this contribution in accordance with the [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). ------------- Commit messages: - handle ClassNotLoadedException properly Changes: https://git.openjdk.org/jdk/pull/30687/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=30687&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8381385 Stats: 4 lines in 1 file changed: 2 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/30687.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/30687/head:pull/30687 PR: https://git.openjdk.org/jdk/pull/30687
