1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test/tools/javac/flow/tests/TestCaseSwitch.java Sat Sep 14 19:04:47 2013 +0100 1.3 @@ -0,0 +1,73 @@ 1.4 +/* /nodynamiccopyright/ */ 1.5 + 1.6 +public class TestCaseSwitch { 1.7 + 1.8 + @AliveRange(varName="o", bytecodeStart=31, bytecodeLength=16) 1.9 + @AliveRange(varName="o", bytecodeStart=50, bytecodeLength=15) 1.10 + @AliveRange(varName="o", bytecodeStart=68, bytecodeLength=1) 1.11 + @AliveRange(varName="oo", bytecodeStart=39, bytecodeLength=26) 1.12 + @AliveRange(varName="uu", bytecodeStart=59, bytecodeLength=6) 1.13 + void m1(String[] args) { 1.14 + Object o; 1.15 + switch (args.length) { 1.16 + case 0: 1.17 + o = "0"; 1.18 + o.hashCode(); 1.19 + Object oo = "oo"; 1.20 + oo.hashCode(); 1.21 + break; 1.22 + case 1: 1.23 + o = "1"; 1.24 + o.hashCode(); 1.25 + Object uu = "uu"; 1.26 + uu.hashCode(); 1.27 + break; 1.28 + } 1.29 + o = "return"; 1.30 + } 1.31 + 1.32 + @AliveRange(varName="o", bytecodeStart=95, bytecodeLength=18) 1.33 + @AliveRange(varName="o", bytecodeStart=116, bytecodeLength=15) 1.34 + @AliveRange(varName="o", bytecodeStart=134, bytecodeLength=1) 1.35 + @AliveRange(varName="oo", bytecodeStart=104, bytecodeLength=27) 1.36 + @AliveRange(varName="uu", bytecodeStart=125, bytecodeLength=6) 1.37 + void m2(String[] args) { 1.38 + Object o; 1.39 + switch (args[0]) { 1.40 + case "string0": 1.41 + o = "0"; 1.42 + o.hashCode(); 1.43 + Object oo = "oo"; 1.44 + oo.hashCode(); 1.45 + break; 1.46 + case "string1": 1.47 + o = "1"; 1.48 + o.hashCode(); 1.49 + Object uu = "uu"; 1.50 + uu.hashCode(); 1.51 + break; 1.52 + } 1.53 + o = "return"; 1.54 + } 1.55 + 1.56 + @AliveRange(varName="o", bytecodeStart=31, bytecodeLength=8) 1.57 + @AliveRange(varName="o", bytecodeStart=42, bytecodeLength=8) 1.58 + @AliveRange(varName="o", bytecodeStart=53, bytecodeLength=9) 1.59 + void m3(String[] args) { 1.60 + Object o; 1.61 + switch (args.length) { 1.62 + case 0: 1.63 + o = "0"; 1.64 + o.hashCode(); 1.65 + break; 1.66 + case 1: 1.67 + o = "1"; 1.68 + o.hashCode(); 1.69 + break; 1.70 + default: 1.71 + o = "default"; 1.72 + o.hashCode(); 1.73 + } 1.74 + o = "finish"; 1.75 + } 1.76 +}