test/tools/javac/flow/tests/TestCaseIfElse.java

Thu, 29 May 2014 15:28:01 +0100

author
vromero
date
Thu, 29 May 2014 15:28:01 +0100
changeset 2406
372fd7283bf0
parent 2027
4932bb04c4b8
child 2525
2eb010b6cb22
child 2709
dca7f60e618d
permissions
-rw-r--r--

8037937: javac: AssertionError during LVT generation, wrong variable ranges
Reviewed-by: mcimadamore

     1 /* /nodynamiccopyright/ */
     3 public class TestCaseIfElse {
     5     @AliveRange(varName="o", bytecodeStart=9, bytecodeLength=8)
     6     @AliveRange(varName="o", bytecodeStart=20, bytecodeLength=9)
     7     void m0(String[] args) {
     8         Object o;
     9         if (args[0] != null) {
    10             o = "then";
    11             o.hashCode();
    12         } else {
    13             o = "else";
    14             o.hashCode();
    15         }
    16         o = "finish";
    17     }
    19     @AliveRange(varName="o", bytecodeStart=10, bytecodeLength=8)
    20     @AliveRange(varName="o", bytecodeStart=21, bytecodeLength=9)
    21     void m1() {
    22         Object o;
    23         int i = 5;
    24         if (i == 5) {
    25             o = "then";
    26             o.hashCode();
    27         } else {
    28             o = "else";
    29             o.hashCode();
    30         }
    31         o = "finish";
    32     }
    34     @AliveRange(varName="o", bytecodeStart=10, bytecodeLength=8)
    35     @AliveRange(varName="o", bytecodeStart=21, bytecodeLength=9)
    36     void m2() {
    37         Object o;
    38         int i = 5;
    39         if (i != 5) {
    40             o = "then";
    41             o.hashCode();
    42         } else {
    43             o = "else";
    44             o.hashCode();
    45         }
    46         o = "finish";
    47     }
    49     @AliveRange(varName="o", bytecodeStart=11, bytecodeLength=3)
    50     @AliveRange(varName="o", bytecodeStart=17, bytecodeLength=2)
    51     Object m3(boolean cond1, boolean cond2) {
    52         Object o;
    53         if (cond1) {
    54             if (cond2) {
    55                 o = "then";
    56             } else {
    57                 o = "else";
    58                 return null;
    59             }
    60         }
    61         return null;
    62     }
    63 }

mercurial