Comments

Controls how Jalopy handles comments in source files.

Figure 2.62. Comments settings page

Comments settings page

Comment types

Describes what comments Jalopy recognizes and how they are treated. As far as Jalopy is concerned, there are five types of comments:

Single-line comments

An end-of-line comment: all text from the ASCII characters // to the end of the line

Example 2.749. Single-line comment

// [PENDING] this should be part of the ErrorManager

Single-line comments are normally printed as-is, but can be formatted as well (see the section called “Format”).

Multi-line comments

A traditional comment: all text from the ASCII characters /* to the ASCII characters */

Example 2.750. Multi-line comment

/*
public int getSubregionStartOffset(int line, int subregion)
{
    ChunkCache.LineInfo[] lineInfos = cache.getLineInfosForPhysicalLine(line);
    return buffer.getLineStartOffset(lineInfos[subregion].physicalLine)
        + lineInfos[subregion].offset;
}
*/

Multi-line comments are normally printed as-is, but can be formatted as well (see the section called “Format”).

Javadoc comments

A documentation comment: actually a special kind of multi-line comment as defined by the Sun Javadoc specification; all text from the ASCII characters /** to the ASCII characters */.

Example 2.751. Javadoc comment

/**
 * A scroll listener will be notified when the text area is scrolled, either
 * horizontally or vertically.
 */

Javadoc comments are normally printed as-is, but can be formatted according to the code convention settings (see the section called “Format”).

Separator comments

A Jalopy-specific separator comment: actually a special kind of single-line comment; all text from the ASCII characters //~ to the end of the line.

Example 2.752. Separator comment

//~ Inner classes ---------------------------------------

Separator comments are always removed during parsing and may be re-inserted during emitting according to the code convention settings. Refer to the section called “Comments” for more information about separator comments.

Pragma comments //J[directive]

A Jalopy-specific control comment: actually a special kind of single-line comment; all text from the ASCII characters //J to the end of the line. Pragma comments are always printed as-is.

Currently, Jalopy supports the following pragma comments:

//J- and //J+

Lets you selectively disable formatting for certain code sections. //J- tells Jalopy to disable formatting until //J+ will enable it again. All code between (and including) the two comments will be printed as-is.

Example 2.753. Pragma comments

//J-
     if (operator.equals("EQ"))  return (left == right);
else if (operator.equals("NE"))  return (left != right);
else if (operator.equals("LT"))  return (left <  right);
else if (operator.equals("GT"))  return (left >  right);
else if (operator.equals("LE"))  return (left <= right);
else if (operator.equals("GE"))  return (left >= right);
else
{
    throw new IllegalArgumentException("Unknown int if operator: " +
                                       operator);
}
//J+

Important

The two comments must always be used in conjunction and they must always appear on a line by themselves. Never place them after code elements!

//JDOC-

When placed in front of a Javadoc comment, disables the Javadoc generation feature no matter what the code convention dictates.

Example 2.754. //JDOC- comment

    /**
     * DOCUMENT ME!
     */
    public class Test {

        //JDOC-
        public void test(String input) {

            ...
        }
    }

//J:KEEP+

Instructs Jalopy to keep existing line breaks within array initializers and parameter or argument lists. The comment must be placed either directly after the left curly brace of array initializers, or the left parenthesis of parameter or argument lists, or the first element of the initializer or list.

Since 1.9.3

Example 2.755. Keep line breaks within call argument list

FormLayout layout = new FormLayout( //J:KEEP+
    "fill:d:grow(1.0), 15px",
    "7px, d, 7px, fill:d:grow(1.0)");

Example 2.756. Keep line breaks within array initializer

String[] options =
    { //J:KEEP+
        "-jar", aLauncher.getAbsolutePath(),
        "-application", "org.foo.application.Main",
        "-debug",
        "-consolelog"
    };

Please refer to the documentation of the wrapping options in the section called “Keep line breaks”, for information how to configure the general wrapping behavior.