test/hotspot/jtreg/compiler/unsafe/UnsafeGetConstantField.java
changeset 52015 821bfc24d750
parent 51016 a926b7737d3b
child 52220 9c260a6b6471
--- a/test/hotspot/jtreg/compiler/unsafe/UnsafeGetConstantField.java	Thu Oct 04 16:39:07 2018 +0200
+++ b/test/hotspot/jtreg/compiler/unsafe/UnsafeGetConstantField.java	Thu Oct 04 08:45:21 2018 -0700
@@ -32,6 +32,9 @@
  *          java.base/jdk.internal.vm.annotation
  *          java.base/jdk.internal.misc
  *
+ * @library ../jsr292/patches
+ * @build java.base/java.lang.invoke.MethodHandleHelper
+ *
  * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions
  *                                 -Xbatch -XX:-TieredCompilation
  *                                 -XX:+FoldStableValues
@@ -64,6 +67,9 @@
 import jdk.test.lib.Asserts;
 import jdk.test.lib.Platform;
 
+import java.lang.invoke.MethodHandleHelper;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodHandles.Lookup;
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -393,8 +399,9 @@
         }
 
         Test generate() {
-            Class<?> c = U.defineClass(className, classFile, 0, classFile.length, THIS_CLASS.getClassLoader(), null);
             try {
+                Lookup lookup = MethodHandleHelper.IMPL_LOOKUP.in(MethodHandles.class);
+                Class<?> c = lookup.defineClass(classFile);
                 return (Test) c.newInstance();
             } catch(Exception e) {
                 throw new Error(e);