Community
Participate
Working Groups
Created attachment 248181 [details] Problem cases for an Indentation issue with the ternary operator Issue: incorrect indentation in Java after ternary operator (x ? y : z) Version of Eclipse: - Luna 4.4.1, Build id: 20140925-1800, Linux 32-bit - Build 20140925-1800 for Windows 7 shows the same behaviour - workspace with default settings Example (showing the left margin) Expected outcome: |String res = condition | ? bar() : bar(); |proof_of_pudding(); Actual outcome: |String res = condition | ? bar() : bar(); | proof_of_pudding(); // <--- incorrect Remarks - The problem appears to require two conditions: (i) the `then' branch ends with a closing parenthesis, a closing square bracket or a closing curly brace; (ii) at least one of the following three conditions holds: (ii-a) there is a line break after the assignment operator (=); (ii-b) there is a line break before the question mark; (ii-c) there is a line break after the question mark. - Attached please find a file with a number of problem cases. These should cover all combinations of newline placements where the indentation goes wrong. - Please notice the odd position of the colon if it follows a curly brace and a newline (from line 250 on in the attached file). Thank you in advance for looking at this issue. Regards, G.
*** This bug has been marked as a duplicate of bug 65463 ***