On Fri, 10 Apr 2026 23:14:46 GMT, Chris Plummer <[email protected]> wrote:

> 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).

This pull request has now been integrated.

Changeset: f87bb766
Author:    Chris Plummer <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/f87bb766a79a4f33a5ac9dd3337d31368c1d5b8f
Stats:     4 lines in 1 file changed: 2 ins; 0 del; 2 mod

8381385: nsk/jdi/ClassLoaderReference/visibleClasses/visibleclasses002/ fails 
with --enable-preview and Java Usage Tracker enabled

Reviewed-by: dholmes, lmesnik

-------------

PR: https://git.openjdk.org/jdk/pull/30687

Reply via email to