Community
Participate
Working Groups
Created attachment 117148 [details] Export of the Eclipse "formatter" configuration. Build ID: M20080911-1700 Steps To Reproduce: My code is configured to auto format on save (will attach the formatting XML). The following line should wrap "indent by one" "only when necessary" according to my settings, which if I understand right will make it wrap to column 4 if the "private" starts on column 0. private static final String m_rLnF = "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"; It doesn't, and wraps with the literal string to a location starting in column 41, which I think is a bug. I could be misunderstanding the tool, in which case, my apologies ;) More information: Half the point of making it wrap is to avoid overspilling the "maximum of 80 chars" line limitation in our coding standard, there seems no way to make it wrap earlier in the line than the '=' which means that long declarations given Java's verbose "private static final <type>" semantics often overflow 80 characters.
Just a note that I have rechecked and none of the existing autoformatter options let you shift the value of the declaration back before the '='. My workaround currently is to break up long string literals using "a" + "b" syntax and split the sub-components over multiple lines. For long numbers I don't have a good solution other than deleting the less functional specifiers like "private" and "final". (I can't commit to our SVN with any line over 80 characters, a commit hook rejects the file, and my boss insists we use the autoformatter =P) If this isn't a defect, can this get converted to an enhancement request to allow a new ["wrap when necessary", "indent by one"] option which means align the code to one column indented from the start of the type specifier list. Cheers, P
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.
The problem was related to the "align fields in columns" setting. It no longer occurs after the formatter redesign (probably). *** This bug has been marked as a duplicate of bug 303519 ***
Verified for Eclipse 4.13 M1 with Build id: I20190709-1800