< prev index next >
test/hotspot/jtreg/runtime/Nestmates/privateConstructors/TestReflection.java
Print this page
@@ -25,12 +25,19 @@
* @test
* @bug 8046171
* @summary Test access to private constructors between nestmates and nest-top
* using different flavours of named nested types using core reflection
* @run main TestReflection
+ * @run main/othervm -Dsun.reflect.noInflation=true TestReflection
*/
+// The first run will use NativeConstructorAccessor and due to the limited
+// number of calls we will not reach the inflation threshold.
+// The second run disables inflation so we will use the
+// GeneratedConstructorAccessor instead.
+// In this way both sets of Reflection classes are tested.
+
public class TestReflection {
// All constructors are private to ensure nestmate access checks apply
// All doConstruct methods are public so they don't involve invoke_special
@@ -42,11 +49,10 @@
// Note: No constructor on interfaces so no StaticIface variants
static interface StaticIface {
// Methods that will access private constructors of nestmates.
- // The arg is a dummy for overloading purposes
default void doConstruct(TestReflection o) throws Throwable {
Object obj = o.getClass().getDeclaredConstructor(new Class<?>[0]).newInstance(new Object[0]);
}
default void doConstruct(TestReflection tr, InnerNested o) throws Throwable {
< prev index next >