Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 345851

Summary: Java formatter needs additional operator and separator wrapping options.
Product: [Eclipse Project] JDT Reporter: Curtis Smith <curtis.allen.smith>
Component: CoreAssignee: Mateusz Matela <mateusz.matela>
Status: VERIFIED WORKSFORME QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, jarthana, markus.kell.r, mateusz.matela
Version: 3.6.1   
Target Milestone: 4.10 M3   
Hardware: All   
OS: All   
Whiteboard:

Description Curtis Smith CLA 2011-05-15 11:38:25 EDT
The Eclipse Java formatter needs the following additional features:

wrap AFTER ternary operator
wrap AFTER dot separator
wrap AFTER String concatenation operator '+' during String wrapping.

This feature was provided for binary operators recently but should have been provided for all operators and separators on which the wrapping logic is performed.  In addition the String wrapping logic not only wraps before the '+' operator but also after it.  Therefore everything is double-spaced.  This is incorrect behavior as can be seen in the following example:

String string =
    "This "
    +
    "is "
    +
    "a "
    +
    "test.";

Should be...

String string =
    "This " +
    "is " +
    "a " +
    "test.";
    
-- Configuration Details --
Product: Eclipse 1.3.1.20100913-1228 (org.eclipse.epp.package.java.product)
Installed Features:
 org.eclipse.jdt 3.6.1.r361_v20100714-0800-7z8XFUSFLFlmgLc5z-Bvrt8-HVkH
Comment 1 Curtis Smith CLA 2011-05-21 16:48:15 EDT
One additional feature should be added:

wrap AFTER method modifiers

For example:

public static final synchronized void main( String... args )
{
}

would be formatted as:

public static final synchronized
void main( String... args )
{
}

This allows the modifiers to be placed on a separate line so that method signatures are always left aligned making signatures easier to read, changes to modifiers easier to see in a diff, and provides more room for method arguments on the signature line.
Comment 2 Mateusz Matela CLA 2018-11-11 17:30:41 EST
Closing - don't know when this was fixed, but all the requested behavior is currently available, except for wrapping after the dot separator, which is quite an eccentric idea and can be discussed in a new bug if still demanded.
Comment 3 Jay Arthanareeswaran CLA 2018-11-22 03:48:20 EST
Verified for 4.10 M3 with build id I20181121-1800