Menu

#45 label not breakable error

closed-fixed
5
2004-02-03
2004-01-28
No

This compiles under javac but not janino

public void test() {
label1: {
if (1==2)
break label1;
}
}

Discussion

  • Arno Unkrig

    Arno Unkrig - 2004-02-03

    Logged In: YES
    user_id=865893

    That was a tough one...

    There is one subtle difference in the semantics of the BREAK
    and the CONTINUE statement (which are otherwise quite
    orthogonal):

    A labeled CONTINUE statement continues the _body_ statement
    of the correspnding labeled statement (that body statement
    must be continuable, i.e. it must be a FOR, DO or WHILE
    statement).

    Opposed to that, a labeled BREAK statement breaks the
    labeled statement _itself_. (The body statement of the
    labeled statement can be any type of statement in this case.)

    Fixed in 1.0.21.

     
  • Arno Unkrig

    Arno Unkrig - 2004-02-03
    • status: open --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB