Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
8291524: jdk/jfr/event/runtime/TestClassLoaderStatsEvent.java Value n…
…ot equal to 2, field='hiddenClassCount', value='0'

Reviewed-by: hseigel
  • Loading branch information
egahlin committed Aug 2, 2022
1 parent 1d16c91 commit 54c093a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 4 additions & 2 deletions test/jdk/jdk/jfr/event/runtime/TestClassLoaderStatsEvent.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -56,9 +56,11 @@ public class TestClassLoaderStatsEvent {
private final static String CLASS_LOADER_NAME = "MyDummyClassLoader";
private final static String CLASSLOADER_TYPE_NAME = "jdk.jfr.event.runtime.TestClassLoaderStatsEvent$DummyClassLoader";
public static DummyClassLoader dummyloader;
public static Class<?>[] classes;

public static void main(String[] args) throws Throwable {
createDummyClassLoader(CLASS_LOADER_NAME);
System.gc();

Recording recording = new Recording();
recording.enable(EVENT_NAME);
Expand Down Expand Up @@ -106,7 +108,7 @@ private static void createDummyClassLoader(String name) throws Throwable {

Method m = c.getDeclaredMethod("createNonFindableClasses", byte[].class);
m.setAccessible(true);
m.invoke(null, klassbuf);
classes = (Class[]) m.invoke(null, klassbuf);
}

public static class DummyClassLoader extends ClassLoader {
Expand Down
10 changes: 6 additions & 4 deletions test/jdk/jdk/jfr/event/runtime/TestClasses.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -85,10 +85,12 @@ class TestClass {
r.run();
}

public static void createNonFindableClasses(byte[] klassbuf) throws Throwable {
public static Class<?>[] createNonFindableClasses(byte[] klassbuf) throws Throwable {
// Create a hidden class and an array of hidden classes.
Lookup lookup = MethodHandles.lookup();
Class<?> clh = lookup.defineHiddenClass(klassbuf, false, NESTMATE).lookupClass();
Class<?> arrayOfHidden = Array.newInstance(clh, 10).getClass(); // HAS ISSUES?
Class<?>[] classes = new Class[2];
classes[0] = lookup.defineHiddenClass(klassbuf, false, NESTMATE).lookupClass();
classes[1] = Array.newInstance(classes[0], 10).getClass(); // HAS ISSUES?
return classes;
}
}

1 comment on commit 54c093a

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.