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

Thanks for the reviews @dholmes-ora and @lmesnik

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

PR Comment: https://git.openjdk.org/jdk/pull/30687#issuecomment-4254898427

Reply via email to