Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 520752

Summary: Cleanup, Indent after assert is wrong
Product: [Eclipse Project] JDT Reporter: Tonni Tielens <tonnitielens>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: tonnitielens
Version: 4.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
Whiteboard: stalebug

Description Tonni Tielens CLA 2017-08-09 09:01:06 EDT
In the following piece of code:

switch (foobar) {
case Foobar.ONE:
    break;
default:
    assert false;
    break;
}

Running Indent (CTLR+I) results in:

switch (foobar) {
case Foobar.ONE:
    break;
default:
    assert false;
break;
}

The last break is indented wrong.
Comment 1 Tonni Tielens CLA 2017-08-09 09:06:47 EDT
My description is not entirely true. It only appears when the assert also contains a message, as in the example below:

switch (foobar) {
case Foobar.ONE:
    break;
default:
    assert false : "Some message";
break;
}

When there is no message, or when the false keyword is wrapped in parentheses, the indentation is correct.

E.g.

switch (foobar) {
case Foobar.ONE:
    break;
default:
    assert false;
    break;
}

or

switch (foobar) {
case Foobar.ONE:
    break;
default:
    assert (false) : "Some message";
    break;
}
Comment 2 Eclipse Genie CLA 2020-02-27 18:08:24 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.