On Thu, 28 Apr 2022 00:44:18 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:
>> The test failed if GC happens somewhere between >> Class<?> c = Class.forName("TestClass", true, dummyloader); >> and >> OutputAnalyzer output = executor.execute("VM.classloader_stats"); >> >> The fix is to make hc static as Chris proposed. >> >> To verfiy fix I add System.gc() before >> executor.execute("VM.classloader_stats"); > > test/hotspot/jtreg/serviceability/dcmd/vm/ClassLoaderStatsTest.java line 178: > >> 176: static { >> 177: try { >> 178: // Create a hidden class, keep reference in the case if GC >> happens > > "Create a hidden class. Keep a reference in case a GC happens." > > I hadn't noticed the original comment when first suggesting making the Class > reference static. I wonder what was meant by "non-strong class". 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. ------------- PR: https://git.openjdk.java.net/jdk/pull/8438