1 /*
 2  * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
 3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 4  *
 5  * This code is free software; you can redistribute it and/or modify it
 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 // This class gets an initialization error in a condy invokestatic.  Need jasm so that StaticInit isn't
25 // initialized before the condy call.
26 // Test that second invocation gets same error as first.
27 
28 public class Example
29         version 55:0
30 {
31 
32 
33 static Method $jacocoInit:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;"
34         stack 1 locals 3
35 {
36                 invokestatic        Method StaticInit.get:"()Ljava/lang/Object;";
37                 areturn;
38 }
39 
40 public static Method foo:"()V"
41         stack 1 locals 2
42 {
43                 ldc        Dynamic REF_invokeStatic:Example.$jacocoInit:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;":$jacocoData:"Ljava/lang/Object;";
44                 astore_1;
45                 return;
46 }
47 
48 public static Method main:"([Ljava/lang/String;)V"
49         stack 1 locals 2
50 {
51                 try t0;
52                 invokestatic        Method Example.foo:"()V";
53                 endtry t0;
54                 goto        L7;
55                 catch t0 java/lang/Error;
56                 stack_frame_type stack1;
57                 stack_map class java/lang/Error;
58                 astore_1;
59                 aload_1;
60                 invokevirtual        Method java/lang/Error.printStackTrace:"()V";
61         L7:        stack_frame_type same;
62                 invokestatic        Method Example.foo:"()V";
63                 return;
64 }
65 } // end Class Example