jstyle(1ONBLD) illumos Build Tools jstyle(1ONBLD)

NAME

jstyle - check for some common stylistic errors in Java source files

SYNOPSIS

jstyle [-chptvC] [file...]

DESCRIPTION

jstyle inspects Java source files (*.java) for common stylistic errors. It is similar to cstyle(1ONBLD) in that it attempts to check for the style documented in /shared/ON/general_docs/cstyle.ms.pdf, although by necessity is modified to work with Java-specific constructs. Note that there is much in that document that cannot be checked for; just because your code is jstyle(1ONBLD) clean does not mean that you've followed Sun's Java style. Caveat emptor.

OPTIONS

The following options are supported:
-c
Check continuation line indentation inside of functions. Sun's C style states that all statements must be indented to an appropriate tab stop, and any continuation lines after them must be indented exactly four spaces from the start line. This option enables a series of checks designed to find contination line problems within functions only.
-h
Performs heuristic checks that are sometimes wrong. Not generally used.
-p
Performs some of the more picky checks. You should generally use this.
-t
Insists on indentation with tabs. Because of the depth of nested blocks that Java requires, and the commonality of long identifiers, tab indentation in Java code is not always useful, assuming that tabs are fixed at eight columns and that maximum line length is fixed at eighty columns, so this option is not on by default. If you choose to consider tabs to be four columns wide (not acceptable for ON), or are writing simple enough code that the nesting is not very deep, this option might be useful. Otherwise, avoid it.
-v
Verbose output; includes the text of the line of error.
-C
Ignore errors in header comments (i.e., block comments starting in the first column). Not generally used.

NOTES

The jstyle rule for the OS/Net consolidation is that all new files must be -p clean. For existing files, the following invocations are run against both the old and new files:
jstyle file
jstyle -p file

If the old file gave no errors for one of the invocations, the new file must also give no errors. This way, files cannot become unclean.

BUGS

jstyle(1ONBLD) cannot disambiguate Java generic type parameters or arguments that span multiple lines from relational operators. For example:

private class Foo<A extends Bar,

 
B extends Bar> { ...

is flagged as two lines with missing spaces around relational operators.

22 November 2005