Sat, 14 Sep 2013 19:04:47 +0100
7047734: javac, the LVT is not generated correctly in several scenarios
Reviewed-by: jjg, mcimadamore
1 /* /nodynamiccopyright/ */
3 public class TestCaseSwitch {
5 @AliveRange(varName="o", bytecodeStart=31, bytecodeLength=16)
6 @AliveRange(varName="o", bytecodeStart=50, bytecodeLength=15)
7 @AliveRange(varName="o", bytecodeStart=68, bytecodeLength=1)
8 @AliveRange(varName="oo", bytecodeStart=39, bytecodeLength=26)
9 @AliveRange(varName="uu", bytecodeStart=59, bytecodeLength=6)
10 void m1(String[] args) {
11 Object o;
12 switch (args.length) {
13 case 0:
14 o = "0";
15 o.hashCode();
16 Object oo = "oo";
17 oo.hashCode();
18 break;
19 case 1:
20 o = "1";
21 o.hashCode();
22 Object uu = "uu";
23 uu.hashCode();
24 break;
25 }
26 o = "return";
27 }
29 @AliveRange(varName="o", bytecodeStart=95, bytecodeLength=18)
30 @AliveRange(varName="o", bytecodeStart=116, bytecodeLength=15)
31 @AliveRange(varName="o", bytecodeStart=134, bytecodeLength=1)
32 @AliveRange(varName="oo", bytecodeStart=104, bytecodeLength=27)
33 @AliveRange(varName="uu", bytecodeStart=125, bytecodeLength=6)
34 void m2(String[] args) {
35 Object o;
36 switch (args[0]) {
37 case "string0":
38 o = "0";
39 o.hashCode();
40 Object oo = "oo";
41 oo.hashCode();
42 break;
43 case "string1":
44 o = "1";
45 o.hashCode();
46 Object uu = "uu";
47 uu.hashCode();
48 break;
49 }
50 o = "return";
51 }
53 @AliveRange(varName="o", bytecodeStart=31, bytecodeLength=8)
54 @AliveRange(varName="o", bytecodeStart=42, bytecodeLength=8)
55 @AliveRange(varName="o", bytecodeStart=53, bytecodeLength=9)
56 void m3(String[] args) {
57 Object o;
58 switch (args.length) {
59 case 0:
60 o = "0";
61 o.hashCode();
62 break;
63 case 1:
64 o = "1";
65 o.hashCode();
66 break;
67 default:
68 o = "default";
69 o.hashCode();
70 }
71 o = "finish";
72 }
73 }