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 103827 - Formatting: operators at beginning of line, wrapping option
Summary: Formatting: operators at beginning of line, wrapping option
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.1
Hardware: All All
: P3 blocker with 1 vote (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-12 02:08 UTC by err
Modified: 2016-03-10 16:02 UTC (History)
3 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description err 2007-05-12 02:08:49 UTC
When formatting decides to wrap a line as defined in "Options > JavaCode >
Formatting > Wrapping" I would like the operator to always appear at the
beginning of the line. I like to look at the start of the line and know what it
is about. So for example, there would be

    while(this.number < 2
          && number != 3) this.number++;

    assert a < b || p == null
         : "message";

    method1()
          .method2()
          .method3();

(BTW, thanks and appreciatioin for the new formatting)
Comment 1 err 2007-05-12 03:32:35 UTC
I forgot one of them that bugs me the most.

    "this is a"
    + "string that"
    + "spans many"
    + "lines"

So when I'm in the middle of a String and enter a <RETURN> I'd like the "+" to
be on the beginning of the next line, not at the end of the previous line.
Comment 2 err 2013-11-11 18:42:49 UTC
This enhancement has mostly been implemented by additions to
    Options>Editor>formatting>java>wrapping
such as "wrap after . in ..." and "wrap after binary ..."

I had envisioned a global such as "wrap after operator", but this works OK.


The "wrap after binary operator" does not affect the formatting of the "disjunctive catch types". Shouldn't it? Should there be a separate checkbox for that option?
Comment 3 err 2013-11-11 18:54:15 UTC
Dusan,

Would it be better if I closed this and filed a separate issue about the "disjunctive catch types"?
Comment 4 aosamai 2016-03-10 15:59:36 UTC
Hi guys, we r facing the same issue for making sure that logical operators in disjunctive catch types always appear in new line.

So the required format is like so

try {
     //some code
} catch (ParseErrorException 
         | MethodInvocationException 
         | ResourceNotFoundException exception) {
    //some code
}
Comment 5 aosamai 2016-03-10 16:02:50 UTC
This is a common use case now while implementing google PMD checkstyle rules in a java project