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

Sat, 14 Sep 2013 19:04:47 +0100

author
vromero
date
Sat, 14 Sep 2013 19:04:47 +0100
changeset 2027
4932bb04c4b8
child 2406
372fd7283bf0
permissions
-rw-r--r--

7047734: javac, the LVT is not generated correctly in several scenarios
Reviewed-by: jjg, 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(String[] args) {
    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     }
    48 }

mercurial