This repository was archived by the owner on Sep 19, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
test/jdk/jdk/jfr/event/runtime Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2014, 2021 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2014, 2022 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -56,9 +56,11 @@ public class TestClassLoaderStatsEvent {
56
56
private final static String CLASS_LOADER_NAME = "MyDummyClassLoader" ;
57
57
private final static String CLASSLOADER_TYPE_NAME = "jdk.jfr.event.runtime.TestClassLoaderStatsEvent$DummyClassLoader" ;
58
58
public static DummyClassLoader dummyloader ;
59
+ public static Class <?>[] classes ;
59
60
60
61
public static void main (String [] args ) throws Throwable {
61
62
createDummyClassLoader (CLASS_LOADER_NAME );
63
+ System .gc ();
62
64
63
65
Recording recording = new Recording ();
64
66
recording .enable (EVENT_NAME );
@@ -106,7 +108,7 @@ private static void createDummyClassLoader(String name) throws Throwable {
106
108
107
109
Method m = c .getDeclaredMethod ("createNonFindableClasses" , byte [].class );
108
110
m .setAccessible (true );
109
- m .invoke (null , klassbuf );
111
+ classes = ( Class []) m .invoke (null , klassbuf );
110
112
}
111
113
112
114
public static class DummyClassLoader extends ClassLoader {
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2013, 2021 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2013, 2022 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -85,10 +85,12 @@ class TestClass {
85
85
r .run ();
86
86
}
87
87
88
- public static void createNonFindableClasses (byte [] klassbuf ) throws Throwable {
88
+ public static Class <?>[] createNonFindableClasses (byte [] klassbuf ) throws Throwable {
89
89
// Create a hidden class and an array of hidden classes.
90
90
Lookup lookup = MethodHandles .lookup ();
91
- Class <?> clh = lookup .defineHiddenClass (klassbuf , false , NESTMATE ).lookupClass ();
92
- Class <?> arrayOfHidden = Array .newInstance (clh , 10 ).getClass (); // HAS ISSUES?
91
+ Class <?>[] classes = new Class [2 ];
92
+ classes [0 ] = lookup .defineHiddenClass (klassbuf , false , NESTMATE ).lookupClass ();
93
+ classes [1 ] = Array .newInstance (classes [0 ], 10 ).getClass (); // HAS ISSUES?
94
+ return classes ;
93
95
}
94
96
}
You can’t perform that action at this time.
0 commit comments