< prev index next >

test/runtime/Unsafe/PrimitiveHostClass.java

Print this page
rev 10811 : 8154028: Several hotspot tests need to be updated after 8153737 (Unsupported Module)
Reviewed-by: tbd


  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.awt.Component;
  25 import java.lang.reflect.Field;
  26 import static jdk.internal.org.objectweb.asm.Opcodes.*;
  27 import jdk.internal.org.objectweb.asm.*;
  28 import sun.misc.Unsafe;
  29 
  30 /*
  31  * @test PrimitiveHostClass
  32  * @bug 8140665
  33  * @summary Throws IllegalArgumentException if host class is a primitive class.
  34  * @library /testlibrary
  35  * @modules java.base/jdk.internal.org.objectweb.asm
  36  *          java.base/sun.misc
  37  * @compile -XDignore.symbol.file PrimitiveHostClass.java
  38  * @run main/othervm PrimitiveHostClass
  39  */
  40 
  41 public class PrimitiveHostClass {
  42 
  43     static final Unsafe U;
  44     static {
  45         try {
  46             Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
  47             theUnsafe.setAccessible(true);
  48             U = (Unsafe) theUnsafe.get(null);
  49         } catch (Exception e) {
  50             throw new AssertionError(e);
  51         }
  52     }
  53 
  54     public static void testVMAnonymousClass(Class<?> hostClass) {
  55 
  56         // choose a class name in the same package as the host class




  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.awt.Component;
  25 import java.lang.reflect.Field;
  26 import static jdk.internal.org.objectweb.asm.Opcodes.*;
  27 import jdk.internal.org.objectweb.asm.*;
  28 import sun.misc.Unsafe;
  29 
  30 /*
  31  * @test PrimitiveHostClass
  32  * @bug 8140665
  33  * @summary Throws IllegalArgumentException if host class is a primitive class.
  34  * @library /testlibrary
  35  * @modules java.base/jdk.internal.org.objectweb.asm
  36  *          java.base/jdk.internal.misc
  37  * @compile -XDignore.symbol.file PrimitiveHostClass.java
  38  * @run main/othervm PrimitiveHostClass
  39  */
  40 
  41 public class PrimitiveHostClass {
  42 
  43     static final Unsafe U;
  44     static {
  45         try {
  46             Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
  47             theUnsafe.setAccessible(true);
  48             U = (Unsafe) theUnsafe.get(null);
  49         } catch (Exception e) {
  50             throw new AssertionError(e);
  51         }
  52     }
  53 
  54     public static void testVMAnonymousClass(Class<?> hostClass) {
  55 
  56         // choose a class name in the same package as the host class


< prev index next >