This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 23508 - Indentation of x ? y : z
Summary: Indentation of x ? y : z
Alias: None
Product: editor
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 3.x
Hardware: PC Windows 3.1/NT
: P3 blocker with 1 vote (vote)
Assignee: issues@editor
: 30346 35337 41567 (view as bug list)
Depends on:
Reported: 2002-05-15 11:54 UTC by ats37
Modified: 2007-11-05 13:39 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description ats37 2002-05-15 11:54:17 UTC
I have some expressions using the ternary conditional 
operator x ? y : z  If the expression is all on one line, 
the indentation formatter leaves it alone (as expected).  
However if, because of the expression lengths, I have to 
split it over multiple lines e.g.
something = (someComplicatedExpression != null) ?
        (aComplexCalculation) :
the indenter makes a real mess of reformatting it, moving 
the second line back to the same level as "something" and  
indenting everything following it in the code block by an 
extra tab space.  I guess this could be because it thinks 
the second line is a case label?
Comment 1 Miloslav Metelka 2002-05-17 09:51:54 UTC
Yes, the problem is that the indentation engine treats it as the case
label. Although the long term solution will be to base the indentation
engine on an incremental parser we need to find short term solution
for this problem.
Comment 2 Marek Grummich 2002-07-22 09:47:48 UTC
Set target milestone to TBD
Comment 3 Marek Grummich 2002-07-22 09:51:09 UTC
Set target milestone to TBD
Comment 4 Martin Roskanin 2003-03-10 10:28:17 UTC
*** Issue 30346 has been marked as a duplicate of this issue. ***
Comment 5 Martin Roskanin 2003-08-08 14:09:41 UTC
*** Issue 35337 has been marked as a duplicate of this issue. ***
Comment 6 _ gtzabari 2003-12-30 02:32:57 UTC
Any progress on this issue? Indentation is also incorrect for 'assert'.
Comment 7 Martin Roskanin 2004-08-20 16:33:30 UTC
*** Issue 41567 has been marked as a duplicate of this issue. ***
Comment 8 Dusan Balek 2004-08-30 08:35:06 UTC
Fixed in [maintrunk].

Checking in;
new revision: 1.31; previous revision: 1.30
Comment 9 Roman Strobl 2004-12-23 15:51:47 UTC
Verified in build 200412221900.