--- old/test/hotspot/jtreg/serviceability/dcmd/vm/ShowReflectionTargetTest.java 2018-06-14 13:19:26.677666705 +0200 +++ new/test/hotspot/jtreg/serviceability/dcmd/vm/ShowReflectionTargetTest.java 2018-06-14 13:19:26.573665813 +0200 @@ -37,7 +37,7 @@ * @summary Test that various diagnostic commands which can show core reflection * invocation targets do so correctly (See: JDK-8203343). * @library /test/lib - * @run testng ShowReflectionTargetTest + * @run testng/othervm -Dsun.reflect.noInflation=true ShowReflectionTargetTest * @author stuefe */ @@ -51,16 +51,15 @@ } public void run(CommandExecutor executor) throws Exception { - // Do some reflection, enough times to hit the sun.reflect.inflationThreshold and force - // generation of reflection accessor classes. + // Do some reflection; since we set -Dsun.reflect.noInflation=true, this should + // immediately generate Generated{Method|Constructor}Accessor objects. Class c = Class.forName("ShowReflectionTargetTest$Dummy"); Constructor ctor = c.getConstructor(int.class); Method m = c.getMethod("get_i"); - for (int i = 0; i < 100; i ++) { - Object o = ctor.newInstance(i); - int j = ((Integer)m.invoke(o)).intValue(); - Assert.assertEquals(j, i); - } + + Object o = ctor.newInstance(17); + int j = ((Integer)m.invoke(o)).intValue(); + Assert.assertEquals(j, 17); // Now invoke VM.class_hierarchy and check its output. // Should show reflection targets, e.g.: