Insert expression parentheses
It is always good advise to use more parentheses than you think you need. They
may not be needed, but they add clarity and don't cost anything.
Example 4.150. How is this expression evaluated?
int result = 12 + 4 % 3 * 7 / 8;
|
Example 4.151. How is this expression evaluated? (continued)
int result = 12 + ((4 % 3 * 7) / 8);
|
Insert serial version UID
Common sense dictates to declare an explicit serial version UID in every
serializable class to eliminate the serial version UID as a potential source
of incompatibility (with the additional benefit of a small performance gain).
If this switch is enabled and the class directly dereives from either
java.io.Serializable or java.io.Externalizable,
Jalopy computes and inserts a serial version UID for the class.
For this feature to work, the class that has its serial version UID computed
needs to be available on the classpath.
Insert logging conditional
Typically, logging systems have a method that submits a logging message like
logger.debug("some message: " + someVar);
|
This is fine, but if the debug level is set such that this message will
NOT display, then time is wasted doing the string marshalling.
Thus, the preferred way to do this is
if (logger.isDebugEnabled()) {
logger.debug("some message: " + someVar);
}
|
which will only use CPU time if the log message is needed. Enabling this switch
will ensure that every logging call with the debug level set will be enclosed with
the conditional expression.
Use this feature with care! The current implementation only supports the Jakarta
Log4J toolkit and is somewhat weak in that every method call called
debug is treated as a logging call which could be incorrect
in your application. However, it works fine for the l7dlog calls.
Insert trailing newline
If enabled, Jalopy inserts an empty line at the end of every file. This may
help to avoid problems with certain text formatters and processors.
Note that Jalopy always inserts at least one empty line after footers, so there
is no real need (but it doesn't hurt) to check the mark in case footer insertion
will be performed (see Section 4.3.11, “Footer”)
Array brackets after identifiers
Lets you choose where the brackets of array types should be placed.
By default, Jalopy prints the square brackets right after the array type.
Example 4.152. Array brackets after type
But C/C++ programmers may expect them to appear after the identifier.
Example 4.153. Array brackets after identifier
Force formatting
Jalopy can keep track of which files have been formatted previously.
See Section 4.3.13.2, “History” below. If History is enabled, Jalopy will
exclude files that have a modification date coincident with the last formatting.
However, you can override this history check to force a format. For example,
you might need to update the copyright notice for the whole code base. Enabling
this switch ensures that all source files are always be formatted. Note that
this switch is only meaningful if the history feature is enabled.