Controls when and how lines are wrapped.
Lets you control the general line wrapping options.
Lets you control the general line wrapping options.
Wrap lines
Enables or disables automatic line wrapping. When enabled, Jalopy tries to keep lines within the maximal line length and breaks statements across lines when necessary.
Please note that disabling line wrapping does not mean that existing line breaks will be kept, but rather that no efforts are taken to keep lines in between the maximal line length upon reformatting!
Line length
Lets you specify the maximal line length. Jalopy tries (more or less - depending on the used indentation scheme) to limit each line within the given length.
Lets you define the wrapping policy for operators.
Line wrapping will often occur with statements that consist of several (possibly long) expressions. Here you specify whether line wrapping should occur before or after the expression operator.
Wrap before operators
If enabled, line breaks will be inserted before operators.
Example 2.424. Wrap before operators (Standard indented)
if ((condition1 && condition2)
|| (condition3 && condition4)
|| !(condition5 && condition6)) {
doSomethingAboutIt();
}
Wrap after operators
If enabled, line breaks will be inserted after operators.
Example 2.425. Wrap after operators (Standard indented)
if ((condition1 && condition2) ||
(condition3 && condition4) ||
!(condition5 && condition6)) {
doSomethingAboutIt();
}
Please note that wrapping for the comma and dot operator is currently always performed after the operators!
If you happen to use Sun Brace styling, you might want to enable continuation indentation for blocks to let the statement body stand out. See "Block continuation indentation" for more information.
Lets you specify around which code elements line breaks should be kept.
Declaration parameters
When enabled, existing line breaks after the commas of declaration parameters are kept. Otherwise line wrapping is performed according to the current settings.
Since 1.6
Example 2.426. Nicely laid out method declaration
void test( String rName, boolean rPendandic ) { ... }
After formatting this code could look like this (because everything fits in one line):
But with the "Keep line breaks" option enabled, it may look like this:
Example 2.428. Method declaration after formatting with kept line breaks (Endline indented)
void test( String rName, boolean rPendandic ) { ... }
Call arguments
When enabled, existing line breaks after the commas of call arguments are kept. Otherwise line wrapping is performed according to the current settings.
Since 1.6
After formatting this code could look like this (because everything fits in one line):
But with the "Keep line breaks" option enabled, it may look like this:
Example 2.431. Method call after formatting with kept line breaks (Endline indented)
obj.method1( test,
test2,
test3 );
Operators
When enabled, existing line breaks before or after infix operators and the comma operator of method declaration parameters or method call arguments are kept. Otherwise line wrapping is performed according to the current settings.
Since 1.0
Example 2.432. Operators with forced line breaks
if ((condition1 && condition2)
|| (condition3 && condition4)
|| !(condition5 && condition6))
{
...
}
After formatting this code could look like this (because not everything fits in one line and not line breaks are forced):
Example 2.433. Operators after formatting (wrapping is done on-demand)
if ((condition1 && condition2) || (condition3 && condition4) ||
!(condition5 && condition6))
{
...
}
But with the "Keep line breaks" option enabled, it may look like this:
Example 2.434. Operators after formatting with kept line breaks
if ((condition1 && condition2) ||
(condition3 && condition4) ||
!(condition5 && condition6))
{
...
}
Please note that it does not matter what wrapping policy for operators you choose. Jalopy will keep line breaks even if the operators move!
String concats
When enabled, existing line breaks before or after the plus operator of concatenated string literals are kept. Otherwise line wrapping is performed according to the current settings.
Since 1.0.1
Example 2.435. Nicely laid out string constant
query = "select a.prop_text, " + " a.contest_title, " + " from contest a " + " where a.language_code = b.language_code " + " and b.bob = c.bob " + " and a.x = ? " + " order by a.bob, " + " c.language";
After formatting this code could look like this:
Example 2.436. String constant after formatting
query = "select a.prop_text, " + " a.contest_title, " + " from contest a " + " where a.language_code = b.language_code " + " and b.bob = c.bob " + " and a.x = ? " + " order by a.bob, " + " c.language";
But with the "Keep string concats" option enabled, it may look like this:
Example 2.437. String constant after formatting with "Keep line breaks" (Standard indented)
query = "select a.prop_text, " + " a.contest_title, " + " from contest a " + " where a.language_code = b.language_code " + " and b.bob = c.bob " + " and a.x = ? " + " order by a.bob, " + " c.language";
Please note that it does not matter what wrapping policy for operators you choose. Jalopy will keep line breaks even if the operators move!
Array elements
When enabled, existing line breaks after the separator comma of array elements are kept. Otherwise line wrapping is performed according to the current settings.
Since 1.5
Example 2.438. Array declarations
String[] foo = new String[] { "foo", }; String[] bar = new String[] { "bar", "car", };
Example 2.439. Array declarations after reformat
String[] foo = new String[] { "foo", }; String[] bar = new String[] { "bar", "car", };
Example 2.440. Array declarations after reformat with "Keep line breaks"
String[] foo = new String[] { "foo", }; String[] bar = new String[] { "bar", "car", };
Strictly obey "Keep line breaks"
When using endline indentation, line breaks may not always be kept because doing so would break the endline indent contract and lead to inconsistent indentation behavior. Enabling this option will cause Jalopy to keep existing line breaks even in such cases.
Please note that this option is only available when endline indentation is enabled and any of the "Keep line breaks" options selected!
Since 1.8
Take the following example:
When the option is disabled, Jalopy won't keep the line break before the first call argument because it goes against the endline indentation rules.
Example 2.442. Method call - endline indented
String firstSymbol = eraseNonBreakingSpaceFromSymbol(symbol1,
symbol2);
But if you really favor keeping the line break, enabling the option would yield:
Example 2.443. Method call - line break kept
String firstSymbol = eraseNonBreakingSpaceFromSymbol(
symbol1, symbol2);
Treat two string literals as string concatenation
This option lets you control what is considered a string concatenation. By default, Jalopy treats the plus (+) operator as a string concatenation when either one of the operands is a string literal. But you might want to narrow this behavior to only treat two string literals as a string concatenation.
Please note that this option is only available when any of the "Keep line breaks" options is selected!
Since 1.8
When this option is disabled, all operators in the example below would be considered string concatenations and therefore line breaks kept.
Example 2.444. String concatenations
String query = "select a.prop_text, " + " a.contest_title, " + " from contest a " + " where a.language_code = b.language_code "; String name = "Walther" + getNick();
When enabled, only those plus operators with two string literals on either side would retain any line breaks like in the example below.
Disable wrapping for complex expressions
For complex expressions a common technique to enhance readability is to break the expression into several subexpressions that can be stored in temporary variables that are placed on different lines.
Example 2.446. Complex expression
if (conditionOne && | ("foo".equals(aStr) || "bar".equals(aStr)) | doSomething(); |
Example 2.447. Refactored expression
boolean conditionTwo = "foo".equals(aStr); | boolean conditionThree = "bar".equals(aStr); | | if (conditionOne && | (conditionTwo || conditionThree)) | doSomething(); |
In order to determine occurences of complex expressions, enabling this option will cause automatic line wrapping to be disabled when a complex expression gets printed. A warning message will be logged in the Printer category that informs you about the location of the expression.
Since 1.5
Example 2.448. Flagged complex expression
|
if (conditionOne && (conditionTwo || conditionThree))
doSomething(); |
Avoid bare left parenthesis
With Endline indentation and "Wrap on-demand after left parenthesis" or "Keep line break for operators" enabled, line breaks after left parentheses may look ugly. If this option is enabled, such line breaks are avoided.
This option was mainly introduced to fix some unwanted behavior of earlier releases without breaking compatiblity. It is recommended to have it enabled.
Since 1.4
Contains options to control the general wrapping behavior for arrays.
Wrap as needed
Enabling this options means array elements will be wrapped so that they will be limited within the current maximal line length.
Example 2.451. Wrap as needed
String[] s = new String[] { | "first", "second", "third", "fourth",| "fifth", "sixth", "seventh", | "eighth", "ninth", "tenth", | }; |
Wrap all when exceed
Forces a line break after every array element when all elements would not fit into the current line limit.
Since 1.7
Example 2.452. All elements fit into line
String[] s = new String[] { | "first", "second", "third", "fourth", "fifth", "sixth", "seventh",| }; |
Example 2.453. Wrap all elements when line would get exceeded
String[] s = new String[] { | "first", | "second", | "third", | "fourth", | "fifth", | "sixth", | "seventh", | "eighth", | }; |
Wrap after element
Forces a new line after every n-th element.
Example 2.454. Wrap after element 1
String[] s = new String[] { | "first", | "second", | "third", | "fourth", | "fifth", | "sixth", | "seventh", | "eighth", | "ninth", | "tenth", | };
Please note that no checking is done regarding the maximal line length limit which might easily lead to lines exceeding the maximal line length when you set n to something bigger than '1'.
Example 2.455. Wrap after element 3
String[] s = new String[] { | "first", "second", "third",| "fourth", "fifth", "sixth",| "seventh", "eighth", "ninth", "tenth", | } |
If neither option is enabled, the array elements will be printed in one line, right after the left curly brace, i.e. automatic line wrapping will be disabled.
Please note that you can further customize the wrapping behavior for arrays with the following options:
Lets you choose the elements that should be wrapped always.
For certain cases, the need may arise to force line wrapping to achieve a consistent, uniform look. If you enable any of the following switches, line wrapping will occur for the specified cases no matter whether you have enabled general line wrapping or not.
Before declaration keywords
Forces a line break before the class, interface keyword, enum and @interface keywords.
Since 1.4
After "class" keyword
Forces a line break after the class keyword.
Since 1.3
Before extends keyword
Forces a line break before the extends keyword of a class/interface declaration.
Example 2.460. Class/interface extends keyword
public interface Channel extends Puttable, Takable { ... }
Example 2.461. Wrapped class/interface extends keyword (Standard indented)
public interface Channel extends Puttable, Takable { ... }
You can control the space printed before the keyword via the indentation settings. See "Extends indent size" for more information.
After extends types
Forces a line wrap after each type name of the extended classes.
Example 2.462. Class/interface extends types
public interface Channel extends Puttable, Takable { ... }
Example 2.463. Wrapped class/interface extends types (Endline indented)
public interface Channel extends Puttable, Takable { ... }
Before implements keyword
Forces a line break before the implements keyword of a class declaration.
Example 2.464. implements keyword
public class SynchronizedBoolean implements Comparable, Cloneable { ... }
Example 2.465. Wrapped implements keyword (Standard indented)
public class SynchronizedBoolean implements Comparable, Cloneable { ... }
You can control the space printed before the keyword via the indentation settings. See "Implements indent size" for more information.
After implements types
Forces a line wrap after each type name of the implemented classes.
Example 2.466. Class implements types
public class SynchronizedBoolean implements Comparable, Cloneable { ... }
Example 2.467. Wrapped class implements types (Endline indented)
public class SynchronizedBoolean implements Comparable, Cloneable { ... }
Before throws keyword
Forces a line break before the throws keyword of a method/constructor declaration.
Example 2.468. throws keyword
private File getDestinationFile(File dest, String packageName, String filename) throws IOException { ... }
Example 2.469. Wrapped throws keyword (Endline indented)
private File getDestinationFile(File dest, String packageName, String filename) throws IOException { ... }
You can control the space printed before the keyword via the indentation settings. See "Throws indent size" for more information.
After throws keyword
Forces a line break after the throws keyword.
Since 1.3
Example 2.471. Throws signature (wrapped)
public void foo() throws FooException, BarException { ... }
After throws types
Forces a line wrap after each type name of the throws clause of a method/constructor declaration.
Example 2.472. throws types
private File getDestinationFile(File dest, String packageName, String filename) throws IOException, FooException { ... }
Example 2.473. Wrapped throws types (Standard indented)
private static final File getDestinationFile(File dest, String packageName, String filename) throws IOException, FooException { ... }
Example 2.474. Wrapped throws types (Endline indented)
private File getDestinationFile(File dest, String packageName, String filename) throws IOException, FooException { ... }
Enum constants
When ennabled, forces a line break after each enum constant of an enum declaration.
Since 1.2
Example 2.476. Forced line break after enum constants
public enum Season { WINTER, SPRING, SUMMER, FALL }
Marker annotations
When enabled, a line break will be inserted after the last marker annotation, when no other Java modifiers appear before the annotation.
Since 1.1
Example 2.479. No line break after marker annotation when modifier(s) before
public @Preliminary class TimeTravel { ... }
You can ensure that marker annotations appear before other Java modifiers via the modifiers sorting settings, see Section 2.6.6.2.2, "Sort Order" for more information.
Annotation members
When enabled, a line break will be inserted after each member of a normal annotation. Additionally, line breaks will occur after the left and before the right parenthesis.
Otherwise, a line break after a member value pair only happens when the maximal line would be exceeded. Line breaks after left and before right parenthesis are only printed when all members does not fit into one line.
Since 1.5
Example 2.480. Line breaks after annotation members
@Author( @Name( first = "Joe", last = "Hacker" ) ) public class BitTwiddle { ... }
Example 2.481. No line break after members
@Author(@Name(first = "Joe", last = "Hacker")) public class BitTwiddle { ... }
Example 2.482. No line break after members
@Author( | @Name(first = "Joe", last = "Hacker", location = "Redmond") | ) | public class BitTwiddle { ... } |
Field declaration names
Forces a line wrap before the name of an instance field declaration. Please note that this option does not apply for multi-variables.
Since 1.2
Method declaration names
Forces a line wrap before the name of a method or constructor declaration.
Since 1.0.3
Example 2.486. Method declaration with line break between return type and name
public static int foo() { ... }
Declaration parameters
Forces a line break after each parameter of a method or constructor declaration.
Example 2.487. Method declaration parameters
public static File create(File file, File directory, int backupLevel) throws IOException { ... }
Example 2.488. Wrapped method declaration parameters (Endline indented)
public static File create(File file, File directory, int backupLevel) throws IOException { ... }
Call arguments
Forces a line wrap after each argument of a method call.
Example 2.489. Method call
doSomething(); _userDatabase.addUser("Name", encryptPassword("password", _secretKey), "123 fake address"); doSomethingElse();
Example 2.490. Wrapped method call (Endline indented)
doSomething(); _userDatabase.addUser("Name", encryptPassword("password", _secretKey), "123 fake address"); doSomethingElse();
Nested call arguments
Forces a line wrap after each argument of a method call if at least one argument is a method call itself. This option can prove especially useful if one prefers to nest method calls as arguments rather than adding local variables just to hold those arguments.
Example 2.491. Wrapped nested method call (Endline indented)
doSomething(); _userDatabase.addUser("Name", encryptPassword("password", _secretKey), "123 fake address"); doSomethingElse();
Chained method calls
Forces a line wrap after each chained method call.
Example 2.492. Chained method call
message.format(ERROR_SOURCE_ADDRESS).param (m_session.getAimName()).send();
Example 2.493. Wrapped chained method call (aligned)
message.format(ERROR_SOURCE_ADDRESS)
.param (m_session.getAimName())
.send();
Please note that you can control the aligment for chained method calls with the "Align chained method call" option.
Nested chained method calls
Forces a line wrap after each method call chain of nested method calls, i.e. method calls used as call arguments.
Example 2.494. Chained method call
message.format(ERROR_SOURCE_ADDRESS).param (m_session.getAimName()).send();
Example 2.495. Wrapped chained method call (aligned)
message.format(ERROR_SOURCE_ADDRESS)
.param (m_session.getAimName())
.send();
Please note that you can control the aligment for chained method calls with the "Align chained method call" option.
Since 1.6
Multi variable types
When enabled, a line break will be printed after the type identifier of the declaration.
Since 1.0
Example 2.497. Force wrap after type of multi-variables (Standard indented)
BigInteger
q = null, p = null, g = null;
Multi variable declarators
When enabled, each declaration of a multi-variable declaration gets always printed on a new line. Otherwise, wrapping only occurs when necessary.
Since 1.0
Example 2.499. Force wrap after each declarator of multi-variables (Endline indented)
BigInteger q = null, p = null, g = null;
Ternary expression question mark (?)
Forces a line wrap after the first operand.
Example 2.500. Wrapped ternary expression question mark (Endline indented)
String comma = spaceAfterComma
? COMMA_SPACE : COMMA;
Indentation for consecutive lines depends on the used indentation scheme. See Section 2.6.4.1.1, "Strategies" for more information. You may further want to use continuation indentation.
Ternary expression colon (:)
Forces a line wrap after the second operand.
Example 2.501. Wrapped ternary expression colon (Endline indented)
String comma = spaceAfterComma ? COMMA_SPACE
: COMMA;
If both switches are disabled, ternary expressions are printed in one line (if everything fits in one line, that is).
If both switches are enabled, you can force a style like the following:
Example 2.503. Wrapped ternary expressions (Standard indented)
String comma = spaceAfterComma
? COMMA_SPACE
: COMMA;
Labels
Forces a line wrap after labels.
Example 2.504. Label
// advance to the first CLASS_DEF or INTERFACE_DEF LOOP: for (AST child = tree.getFirstChild(); child != null; child = child.getNextSibling()) { switch (child.getType()) { case JavaTokenTypes.CLASS_DEF : case JavaTokenTypes.INTERFACE_DEF : next = child; break LOOP; default : break; } }
Example 2.505. Wrapped label (Standard indented)
// advance to the first CLASS_DEF or INTERFACE_DEF LOOP: for (AST child = tree.getFirstChild(); child != null; child = child.getNextSibling()) { switch (child.getType()) { case JavaTokenTypes.CLASS_DEF : case JavaTokenTypes.INTERFACE_DEF : next = child; break LOOP; default : break; } }
Registry Keys
Forces line wrapping after assignments for constants whose names ends with the "Registry" suffix.
Since 1.7
Lets you choose the elements that should be wrapped only when necessary. Either when the maximal line length would be exceeded otherwise or when related elements were already wrapped.
Lets you enable and/or control wrapping for certain elements when the maximal line length would be exceeded without wrapping.
Import declarations
Enabling this option causes import declarations to be wrapped along the dots if otherwise the maximal line length would be exceeded. If left disabled, no line wrapping will ever occur for import declarations.
Since 1.4
Example 2.508. Very long import declaration
|
import com.mycompanyname.myprojectname.mypackagename.MyClassName;
|
Example 2.509. Wrapped import declaration
|
import com.mycompanyname.myprojectname.mypackagename |
.MyClassName; |
Before extends keyword
When enabled, a line break is printed before the extends keyword of extends clauses when the whole clause does not fit into the current line.
Since 1.7
Example 2.511. Wrapped throws clause
interface Testable | extends Transferable, Recordable, Playable { | } |
Before implements keyword
When enabled, a line break is printed before the implements keyword of implements clauses when the whole clause does not fit into the current line.
Since 1.7
Example 2.512. implements clause
| class Testable implements Transferable, Recordable, Playable { } |
Example 2.513. Wrapped implements clause
class Testable | implements Transferable, Recordable, Playable { | } |
Before throws keyword
When enabled, a line break is printed before the keyword keyword of throws clauses when the whole clause does not fit into the current line.
Since 1.7
Example 2.515. Wrapped throws clause
public void performaAction() | throws InvalidStateException { | } |
Marker annotations
When enabled, a line break will be inserted after the last marker annotation, when no other Java modifiers appear before the annotation and the declaration the annotation is part of, does not fit into the current line length limit.
Since 1.7
Example 2.516. No line break after marker annotation
| @Preliminary interface Testable extends Transferable, | Recordable { | ... | } |
Example 2.517. Line break after marker annotation
@Preliminary | interface Testable extends Transferable, Recordable { | ... | } |
Please note that wrapping after the marker annotation only occurs, if other modifiers appear before the annotation!
Example 2.518. No line break after marker annotation when modifier(s) before
public @Preliminary class TimeTravel { ... }
You can ensure that marker annotations appear before other Java modifiers via the modifiers sorting settings, see Section 2.6.6.2.2, "Sort Order" for more information.
Related options:
Field declaration names
Issues a line break before the name of a field declaration when the maximal line length would be exceeded otherwise.
Since 1.7
Example 2.519. Field declaration which exceeds line length
public static final InputMethodHighlight UNSELECTED_TEXT_HIGHLIGHTS = new InputMethodHighlight(false, CONVERTED_TEXT); |
Example 2.520. Wrapped method declaration
public static final InputMethodHighlight | UNSELECTED_TEXT_HIGHLIGHTS = | new InputMethodHighlight(false, CONVERTED_TEXT); |
Method declaration names
Issues a line break before the name of a method or constructor declaration when the maximal line length would be exceeded otherwise.
Since 1.3
Example 2.521. Method declaration which exceeds line length
protected PropertyChangeListener createPropertyChangeListener() {
} |
Example 2.522. Wrapped method declaration
protected PropertyChangeListener |
createPropertyChangeListener() { |
} |
After assignments
Lets you control the way wrapping takes action for assignments. If left disabled, line wrapping preferably occurs as part of the expression printing. Otherwise wrapping will be performed right after the assignment whenever the expression cannot be printed in just one line.
Example 2.523. Prefer wrap along the expression
this.interessentenNr = new InteressentenNr( Fachschluesselerzeugung.createService() .getNeuerFachschluessel( FachschluesselerzeugungService.FACHSCHLUESSEL_KZ_INTERESSENT ) );
Example 2.524. Prefer wrap after assignment
this.interessentenNr = new InteressentenNr( Fachschluesselerzeugung.createService() .getNeuerFachschluessel( FachschluesselerzeugungService.FACHSCHLUESSEL_KZ_INTERESSENT ) );
After "return" statement
Lets you control the wrapping behavior for return statements. If enabled, a line break is inserted after the return statment when the expression would exceed the maximal line length.
Since 1.2.1
Example 2.525. return statement
return ((getKey() == null) ? (other.getKey() == null) | : getKey().equals(other.getKey())); |
Example 2.526. Prefer wrapping after return statement
return | ((getKey() == null) ? (other.getKey() == null) | : getKey().equals(other.getKey())); |
After left parenthesis
Lets you control the wrapping behavior for parameter, statement and expression lists.
If left disabled, the first line break will be preferably inserted behind the first parameter or expression and only occurs after the left parenthesis if the maximal line length would be otherwise exceeded.
Example 2.527. Wrap after left parenthesis (disabled)
appServerReferencesVector.add(new AppServerReference( "RemoteApplicationManager", poa.create_reference_with_id( "RemoteApplicationManager".getBytes(), RemoteApplicationManagerHelper.id())));
When enabled, the line break will always occur behind the left parenthesis when the list parameters, arguments or expressions cannot be printed in just one line.
Example 2.528. Wrap after left parenthesis (enabled)
appServerReferencesVector.add(
new AppServerReference(
"RemoteApplicationManager",
poa.create_reference_with_id(
"RemoteApplicationManager".getBytes(),
RemoteApplicationManagerHelper.id())));
This option affects the output style of method/constructor declarations and calls, creator calls and if-else, for, while and do-while blocks.
As per default, the wrapped lines will be indented using standard indentation, but you may want to apply another indentation scheme. See Section 2.6.4.1.1, "Strategies" for more information.
Before right parenthesis
Prints a line break before the right parenthesis of parameter or expression lists when at least one parameter/expression was wrapped. The parenthesis will be intended according to the current indentation level.
This switch affects the output style of method/constructor declarations and calls, creator calls and if-else, for, while and do-while blocks.
Example 2.529. Right parenthesis (disabled)
public void severalParameters(String one, int two, String three, StringObject four, AnotherObject five) { }
Example 2.530. Right parenthesis (enabled)
public void severalParameters(String one, int two, String three, StringObject four, AnotherObject five ) { }
Both switches combined, looks like the following example:
Example 2.531. Left and right parenthesis
appServerReferencesVector.add(
new AppServerReference(
"RemoteApplicationManager",
poa.create_reference_with_id(
"RemoteApplicationManager".getBytes(),
RemoteApplicationManagerHelper.id()
)
)
);
For blocks the output may go like this:
Example 2.532. Left and right parenthesis (wrapped)
if ( "pick".equals(m.getName()) && m.isStatic() && m.isPublic() ) { pickFound = true; } else if ( "pick".equals(m.getName()) && m.isStatic() && m.isPublic() ) { pickFound = true; }
Grouping parentheses
Lets you control the wrapping behavior for grouping parentheses. If enabled, line breaks are inserted after left and before right parentheses of grouped expressions to let the expression(s) stand out.
Example 2.533. Grouping parentheses (standard indented)
if ( !((bankverbindung instanceof ObjectValue) || (bankverbindung instanceof PrimitiveValue)) ) { throw new RuntimeException(); }
Example 2.534. Wrapped grouping parentheses (standard indented)
if ( !( (bankverbindung instanceof ObjectValue) || (bankverbindung instanceof TkPrimitiveValue) ) ) { throw new RuntimeException(); }
Type parameter
When enabled, type parameters of parameterized (generic) types are wrapped, when necessary.
Since 1.4
Example 2.535. Parameterized type that lead to exceeded maximal line length
| private final Map<Short, String> example = new HashMap<Short, String>(); |
Example 2.536. Wrapped parameterized type (endline indented)
| private final Map<Short, String> example = new HashMap<Short, | String>(); | |
Please note that with Endline indentation enabled, wrapping only happens if both type parameter names are either not single-lettered or contain one ore more bounds.
Example 2.537. Exceptions when using endline indentation
| public class Test<A, B extends Comparable<B> & Cloneable> { } |
Within call after assignment
This option lets you define where a line wrap should preferably occur for call statements after assignments that don't fit into the maximal line length.
This is option is only meant to let you adjust behavior when "Prefer wrap after assignments" has been enabled. Please see explanation there.
Since 1.7
Example 2.538. Wrapping assignment expression
nuMBeans =
NuvegaPropertiesHandler.getNNuvegaArrayProperty(
NuvegaProperties.PROPERTIES_FILE_NUVEGA_BEAN_NAME);
Example 2.539. Prefer wrapping within call
nuMBeans = NuvegaPropertiesHandler.getNNuvegaArrayProperty(
NuvegaProperties.PROPERTIES_FILE_NUVEGA_BEAN_NAME);
Within call arguments
This option lets you define where a line wrap should preferably occur for call arguments that does not fit into the maximal line length.
Normally a line gets wrapped before a call argument that don't fit into the maximal line length. Enabling this option will cause a line break inserted within the call argument for operator expressions when the operator expression is not immediately preceded with or followed by another operator expression.
Since 1.5
Example 2.540. Wrapping method call (default behavior)
failed(output, "a" + "b", null, | "Failed to open prefs: " + e.getMessage()); | |
As you can see from the above example a line break is inserted before the third argument as it would exceed the maximal line length when printed in the same line.
Example 2.541. Prefer wrapping within call argument
failed(output, "a" + "b", null, "Failed to open prefs: " | + e.getMessage()); | |
When the option is enabled, the line break happens within along the operator of the third argument.
Example 2.542. Standard wrapping when two operator expressions
failed(output, "a" + "b", | "Failed to open prefs: " + e.getMessage()); | |
But if two operator expressions follow immediately, the standard behavior applies in order to enhance readibility.
Lets you enable wrapping for all elements if the parameter or expression list or clause would otherwise exceed the maximal line length. If you enable any of the following switches, line wrapping may occur for the specified cases no matter whether you have enabled general line wrapping or not.
After "extends" types
Forces a line wrap after each type name of the extends clause of a class/interface declaration if the whole clause does not fit in one line.
Example 2.543. Extends types wrapped as needed (Standard indented)
public interface VeryImportantInterface | extends LeastImportantInterface, LessImportantInterface, | ImportantInterface { | ... | } |
Example 2.544. Extends types wrapping forced (Standard indented)
public interface VeryImportantInterface | extends LeastImportantInterface, | LessImportantInterface, | ImportantInterface { | ... | } |
After "implements" types
Forces a line wrap after each type name of the implements clause of a class/interface declaration if the whole clause does not fit in one line.
Example 2.545. Implements types wrapped as needed (Standard indented)
public class ImportantClass | implements ImportantInterface, Serializable, Comparable, | Cloneable { | ... | } |
Example 2.546. Implements types wrapping forced (Standard indented)
public class ImportantClass | implements ImportantInterface, | Serializable, | Comparable, | Cloneable { | ... | } |
After "throws" types
Forces a line wrap after each type name of the throws clause of a method/constructor declaration if the whole clause does not fit in one line.
Example 2.547. Throws types wrapped as needed (Endline indented)
private File getDestinationFile(File dest, String packageName, | String filename) | throws IOException, FooException, | FooBarException { | ... | } |
Example 2.548. Throws types wrapping forced (Endline indented)
private File getDestinationFile(File dest, String packageName, | String filename) | throws IOException, | FooException, | FooBarException { | ... | } |
Declaration parameters
When enabled, forces a line break after all method declaration parameters when not all parameters fit into a single line.
Since 1.2
Example 2.549. Method declaration with multiple parameters execeeding line length
| protected void processRequest( Request req, Response res, State state ) { ... | } |
Example 2.550. Method declaration with multiple parameters after wrapping
| protected void processRequest( Request req, | Response res, | State state ) { | ... | } |
Related options:
Call arguments
When enabled, forces a line break after all method or creator call arguments when not all arguments fit into a single line.
Since 1.2
After parameters/expressions
If enabled, this switch will cause all parameters/expressions to be wrapped, if and only if the first parameter/expression of the list has been wrapped.
Example 2.553. Expression list (all wrapped)
if ( "pick".equals(m.getName()) && m.isStatic() && m.isPublic() ) { pickFound = true; } else if ( "pick".equals(m.getName()) && m.isStatic() && m.isPublic() ) { pickFound = true; }
Related options:
Operators
When enabled, all operators are wrapped if a line was printed before the first operator.
Since 1.7
Example 2.554. Operators (wrap on demand)
while ( beleg.x() == null || beleg.x().isValidated() || beleg.getVerifier().getVerfication() == null || beleg.getVerifier().getName().length() == 0 ) { ... }
Example 2.555. Operators (wrap all when first wrapped)
while ( beleg.x() == null || beleg.x().isValidated() || beleg.getVerifier().getVerfication() == null || beleg.getVerifier().getName().length() == 0 ) { ... }
Related options:
Ternary expression colon (:)
When enabled, the ternary colon will be wrapped when a line break occured before the ternary question.
Since 1.3
Lets you disable line wrapping for certain elements.
Chained method calls
Lets you specify whether wrapping along the dots of chained method calls should be disabled.
Since 1.0
Example 2.558. Wrapped chained method call
message.format(ERROR_SOURCE_ADDRESS)
.param(m_session.getAimName())
.send();
Example 2.559. Chained method call (wrapping disabled)
message.format(ERROR_SOURCE_ADDRESS).param(
m_session.getAimName()).send();
Note how in the above example, wrapping does not occur along the dots of the chained method call, but after the left parenthesis!
Chained index operators
Lets you specify whether wrapping along the dots of chained index operators should be disabled.
Since 1.0
Note how in the above example wrapping does not occur along the dots of the index operator, but right after the assignment!
Qualifiers
Lets you specify whether wrapping along the dots of qualifiers should be disabled.
Since 1.0
Note how in the above example, wrapping does not occur along the dots of the qualifier, but before the method call!
Dotted expression
Lets you specify whether wrapping along dotted expressions should be disabled. This option covers all dotted expressions not handled by the more specific options for chained method calls, index operators or qualifiers (see above).
The option is enabled by default for compatibility reasons. If you're serious about the maximal line length limit, we recommend to disable the option.
Since 1.5



