Nested if statements without braces are auto-indented incorrectly:
class Test {
void test(int i) {
int j = -1;
if (i > 0)
if (i > 1)
j = 3;
else
j = 5;
}
}
The "else" should align with the inner "if" following the dangling-
else rule of Java syntax.
Logged In: YES
user_id=429731
FYI-- this is a duplicate of bug 627753, "Indent: nested, braceless if's /
for's". There's already a discussion of it there, but the original efforts to
fix it didn't get anywhere. (The catch is differentiating between this and
method definitions without parsing for "if", "for", etc.)
It would probably be best to continue discussion in only one of these
reports, but I'll let the current developers decide which one.