Misc

Lets you control miscellaneous separation settings.

Figure 2.47. Blank Lines Misc settings page

Blank Lines Misc settings page

Keep blank lines up to

When enabled, retains up to the given number of blank lines found in the original source. Note that Jalopy still takes your other blank lines settings into account. If you disable this option, all original blank lines will be ignored!

Example 2.695. Source code with blank lines to separate declaration sections

aMVString = new MultiValueString("abc");
¶
System.out.println("MV = "+aMVString);
¶
System.out.println("MV0 = "+aMVString.extract(0));
System.out.println("MV1 = "+aMVString.extract(1));
System.out.println("MV2 = "+aMVString.extract(2));
System.out.println("");

If this feature is left disabled, Jalopy will print the individual lines according to the current blank lines settings but won’t try to keep any blank lines.

Keep blank lines in headers up to

When enabled, retains up to the given number of blank lines found in the original source file between header (and footer) comments. This option is only signficant when you enable the header/footer feature and specify a multi-header template, without enabling the override mode.

Since 1.7

Example 2.696. Source code with blank lines to separate headers

/*
 * Foo.java
 * 
 * $Header: //depot/foo/src/main/com/foo/Foo.java#13 $
 *//*
 * Copyright (c) 2002 FooBar, Inc. All rights reserved.
 *
 * This software is the confidential and proprietary information
 * of FooBar, Inc. ("Confidential Information"). You shall not
 * disclose such Confidential Information and shall use it only
 * in accordance with the terms of the license agreement you
 * entered into with FooBar, Inc.
 */
package com.foobar.lemon;

Chunks

Lets you define what makes a chunk: a section of associated statements. With "Variable identifiers" and/or "Align assignments" enabled, Jalopy determines what statements can be aligned using these options. With “Align endline comments” enabled, Jalopy determines what comments should be aligned together.

By comments

When enabled, a statement with a comment before is recognized as the start of a new chunk.

Example 2.697. Aligned assignments/identifiers

String        text  = "text";
int           a     = -1;
// create a new entry
History.Entry entry = new History.Entry(text);

Example 2.698. Aligned assignments/identifiers, chunks by comments

String text  = "text";
int    a     = -1;
// create a new entry
History.Entry entry = new History.Entry(text);

By blank lines

When enabled, a statement which has one or more blank lines before is recognized as the start of a new chunk.

Example 2.699. Aligned assignments/identifiers

String        text  = "text";
int           a     = -1;
¶
History.Entry entry = new History.Entry(text);

Example 2.700. Aligned assignments/identifiers, chunks by blank lines

String text  = "text";
int    a     = -1;
¶
History.Entry entry = new History.Entry(text);

By line wrap

When enabled, a statement that takes more than just one line to print is recognized as the start of a new chunk. With standard indentation, it is recommended to have this option enabled, because otherwise wrapped expressions might obscure aligned assignments. Please note that this option does not affect endline comments!

Since 1.3

Example 2.701. Aligned assignments

int labelR_x      = Math_min(iconR.x, textR.x);
int labelR_with   = Math_max(iconR.x + iconR.width, textRrr.x) -
    labelR_x;
int labelR_width  = Math_max(iconR.x + iconR.width, textRrr.x) -
    labelR_x;
int labelR_y      = Math_min(iconR.y, textR.y);
int labelR_height = Math_max(iconR.y + iconR.height,
        textR.y + textR.height);
int labelR_x      = Math_min(iconR.x, textR.x);
int lab           = Math_min(iconR.x, textR.x);

Example 2.702. Aligned assignments, chunks by line wrap, prefer wrap after assign

int labelR_x = Math_min(iconR.x, textR.x);
int labelR_with =
    Math_max(iconR.x + iconR.width, textRrr.x) - labelR_x;
int labelR_width =
    Math_max(iconR.x + iconR.width, textRrr.x) - labelR_x;
int labelR_y = Math_min(iconR.y, textR.y);
int labelR_height =
    Math_max(iconR.y + iconR.height, textR.y + textR.height);
int labelR_x = Math_min(iconR.x, textR.x);
int lab      = Math_min(iconR.x, textR.x);

Remove blank lines for method prototypes

When enabled, blank lines around abstract method declarations are removed. This includes all methods in interfaces (which are implicitly abstract). And all methods explicitely declared abstract in classes. If left disabled, blank lines will be printed according to the blank lines settings for methods (see “Blank lines after methods”).

Since 1.2

Example 2.703. Method prototypes

interface foo {

    public void method1();

    public void method2();

    public void method3();
}

Example 2.704. Method prototypes without blank lines

interface foo {
    public void method1();
    public void method2();
    public void method3();
}

Ignore control statements option for break in switch

When enabled, the “Blank Lines before control statements” option is ignored for break statements within switch blocks.

Since 1.3

Example 2.705. 1 blank lines before control statements

switch (number) {
    case 1:
        System.out.println();

        break;

    default:
        System.out.println();

        break;
}

Example 2.706. 1 blank lines before control statements, but option ignored

switch (number) {
    case 1:
        System.out.println();
        break;

    default:
        System.out.println();
        break;
}

Ignore blocks option in switch

When enabled, the “Blank lines for blocks” option is ignored within switch blocks.

Since 1.3

Example 2.707. 1 blank lines before blocks

switch (number) {
    case 1:

        if (DEBUG)
            System.out.println("FIRST NUMBER");

        break;

    default:

        while (true)
            perform();

        break;
}

Example 2.708. 1 blank lines before blocks, but option ignored

switch (number) {
    case 1:
        if (DEBUG)
            System.out.println("FIRST NUMBER");

        break;

    default:
        while (true)
            perform();

        break;
}