Menu

#41 Incorrect switch statement parsing

closed-fixed
5
2004-01-18
2004-01-14
No

The following generates a "statement unreachable" error.
Compiles ok under javac

class Test {
public void hello() {

int a = 1;

label_1:
while (true) {
switch (a) {
case 1:
break;
default:
break label_1;
}
}

System.out.println("hello");
}
}

Discussion

  • Arno Unkrig

    Arno Unkrig - 2004-01-18
    • status: open --> closed-fixed
     
  • Arno Unkrig

    Arno Unkrig - 2004-01-18

    Logged In: YES
    user_id=865893

    The logic for checking labeled BREAK vs. labeled Statement
    was wrong... the "break label" statement always breaks the
    innermost breakable statement.

    Fixed in 1.0.15.

     

Log in to post a comment.

MongoDB Logo MongoDB