6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
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 /*
25 * @test
26 * @summary Test that JVM_DoPrivilege throws java.lang.InternalError for an
27 * abstract run() method.
28 * @bug 8183962
29 * @compile DoPrivRunAbstract.jasm
30 * @compile DoPrivRunAbstract$VoidPrivActRunAbstract.jasm
31 * @run main DoPrivRunAbstract
32 */
33
34
35 // This jasm file was generated from Java code similar to the following, except
36 // the VoidPrivActRunAbstract interface was removed and changed. It's now in
37 // file DoPrivRunAbstract$VoidPrivActRunAbstract.jasm.
38 //
39 // public class DoPrivRunAbstract {
40 //
41 // interface VoidPrivActRunAbstract extends PrivilegedAction<Void> {
42 // void perform();
43 //
44 // @Override
45 // default Void run() {
46 // perform();
47 // return null;
48 // }
49 // }
50 //
51 //
52 // static void doPrivileged(VoidPrivActRunAbstract act) {
53 // AccessController.doPrivileged(act);
54 // }
55 //
56 // public static void main(String[] args) throws Exception {
57 // try {
58 // doPrivileged(() -> System.out.println(System.getProperty("java.home")));
59 // throw new RuntimeException("Expected InternalError not throw");
60 // } catch (java.lang.InternalError e) { }
61 // }
62 //}
63
64 super public class DoPrivRunAbstract version 51:0 {
65
66 public Method "<init>":"()V" stack 1 locals 1 {
67 aload_0;
68 invokespecial Method java/lang/Object."<init>":"()V";
69 return;
70 }
71
72 static Method doPrivileged:"(LDoPrivRunAbstract$VoidPrivActRunAbstract;)V" stack 1 locals 1 {
73 aload_0;
74 invokestatic Method java/security/AccessController.doPrivileged:"(Ljava/security/PrivilegedAction;)Ljava/lang/Object;";
75 pop;
76 return;
77 }
78
79 public static Method main:"([Ljava/lang/String;)V" throws java/lang/Exception stack 3 locals 2 {
80 try t0;
81 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";
82 invokestatic Method doPrivileged:"(LDoPrivRunAbstract$VoidPrivActRunAbstract;)V";
83 new class java/lang/RuntimeException;
84 dup;
85 ldc String "Expected InternalError not throw";
86 invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
87 athrow;
88 endtry t0;
89 catch t0 java/lang/InternalError;
90 stack_frame_type stack1;
91 stack_map class java/lang/InternalError;
92 astore_1;
93 return;
94 }
95
96 private static synthetic Method lambda$main$0:"()V" stack 2 locals 0 {
97 getstatic Field java/lang/System.out:"Ljava/io/PrintStream;";
98 ldc String "java.home";
99 invokestatic Method java/lang/System.getProperty:"(Ljava/lang/String;)Ljava/lang/String;";
100 invokevirtual Method java/io/PrintStream.println:"(Ljava/lang/String;)V";
101 return;
102 }
103
104 } // end Class DoPrivRunAbstract
|
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
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 /*
25 * @test
26 * @summary Test that AccessController.doPrivileged throws java.lang.AbstractMethodError for an
27 * abstract run() method.
28 * @bug 8183962
29 * @compile DoPrivRunAbstract.jasm
30 * @compile DoPrivRunAbstract$VoidPrivActRunAbstract.jasm
31 * @run main DoPrivRunAbstract
32 */
33
34
35 // This jasm file was generated from Java code similar to the following, except
36 // the VoidPrivActRunAbstract interface was removed and changed. It's now in
37 // file DoPrivRunAbstract$VoidPrivActRunAbstract.jasm.
38 //
39 // public class DoPrivRunAbstract {
40 //
41 // interface VoidPrivActRunAbstract extends PrivilegedAction<Void> {
42 // void perform();
43 //
44 // @Override
45 // default Void run() {
46 // perform();
47 // return null;
48 // }
49 // }
50 //
51 //
52 // static void doPrivileged(VoidPrivActRunAbstract act) {
53 // AccessController.doPrivileged(act);
54 // }
55 //
56 // public static void main(String[] args) throws Exception {
57 // try {
58 // doPrivileged(() -> System.out.println(System.getProperty("java.home")));
59 // throw new RuntimeException("Expected AbstractMethodError not throw");
60 // } catch (java.lang.AbstractMethodError e) { }
61 // }
62 //}
63
64 super public class DoPrivRunAbstract version 51:0 {
65
66 public Method "<init>":"()V" stack 1 locals 1 {
67 aload_0;
68 invokespecial Method java/lang/Object."<init>":"()V";
69 return;
70 }
71
72 static Method doPrivileged:"(LDoPrivRunAbstract$VoidPrivActRunAbstract;)V" stack 1 locals 1 {
73 aload_0;
74 invokestatic Method java/security/AccessController.doPrivileged:"(Ljava/security/PrivilegedAction;)Ljava/lang/Object;";
75 pop;
76 return;
77 }
78
79 public static Method main:"([Ljava/lang/String;)V" throws java/lang/Exception stack 3 locals 2 {
80 try t0;
81 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";
82 invokestatic Method doPrivileged:"(LDoPrivRunAbstract$VoidPrivActRunAbstract;)V";
83 new class java/lang/RuntimeException;
84 dup;
85 ldc String "Expected AbstractMethodError not throw";
86 invokespecial Method java/lang/RuntimeException."<init>":"(Ljava/lang/String;)V";
87 athrow;
88 endtry t0;
89 catch t0 java/lang/AbstractMethodError;
90 stack_frame_type stack1;
91 stack_map class java/lang/AbstractMethodError;
92 astore_1;
93 return;
94 }
95
96 private static synthetic Method lambda$main$0:"()V" stack 2 locals 0 {
97 getstatic Field java/lang/System.out:"Ljava/io/PrintStream;";
98 ldc String "java.home";
99 invokestatic Method java/lang/System.getProperty:"(Ljava/lang/String;)Ljava/lang/String;";
100 invokevirtual Method java/io/PrintStream.println:"(Ljava/lang/String;)V";
101 return;
102 }
103
104 } // end Class DoPrivRunAbstract
|