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 231703 - Java source formatter does not preserve newlines
Summary: Java source formatter does not preserve newlines
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.4
Hardware: All All
: P2 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-24 10:26 UTC by aldobrucale
Modified: 2013-07-01 15:56 UTC (History)
0 users

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 aldobrucale 2013-06-24 10:26:31 UTC
In 7.4 dev builds the "Format" action does not preserve newlines when formatting long lines. For example, the line:

    private final Cache<String, ImportTransaction> transactions =
            CacheBuilder.newBuilder().expireAfterAccess(1, TimeUnit.DAYS).build();

becomes

    private final Cache<String, ImportTransaction> transactions
            = CacheBuilder.newBuilder().expireAfterAccess(1, TimeUnit.DAYS).build();

Another example:

    protected void doDelete(
            final HttpServletRequest req,
            final HttpServletResponse resp)

becomes 

    protected void doDelete(final HttpServletRequest req,
            final HttpServletResponse resp)
Comment 1 Dusan Balek 2013-06-25 11:51:51 UTC
The first example behavior is as designed - user typed newline is preserved, only '=' is moved to follow the Java Code Conventions (can be disabled via Tools -> Options -> Editor -> Formatting -> Java -> Wrapping -> Wrap After Assignment Operators).

The second example - fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/746734f7d008
Comment 2 Quality Engineering 2013-07-01 15:56:17 UTC
Integrated into 'main-silver', will be available in build *201307011244* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/746734f7d008
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #231703: Java source formatter does not preserve newlines - fixed.