test/tools/javac/BranchToFewerDefines.java

changeset 3852
f02d967ddce2
equal deleted inserted replaced
3851:4b5336d558e8 3852:f02d967ddce2
1 /*
2 * Copyright (c) 2014, 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 /*
25 * @test
26 * @bug 8067429
27 * @summary java.lang.VerifyError: Inconsistent stackmap frames at branch target
28 * @author srikanth
29 *
30 * @compile BranchToFewerDefines.java
31 * @run main BranchToFewerDefines
32 */
33
34 public class BranchToFewerDefines {
35 public static void main(String[] args) {
36 }
37 private void problematicMethod(int p) {
38 switch (p) {
39 case 3:
40 long n;
41 while (true) {
42 if (false) {
43 break;
44 }
45 }
46 break;
47 case 2:
48 loop: while (true) {
49 while (true) {
50 int i = 4;
51 if (p != 16) {
52 return;
53 }
54 break loop;
55 }
56 }
57 break;
58 default:
59 while (true) {
60 if (false) {
61 break;
62 }
63 }
64 break;
65 }
66 long b;
67 if (p != 7) {
68 switch (p) {
69 case 1:
70 long a = 17;
71 break;
72 case 2:
73 break;
74 default:
75 break;
76 }
77 }
78 }
79 private void problematicMethod2(int p) {
80 switch (p) {
81 case 3:
82 long n;
83 {
84 int i = 4;
85 break;
86 }
87 case 2:
88 {
89 int i = 4;
90 break;
91 }
92 default:
93 {
94 int i = 4;
95 break;
96 }
97 }
98 long b;
99 if (p != 7) {
100 switch (p) {
101 case 1:
102 long a = 17;
103 break;
104 case 2:
105 break;
106 default:
107 break;
108 }
109 }
110 }
111 }

mercurial