This document describes the changes in the Java formatter engine of Jalopy 1.5 that may have an impact on formatting style (depending on your code convention).
The maximal line length could be exceeded for certain parameterized assignment expressions when using Standard indentation and with "Type parameter wrapping" disabled
| private final HashMap<String, String valess = new HashMap<String, String(); |
was wrongly formatted as (depending on your settings)
| private final HashMap<String, String> valess = new HashMap<String, String(); |
Now it will be printed (depending on your settings)
| private final HashMap<String, String valess = | new HashMap<String, String(); | |
for
statements without an update part could exceed the
maximal line length when using Sun brace style.
| for (Iterator i = updateKeyMap.entrySet().iterator(); i.hasNext();)|{ } |
was wrongly formatted as (depending on your settings)
| for (Iterator i = updateKeyMap.entrySet().iterator(); i.hasNext();)|{ } |
Now it will be printed (depending on your settings)
| for (Iterator i = updateKeyMap.entrySet().iterator(); | i.hasNext();) | | } |
Some dotted expressions were not wrapped even when the maximal line length was exceeded.
| return ((NativeLibrary) (ClassLoader.nativeLibraryContext.peek())) | .fromClass; |
was wrongly formatted as (depending on your settings)
| return ((NativeLibrary) (ClassLoader.nativeLibraryContext.peek())).fromClass; } |
Now it will be printed (depending on your settings)
| return ((NativeLibrary) (ClassLoader.nativeLibraryContext.peek())) | .fromClass; |
With Sun brace style enabled, for
statements could exceed the
maximal line length.
| for (Iterator iter = metadata.markerSequence.iterator(); iter.hasNext();) { ... | } |
was wrongly formatted as (depending on your settings)
| for (Iterator iter = metadata.markerSequence.iterator(); iter.hasNext();) { ... | } |
Now it will be printed (depending on your settings)
| for (Iterator iter = metadata.markerSequence.iterator(); | iter.hasNext();) { | ... | } |
Line wrapping happened too early for method calls within anonymous inner classes defined as nested method call arguments.
Thread t = new Thread(new Runnable() | { | public void run() | { | System.out.out.println(String.format("12345678901", d));| } | }); |
was wrongly formatted as (depending on your settings)
Thread t = new Thread(new Runnable() | { | public void run() | { | System.out.out.println(String.format("12345678901", | d)); | } | }); |
Now it will be printed (depending on your settings)
Thread t = new Thread(new Runnable() | { | public void run() | { | System.out.out.println(String.format("12345678901", d));| } | }); |
Infix operators were wrapped too early in some rare cases.
| if (!isInitialized || !(realType().kind().value() == TCKind._tk_ushort))| break; |
was wrongly formatted as (depending on your settings)
| if (!isInitialized || !(realType().kind().value() == | TCKind._tk_ushort)) | break; |
Now it will be printed (depending on your settings)
| if (!isInitialized || !(realType().kind().value() == TCKind._tk_ushort))| break; |
The order of Javadoc @param tags was not corrected when "Correct tag section" was enabled, but "Sort standalone tags" disabled.
/** * @param c c * @param a a * @param d d * @param b b */ public void test(int a, String b, Object c, float d) { }
was wrongly formatted as (depending on your settings)
/** * @param c c * @param a a * @param d d * @param b b */ public void test(int a, String b, Object c, float d) { }
Now it will be printed (depending on your settings)
/** * @param a a * @param b b * @param c c * @param d d */ public void test(int a, String b, Object c, float d) { }
With "Align identifiers" and/or "Align assignments" enabled, multiple variable declarations appearing at the top of case blocks could lead to wrong indentation when "Detect chunks by blank lines" was enabled and some blank lines between first and successive declarations.
switch (c) { case '#': UserInterfaceContext rContext = rElement.getContext(); ClassLoader loader = getClass().getClassLoader(); InputStream is = loader.getResourceAsStream(sText); }
was wrongly formatted as (depending on your settings)
switch (c) { case '#': UserInterfaceContext rContext = rElement.getContext(); ClassLoader loader = getClass().getClassLoader(); InputStream is = loader.getResourceAsStream(sText); }
Now it will be printed (depending on your settings)
switch (c) { case '#': UserInterfaceContext rContext = rElement.getContext(); ClassLoader loader = getClass().getClassLoader(); InputStream is = loader.getResourceAsStream(sText); }
With "Align declaration parameters" and endline indentation enabled, parameters could be wrongly aligned when the parameter type contained a type argument.
| public <T, R Collection<Abc<T, R getXyz(Xyz<T,R rXyz) |
was wrongly formatted as (depending on your settings)
| public <T, R Collection<Abc<T, R getXyz(Xyz<T, R rXyz) |
Now it will be printed (depending on your settings)
| public <T, R Collection<Abc<T, R getXyz(Xyz<T,R rXyz) |
With "Align assignments" enabled, aligment was not performed for a specific variable declaration/other statement order.
boolean variableSet = false; VMCObject object; if ((object = (VMCObject) objectMap.get(objectKey)) == null) { return false; } ObjectAlarmStateEnum alarmState = object.getAlarmState(); ObjectControlStateEnum controlState = object.getControlState(); int audioControlStateBM = object.getAudioControlStateBM(); VRObjectStateEnum vrState = object.getVRState();
was wrongly formatted as (depending on your settings)
boolean variableSet = false; VMCObject object; if ((object = (VMCObject) objectMap.get(objectKey)) == null) { return false; } ObjectAlarmStateEnum alarmState = object.getAlarmState(); ObjectControlStateEnum controlState = object.getControlState(); int audioControlStateBM = object.getAudioControlStateBM(); VRObjectStateEnum vrState = object.getVRState();
Now it will be printed (depending on your settings)
boolean variableSet = false; VMCObject object; if ((object = (VMCObject) objectMap.get(objectKey)) == null) { return false; } ObjectAlarmStateEnum alarmState = object.getAlarmState(); ObjectControlStateEnum controlState = object.getControlState(); int audioControlStateBM = object.getAudioControlStateBM(); VRObjectStateEnum vrState = object.getVRState();
With "Align assignments" and "Wrap on-demand after assignments" enabled, but "Detect chunks by line wrap" disabled, assignment expressions that exceeded the maximal line length were not aligned.
aaaaaaaa = 234; | bbbbb = "xxxxxxxxx" + "xxxxxxxxx" + "xxxxxxxxx" + "xxxxxxxxxxxxxxxxxxxx"; cccccccccccc = 345; |
was wrongly formatted as (depending on your settings)
aaaaaaaa = 234; | bbbbb = | "xxxxxxxxx" + "xxxxxxxxx" + "xxxxxxxxx" + "xxxxxxxxxxxxxxxxxxxx"; | cccccccccccc = 345; |
Now it will be printed (depending on your settings)
aaaaaaaa = 234; | bbbbb = | "xxxxxxxxx" + "xxxxxxxxx" + "xxxxxxxxx" + "xxxxxxxxxxxxxxxxxxxx"; | cccccccccccc = 345; |
With "Align assignments" enabled, assignments could be wrongly indented when followed by a method call.
sqlCmd = "insert into my_table" + " (my_user, my_password) " + " values " + " (?,?)"; stmt = con.prepareStatement(sqlCmd); stmt.setString(1, user_id);
was wrongly formatted as (depending on your settings)
sqlCmd = "insert into my_table" + " (my_user, my_password) " + " values " + " (?,?)"; stmt = con.prepareStatement(sqlCmd); stmt.setString(1, user_id);
Now it will be printed (depending on your settings)
sqlCmd = "insert into my_table" + " (my_user, my_password) " + " values " + " (?,?)"; stmt = con.prepareStatement(sqlCmd); stmt.setString(1, user_id);
With "Align assignments" enabled, but all chunk detection options disabled, assignments could be wrongly indented after a variable declaration without an assignment expression.
private int dasdasdasdasdsadasdasd = 1; private int y; private int abc; { y = 3; abc = 4; }
was wrongly formatted as (depending on your settings)
private int dasdasdasdasdsadasdasd = 1; private int y; private int abc; { y = 3; abc = 4; }
Now it will be printed (depending on your settings)
private int dasdasdasdasdsadasdasd = 1; private int y; private int abc; { y = 3; abc = 4; }
Unexpected alignment of anonymous inner class used as call parameter when both Endline indentation and "Wrap always after call arguments if nested" were enabled.
return new B(new A() { public void foo() { } }, c);
was wrongly formatted as (depending on your settings)
return new B(new A() { public void foo() { } }, c);
Now it will be printed (depending on your settings)
return new B(new A() { public void foo() { } }, c);
With "Insert expression parentheses" disabled, line breaks could be printed even though an expression would fit into the maximal line length.
if (rHandler.getLogWriter() == null || rHandler.getLogFilter() == null)| { | } |
was wrongly formatted as (depending on your settings)
if (rHandler.getLogWriter() == null || rHandler.getLogFilter() | == null) | { | } |
Now it will be printed (depending on your settings)
if (rHandler.getLogWriter() == null || rHandler.getLogFilter() == null)| { | } |
Nested annotations were missing a line break after the left paren.
@Author(@Name(first = "Joe", last = "Hacker"))
was wrongly formatted as (depending on your settings)
@Author(@Name( first = "Joe", last = "Hacker" ) )
Now it will be printed (depending on your settings)
@Author( @Name( first = "Joe", last = "Hacker" ) )
Please note that a style like in the first example is possible by disabling the " Wrap alwaysy after annotation members" option
With C brace style, a wrong line break was printed after return keywords when a creator call followed that did not fit into the line.
return new Object[] { file, new Integer(message.getLine() - 1), new Integer(message.getStartOffset() - 1) };
was wrongly formatted as (depending on your settings)
return new Object[] { file, new Integer(message.getLine() - 1), new Integer(message.getStartOffset() - 1) };
Now it will be printed (depending on your settings)
return new Object[] { file, new Integer(message.getLine() - 1), new Integer(message.getStartOffset() - 1) };
Missing line break after left curly brace of array initializers when a comment after an element caused the the elements to printed on more than one line.
String[] array = { "", "" // test };
was wrongly formatted as (depending on your settings)
String[] array = { "", "" // test };
Now it will be printed (depending on your settings)
String[] array = { "", "" // test };
With "Wrap lines " and "Wrap after operators" enabled, no line wrap was printed after operators when an unary minus expression followed.
| boolean test = index != -1; |
was wrongly formatted as (depending on your settings)
| boolean test = index != -1; |
Now it will be printed (depending on your settings)
| boolean test = index !=| -1; |
The behavior of the "Wrap on-demand type parameters" option changed slightly when using endline indent: Wrapping after the comma now only happens when both parameter names consist of several letters and/or contain bounds.
| public final class Test<A, B extends Comparable<B & Cloneable { } |
was formatted as (depending on your settings)
| public final class Test<A, | B extends Comparable<B & Cloneable { } |
Now it will be printed (depending on your settings)
| public final class Test<A, B extends Comparable<B & Cloneable { } |
With "Indent HTML tags" enabled, the first line of HTML lists entries could be wrongly wrapped (line wrapping occured though a chunk would have fit into the first line).
/******************************************************************** | * <ul | * <lixxxxx: xxx xxxx (xxxxxxx xxxxxxx) xx xxx xxxxx xxxxx xxxxxxx | * x xxxxxxxx</li | * </ul | */ |
was wrongly formatted as (depending on your settings)
/******************************************************************** | * <ul | * <lixxxxx: xxx xxxx (xxxxxxx xxxxxxx) xx xxx xxxxx xxxxx xxxxxxx | * x xxxxxxxx</li | * </ul | */ |
Now it will be printed (depending on your settings)
/******************************************************************** | * <ul | * <lixxxxx: xxx xxxx (xxxxxxx xxxxxxx) xx xxx xxxxx xxxxx xxxxxxx x | * xxxxxxxx</li | * </ul | */ |
The parameter names of Javadoc @param
tags for generic types
were not correctly printed
/** * @param <E Type of element stored in a list */ public interface List<E extends Collection<E { }
was wrongly formatted as (depending on your settings)
/** * @param <E Type of element stored in a list */ public interface List<E extends Collection<E { }
Now it will be printed (depending on your settings)
/** * @param <E Type of element stored in a list */ public interface List<E extends Collection<E { }
HTML comments were printed inline.
/** * * <!-- begin-user-doc --> You can insert your documentation for '<em><b>TestReaderBean</b></em>'. <!-- end-user-doc --> * <!-- begin-lomboz-definition --> <?xml version="1.0" encoding="UTF-8"?> <!-- end-lomboz-definition --> */
was wrongly formatted as (depending on your settings)
/** * <!-- begin-user-doc --> You can insert your documentation for ' <em><b> * TestReaderBean</b></em>'. <!-- end-user-doc --> * <!-- * begin-lomboz-definition --> <?xml version="1.0" encoding="UTF-8"?> <!-- * end-lomboz-definition --> */
Now it will be printed (depending on your settings)
/** * <!-- begin-user-doc --> * You can insert your documentation for '<em><b>TestReaderBean</b></em>'. * <!-- end-user-doc --> * <!-- begin-lomboz-definition --> * <?xml version="1.0" encoding="UTF-8"?> * <!-- end-lomboz-definition --> */