This document describes the changes in the Java formatter engine of Jalopy 1.3 that may have an impact on formatting style (depending on your code convention).
With "Align Method declaration params" enabled, parameters were not always correctly aligned.
public abstract void setXY(String X, | int Y);|
was wrongly formatted as
public abstract void setXY(String X, | int Y); |
Now it will be printed (depending on your settings)
public abstract void setXY(String X, | int Y);|
With "Align variable assignments" enabled, mixed variable declarations and assignment expressions lead to wrong alignment of variable expressions.
int labelR_x = Math_min(iconR.x, textR.x); | labelR_with = Math_max(iconR.x + iconR.width, textRrr.x) - labelR_x; | labelR_y = Math_min(iconR.y, textR.y); | int labelR_width = Math_max(iconR.x + iconR.width, textRrr.x) - labelR_x; int labelR_y = Math_min(iconR.y, textR.y); | labelR_heightxx = Math_max(iconR.y + iconR.height, textR.y + textR.height); labelR_with = Math_max(iconR.x + iconR.width, textRrr.x) - labelR_x; | int labelR_x = Math_min(iconR.x, textR.x); | labelR_heightxx = Math_max(iconR.y + iconR.height, textR.y + textR.height); int lab = Math_min(iconR.x, textR.x); | int_labelR_x = Math_min(iconR.x, textR.x); | labelR_heightxx = Math_max(iconR.y + iconR.height, textR.y + textR.height);
was wrongly formatted as
int labelR_x = Math_min(iconR.x, textR.x); | labelR_with = Math_max(iconR.x + iconR.width, textRrr.x) - labelR_x;| labelR_y = Math_min(iconR.y, textR.y); | | int labelR_width = Math_max(iconR.x + iconR.width, textRrr.x) - | labelR_x; | int labelR_y = Math_min(iconR.y, textR.y); | labelR_heightxx = Math_max(iconR.y + iconR.height, | textR.y + textR.height); | labelR_with = Math_max(iconR.x + iconR.width, textRrr.x) - labelR_x;| | int labelR_x = Math_min(iconR.x, textR.x); | labelR_heightxx = Math_max(iconR.y + iconR.height, | textR.y + textR.height); | | int lab = Math_min(iconR.x, textR.x); | labelR_heightxx = Math_max(iconR.y + iconR.height, | textR.y + textR.height); |
Now it does (depending on your settings)
int labelR_x = Math_min(iconR.x, textR.x); | labelR_with = Math_max(iconR.x + iconR.width, textRrr.x) - labelR_x; | labelR_y = Math_min(iconR.y, textR.y); | | int labelR_width = Math_max(iconR.x + iconR.width, textRrr.x) - | labelR_x; | int labelR_y = Math_min(iconR.y, textR.y); | labelR_heightxx = Math_max(iconR.y + iconR.height, | textR.y + textR.height); | labelR_with = Math_max(iconR.x + iconR.width, textRrr.x) - labelR_x;| | int labelR_x = Math_min(iconR.x, textR.x); | labelR_heightxx = Math_max(iconR.y + iconR.height, | textR.y + textR.height); | | int lab = Math_min(iconR.x, textR.x); | labelR_heightxx = Math_max(iconR.y + iconR.height, | textR.y + textR.height); |
When the "Align Variable assignments" option was enabled, array type variable declarations were wrongly aligned when the array brackets were specified after the identifier.
byte theMD5DigestByteArray[] = null; char theCharacter = 'x';
was wrongly formatted as
byte[] theMD5DigestByteArray = null; char theCharacter = 'x';
Now it does (depending on your settings)
byte[] theMD5DigestByteArray = null; char theCharacter = 'x';
A spurious line break could occur after Javadoc standalone tags, when the description started with an unbreakable chunk that did not fit into the maximal line length.
/** | * TODO: Description | * | * @see de.esoco.test.ComponentFactory#create(Class, Container) */ |
was wrongly printed as
/** | * TODO: Description | * | * @see | * de.esoco.test.ComponentFactory#create(Class, * Container) | */ |
Now it does (depending on your settings)
/** | * TODO: Description | * | * @see de.esoco.test.ComponentFactory#create(Class, * Container) | */ |
A positive "Blank lines after headers" option was not correctly enforced when "Keep blank lines" was enabled and existing blank lines after the header present: the existing blank lines were added to the desired number of blank lines up to the number of blank lines to keep.
// Copyright 1998-2000, Foo, Inc. All Rights Reserved. // Confidential and Proprietary Information of Foo, Inc. // Protected by or for use under one or more of the following patents: // U.S. Patent Nos. X,XXX,XXX. Other Patents Pending. ¶ ¶ package com.foobar;
was wrongly formatted as
// Copyright 1998-2000, Foo, Inc. All Rights Reserved. // Confidential and Proprietary Information of Foo, Inc. // Protected by or for use under one or more of the following patents: // U.S. Patent Nos. X,XXX,XXX. Other Patents Pending. ¶ ¶ ¶ package com.foobar;
when two blank lines should be forced after headers and up to one blank line be kept. Now it does
// Copyright 1998-2000, Foo, Inc. All Rights Reserved. // Confidential and Proprietary Information of Foo, Inc. // Protected by or for use under one or more of the following patents: // U.S. Patent Nos. X,XXX,XXX. Other Patents Pending. ¶ ¶ package com.foobar;
With "Align variable identifiers" and "Determine chunks by blank lines" enabled, but "Determine chunks by comments" disabled, variable identifiers were wrongly aligned when originally no blank lines appeared between successive declarations, but blank lines were only inserted because of comments between the declarations.
int d; // comment float a; Object x;
was wrongly printed as
int d; // comment float a; Object x;
Now it does
int d; // comment float a; Object x;
No blank lines were printed around headers, when the "Override header" option was disabled.
// Copyright 1998-2000, Foo, Inc. All Rights Reserved. // Confidential and Proprietary Information of Foo, Inc. // Protected by or for use under one or more of the following patents: // U.S. Patent Nos. X,XXX,XXX. Other Patents Pending. package com.foobar;
was wrongly formatted as
// Copyright 1998-2000, Foo, Inc. All Rights Reserved. // Confidential and Proprietary Information of Foo, Inc. // Protected by or for use under one or more of the following patents: // U.S. Patent Nos. X,XXX,XXX. Other Patents Pending. package com.foobar;
when two blank lines should be forced before and after the header. Now it does
¶ ¶ // Copyright 1998-2000, Foo, Inc. All Rights Reserved. // Confidential and Proprietary Information of Foo, Inc. // Protected by or for use under one or more of the following patents: // U.S. Patent Nos. X,XXX,XXX. Other Patents Pending. ¶ ¶ package com.foobar;
With the "Use tabs in comments" option enabled, hard tabs could be wrongly inserted for blank spaces.
» »// class will always be referenced through it
was wrongly formatted as
» »// class will always be»referenced through it
Now it will be printed
» »// class will always be referenced through it
Nested expressions could lead to wrong wrapping and exceed the maximal line length when Sun brace style was used.
if (!(dataLineInfo.isFormatSupported(localFormats[i])))|{ ... | } |
was wrongly printed as
if (!(dataLineInfo.isFormatSupported(localFormats[i])))|{ ... | } |
Now it does (depending on your settings)
if (!(dataLineInfo.isFormatSupported( | localFormats[i])))|{ | ... | } |
Array initializers could exceed the maximal line length in a boundary case.
| public final Class[] STANDARD_INPUT_TYPE = { | ImageInputStream.class | }; |
was wrongly printed as
| public final Class[] STANDARD_INPUT_TYPE = { ImageInputStream.class }; |
Now it does (depending on your settings
| public final Class[] STANDARD_INPUT_TYPE = { | ImageInputStream.class | }; |
implements
clauses were not correctly wrapped when a fully
qualified type was used and could exceed the maximal line length.
private class SecureSet extends AbstractSet | implements java.io.Serializable { | } |
was wrongly printed as
private class SecureSet extends AbstractSet implements java.io.Serializable { } |
Now it does (depending on your settings
private class SecureSet extends AbstractSet | implements java.io.Serializable { | } |
Assigments containing an array access expression could lead to a crossing of the maximal line length.
| Component oldMC = currentSelection[currentSelection.length-1].getComponent(); |
was wrongly printed as
| Component oldMC = currentSelection[currentSelection.length - 1].getComponent(); |
Now it does (depending on your settings)
| Component oldMC = | currentSelection[currentSelection.length -1] | .getComponent(); |
Infix operators that were enclosed with parentheses could lead to a crossing of the maximal line length with Sun brace styling.
if (listeners != null && | listeners.getListenerCount(MyListener.class) > 0) { | ... | } |
was wrongly printed as
if (listeners != null && | (listeners.getListenerCount(MyListener.class) > 0)) { ... | } |
Now it does (depending on your settings)
if ((listeners != null) && | (listeners.getListenerCount(MyListener.class) > | 0)) { | ... | } |
With endline indentation enabled, the bodies of inner class declarations were wrongly indented when the inner class was the rhs expression of an assignment
private Listener frameListener = new VetoableChangeListener() { /** Tests whether it is safe to close the viewer. */ public void vetoableChange( PropertyChangeEvent event ) { ... } };
was wrongly formatted as
private Listener frameListener = new VetoableChangeListener() { /** Tests whether it is safe to close the viewer. */ public void vetoableChange( PropertyChangeEvent event ) { ... } };
Now it does (depending on your settings)
private Listener frameListener = new VetoableChangeListener() { /** Tests whether it is safe to close the viewer. */ public void vetoableChange( PropertyChangeEvent event ) { ... } };
With "Endline indent" enabled, the left curly brace of array initializers was wrongly indented after assignments when blank lines were present between the assignment and left curly brace.
private static final String[][] TEST = { { "ABC", "Test 1" }, { "DEF", "Test 2" }, };
was wrongly printed as
private static final String[][] TEST = { { "ABC", "Test 1" }, { "DEF", "Test 2" }, };
Now it does (depending on your settings)
private static final String[][] TEST = { { "ABC", "Test 1" }, { "DEF", "Test 2" }, };
Return expressions involving anonymous inner classes were wrongly indented with Endline indentation enabled.
return new TestSetup(new TestSuite(testClass)) { /** * One-time teardown. Take care that the test preferences are * deleted afterwards. */ protected void tearDown() throws Exception { super.tearDown(); } };
was wrongly formatted as
return new TestSetup(new TestSuite(testClass)) { /** * One-time teardown. Take care that the test preferences are * deleted afterwards. */ protected void tearDown() throws Exception { super.tearDown(); } };
Now it does
return new TestSetup(new TestSuite(testClass)) { /* * One-time teardown. Take care that the test preferences are * deleted afterwards. */ protected void tearDown() throws Exception { super.tearDown(); } };
/** * * @hibernate.bag inverse="true" lazy="true" * @hibernate.many-to-one class="api.hibernate.core.IItemsFolderImpl" * cascade="save-update" column="item_id" */
was wrongly printed as
/** * * @hibernate.bag inverse = "true" lazy="true" * @hibernate.many-to-one class = "api.hibernate.core.IItemsFolderImpl" * cascade="save-update" column="item_id" */
Now it does (depending on your settings)
/** * @hibernate.bag * inverse = "true" * lazy = "true" * @hibernate.many-to-one * class = "api.hibernate.core.IItemsFolderImpl" * cascade = "save-update" * column = "item_id" */