Community
Participate
Working Groups
Build ID: I20080617-2000 Steps To Reproduce: 1. Go to Preferences > Java > Code Style > Formatter. 2. Choose "Java Conventions [built-in]". 3. Click OK. 4. Write some code that would line wrap around the assignment operator (perhaps use a very long variable name). 5. Note that the line wrapped AFTER the assignment operator and not beforehand. 6. There is no option to change this behavior. More information: The Java formatter has excellent line wrapping support with regards to operators (as documented in the Java formatting spec: http://java.sun.com/docs/codeconv/html/CodeConventions.doc3.html#248 However, for some reason, it does not handle the assignment operator in addition to all the other operators.
A code snippet showing the issue would be helpful...
Here is a sample that breaks on both normal assignment and annotations using Eclipse Java code cleanup. My settings are to wrap at column 80 and line break when necessary. The variable declaration should break after a "+" (I have it set to break after an operator). Also, manually adding a CR after the = causes the next line to begin on column 20 instead of a single 4 char indent. Sames goes for the annotation I've tried every combination of wrap and extra options possible and cannot get this to format correctly import com.wordnik.swagger.annotations.ApiResponse; import com.wordnik.swagger.annotations.ApiResponses; public class EclipseFormatTest { // no wrapping (bugzilla breaks comment) public int a23456789012345678901234567890 = 1234567890 + 1234567890 + 1234567890; // line should keep message = on 1st line @ApiResponses(value = { @ApiResponse(code = 400, message = "invalid start or count supplied") }) public void func() {} } The results should be public class EclipseFormatTest { public int a23456789012345678901234567890 = 1234567890 + 1234567890 + 1234567890; @ApiResponses(value = { @ApiResponse(code = 400, message = "invalid start or count supplied") }) public void func() {} }
This problem no longer occurs after the formatter redesign. *** This bug has been marked as a duplicate of bug 303519 ***
Verified for 4.10 M3 with build id I20181121-1800