Community
Participate
Working Groups
For this field declaration: protected final PropertyConverter m_converterForBoolean = new PropertyConverterForBoolean(); The formatter eliminated the existing line wrapping and put the entire declaration on one line which extends way past the 80 character margin. I did not see anything in the profile under "Line Wrapping" that controls wrapping of field declarations. All indentation properties were set to "Indent by one".
I have the same problem with various types of statements. Here's an example that Eclipse will not wrap (i.e. it puts everything on one line) regardless of my settings (even using the Java Conventions and Eclipse 2.1 built-in profiles): if (!((reqPkt instanceof RdWrSizedPacket && ((RdWrSizedPacket) reqPkt).compat == Bit.ONE) || (reqPkt instanceof AtomicRMWPacket && ((AtomicRMWPacket) reqPkt).compat == Bit.ONE))) { } In my particular file, this line is also indented 24 spaces, making the total line length 202. It should wrap at 80. This bug is similar to bug 90238. I'm running M6 (I20050401-1645).
I have the same problem with very long boolean expressions, that are not a condition of an if statement. For example, here is how the following expression is wrapped: boolean state = ((setting != null) || radio1.isSelected() || (radio2.isSelected() && ((textField.getText() != null) && (textField.getText().trim().length() > 0))) || radio3.isSelected() && (check31. isSelected() || check32.isSelected() || check33.isSelected()))); my line-length setting is 80 symbols and the third line in this expression is 163 symbols long, after applying formatting. My formatting settings are all "Wrap only when necessary", except for the one for qualified invocations, which is "Do not wrap". As a suggestion, I would expect the wrapping, especially the boolean expressions one, to be recursive, with the following logic: if we look at the boolean expression as a tree, and if it needs to be wrapped, first all nodes from the first level are wrapped. Then If some lines still exceed the defined maximum line length, then only they are wrapped, where again all nodes are wrapped, no matter if wrapping only some of them will decrease the line length enough. For example: if this is the boolean expression, where OP is a certain boolean operator (a OP b OP c) OP ((d1 OP d2 OP d3) OP e OP f) OP (g OP h OP I) the first wrap will be on all nodes from the first level: (a OP b OP c) OP ((d1 OP d2 OP d3) OP e OP f) OP (g OP h OP I) Then when one of the lines exceeds again the defined length, all of its nodes on one level are wrapped, no matter if wrapping only one will shorten the line enough. (a OP b OP c) OP ( (d1 OP d2 OP d3) OP e OP f) OP (g OP h OP I) and so on in a recursive manner (a OP b OP c) OP ( ( d1 OP d2 OP d3) OP e OP f) OP (g OP h OP I) -------- ( a OP b OP c) OP ( ( d1 OP d2 OP d3) OP e OP f) OP (g OP h OP I) Perhaps there should be an option to wrap long expressions directly by breaking the line, when the line length is exceeded, without additional indentation, instead of using the above logic. Eclipse: M6 Version: 3.1.0 Build id: I20050401-1645 java version "1.4.2_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03) Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)
Ownership has changed for the formatter, but I surely will not have enough time to fix your bug during the 3.5 development process, hence set its priority to P5. Please provide a patch if you definitely need the bug to be fixed in this version and I'll have a look at it... TIA
This problem no longer occurs after the formatter redesign. *** This bug has been marked as a duplicate of bug 303519 ***