Community
Participate
Working Groups
It would be nice when the automatic formatter is run that an option be available to specify the preferences (priorities) of where a line break should go. Ex. (if the line is too long and breaks): variable = object.method(); Now: variable = object .method(); Requested variable = object.method(); This could be done if breaking after "=" is a higher priority then after "."
There is another problem with line breaking before dots. The following example shows it best (see end of comment for code to reproduce the bug): Code before formatting: private int testvar = someObject.someMethod(args); Code after formatting: private int testvar = someObject .someMethod(args); Code before formatting: someObject.someMethod("This is a long non breakable String constant"); Code after formatting: someObject .someMethod("This is a long non breakable String constant"); This happens with long non-breakable code lines (for example String constants) and especially with setting the format option "Align fields in columns". The line breaks should be prevented. For easy reproduction insert the folling code into your class declaration and set "Align fields in columns" to enabled. Format the code fragment. The formatter will indent the code after 's' in the last line in a wrong way. private static final AppConfigurationEntry.LoginModuleControlFlag CONSTANTWITHLONGNAME = null; private String s = ""; private String testString = s.concat("This is a long non-breakable String constant that won't be broken");
*** This bug has been marked as a duplicate of 59891 ***
This issue will be considered separately from bug 59891.
These issues no longer occur after the formatter redesign. Wrapping on assignment operator is now naturally considered higher priority than inside the assigned expression. Note that wrapping on assignment is not enabled by default though. *** This bug has been marked as a duplicate of bug 303519 ***
Verified for 4.7 M2 using I20160912-2000 build