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 151154 - Formatter does not support Sun code conventions
Summary: Formatter does not support Sun code conventions
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 2 votes (vote)
Assignee: Dusan Balek
URL:
Keywords:
: 153536 155190 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-10-23 14:54 UTC by swpalmer
Modified: 2009-11-30 13:25 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description swpalmer 2008-10-23 14:54:58 UTC
Sun's published code conventions specify source formatting that is not supported by the built-in formatter.

http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html

In particular the "wrapping" section http://java.sun.com/docs/codeconv/html/CodeConventions.doc3.html#248 clearly 
specifies that lines should break BEFORE and operator (for good reason), yet the built-in formatter breaks lines after 
operators.

E.g. Sun code conventions would break a line like this:
longName1 = longName2 * (longName3 + longName4 - longName5)
           + 4 * longname6;

But the NetBeans formatter would break the same line like this:
longName1 = longName2 * (longName3 + longName4 - longName5) +
           4 * longname6;

Since the operator is left dangling at the en of the line, where it still may need horizontal scrolling to become 
visible, it is less clear how the continuation line relates to the previous line.  Coding preferences aside, the 
published conventions should be supported.
Comment 1 Dusan Balek 2008-11-28 14:50:07 UTC
*** Issue 153536 has been marked as a duplicate of this issue. ***
Comment 2 Petr Dvorak 2008-12-10 22:42:34 UTC
*** Issue 155190 has been marked as a duplicate of this issue. ***
Comment 3 serb 2009-05-06 15:40:47 UTC
This CR will be fixed in 6.7 or not?
Comment 4 Dusan Balek 2009-07-30 14:40:10 UTC
Fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/ba0c10e2adc1
Comment 5 Quality Engineering 2009-07-31 05:58:03 UTC
Integrated into 'main-golden', will be available in build *200907310201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/ba0c10e2adc1
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #151154: Formatter does not support Sun code conventions - fixed.
Comment 6 _ gtzabari 2009-10-13 22:16:21 UTC
Is this new behavior configurable or is it hard-coded?
Comment 7 Dusan Balek 2009-10-14 08:50:33 UTC
Currently, the behavior is hard-coded, however, you could file a RFE for it.
Comment 8 misterm 2009-11-30 13:25:57 UTC
RFE filed: bug # 177873