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

Chris Plummer cjplummer at openjdk.java.net
Thu Apr 28 00:47:41 UTC 2022


On Wed, 27 Apr 2022 23:49:56 GMT, Leonid Mesnik <lmesnik at 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".

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

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


More information about the serviceability-dev mailing list