RFR: 8278123: serviceability/dcmd/vm/ClassLoaderStatsTest.java failing with java.lang.AssertionError: Should have a hidden class

Alan Bateman alanb at openjdk.java.net
Thu Apr 28 07:23:50 UTC 2022


On Thu, 28 Apr 2022 04:46:35 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> This line added by  8238358: Implementation of JEP 371: Hidden Classes which has many co-authors. Hope someone could provide an explanation during this review.
>> 
>> It might be possible that the goal was to verify that  VM.classloader_stats provide might provide info for non-reachable clasees. However it makes test to fragile, since can't block class unloading now.
>
> Yes, that seems to be the case, and you are right that it is not something that is safe to assume.

Lookup.defineHiddenClass allows class options to be specified, one of which is "STRONG" to mean that the hidden class can't unloaded if its defining loader is reachable.

A static reference or a reachability fence should work for this test.

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

PR: https://git.openjdk.java.net/jdk/pull/8438


More information about the serviceability-dev mailing list