test/hotspot/jtreg/runtime/JVMDoPrivileged/DoPrivRunAbstract.jasm
changeset 47216 71c04702a3d5
parent 46660 d19370887e09
child 52431 b0af758a092c
child 56897 840ad2a9015a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/JVMDoPrivileged/DoPrivRunAbstract.jasm	Tue Sep 12 19:03:39 2017 +0200
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Test that JVM_DoPrivilege throws java.lang.InternalError for an
+ *          abstract run() method.
+ * @bug 8183962
+ * @compile DoPrivRunAbstract.jasm
+ * @compile DoPrivRunAbstract$VoidPrivActRunAbstract.jasm
+ * @run main DoPrivRunAbstract
+ */
+
+
+// This jasm file was generated from Java code similar to the following, except
+// the VoidPrivActRunAbstract interface was removed and changed.  It's now in
+// file DoPrivRunAbstract$VoidPrivActRunAbstract.jasm.
+//
+// public class DoPrivRunAbstract {
+//
+//    interface VoidPrivActRunAbstract extends PrivilegedAction<Void> {
+//        void perform();
+//
+//        @Override
+//        default Void run() {
+//            perform();
+//            return null;
+//        }
+//    }
+//
+//
+//    static void doPrivileged(VoidPrivActRunAbstract act) {
+//        AccessController.doPrivileged(act);
+//    }
+//
+//    public static void main(String[] args) throws Exception {
+//        try {
+//            doPrivileged(() -> System.out.println(System.getProperty("java.home")));
+//            throw new RuntimeException("Expected InternalError not throw");
+//        } catch (java.lang.InternalError e) { }
+//    }
+//}
+
+super public class DoPrivRunAbstract version 51:0 {
+
+    public Method "<init>":"()V" stack 1 locals 1 {
+        aload_0;
+        invokespecial    Method java/lang/Object."<init>":"()V";
+        return;
+    }
+
+    static Method doPrivileged:"(LDoPrivRunAbstract$VoidPrivActRunAbstract;)V" stack 1 locals 1 {
+        aload_0;
+        invokestatic    Method java/security/AccessController.doPrivileged:"(Ljava/security/PrivilegedAction;)Ljava/lang/Object;";
+        pop;
+        return;
+    }
+
+    public static Method main:"([Ljava/lang/String;)V" throws java/lang/Exception stack 3 locals 2 {
+        try t0;
+        invokedynamic    InvokeDynamic REF_invokeStatic:java/lang/invoke/LambdaMetafactory.metafactory:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;":perform:"()LDoPrivRunAbstract$VoidPrivActRunAbstract;" MethodType "()V", MethodHandle REF_invokeStatic:DoPrivRunAbstract.lambda$main$0:"()V", MethodType "()V";
+        invokestatic    Method doPrivileged:"(LDoPrivRunAbstract$VoidPrivActRunAbstract;)V";
+        new    class java/lang/RuntimeException;
+        dup;
+        ldc    String "Expected InternalError not throw";
+        invokespecial    Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
+        athrow;
+        endtry t0;
+        catch t0 java/lang/InternalError;
+        stack_frame_type stack1;
+        stack_map class java/lang/InternalError;
+        astore_1;
+        return;
+    }
+
+    private static synthetic Method lambda$main$0:"()V" stack 2 locals 0 {
+        getstatic    Field java/lang/System.out:"Ljava/io/PrintStream;";
+        ldc    String "java.home";
+        invokestatic    Method java/lang/System.getProperty:"(Ljava/lang/String;)Ljava/lang/String;";
+        invokevirtual    Method java/io/PrintStream.println:"(Ljava/lang/String;)V";
+        return;
+    }
+
+} // end Class DoPrivRunAbstract