JNode Java style rules

All code that is developed as part of the JNode project must conform to the style set out in Sun's "Java Style Guidelines" (JSG) with variations and exceptions listed below. Javadocs are also important, so please try to make an effort to make them accurate and comprehensive.

Note that we use CheckStyle 4.4 as our arbiter for Java style correctness. Run "./build.sh checkstyle" to check your code style before checking it in or submitting it as a patch. UPDATE: And also, please run "./build.sh javadoc" to make sure that you haven't introduced any new javadoc warnings.

No TAB characters.
No TAB characters (HT or VT) are allowed in JNode Java source code.
Whitespace TABs should be replaced with the requisite number of spaces or newlines. Non-whitespace TABs (i.e. in Java strings) should be replaced with "\t" or "\f" escape sequences.
Use 4 space indentation.
Two or three characters is too little, eight is too much.
Maximum line width 120.
The JSG recommends 80 characters, but most people use tools that can cope with much wider.
Put following keywords on same line as }
For example:

    try {
        if (condition) {
        } else {
    } catch (Exception ex) {
        return 42;

Note that the else is on the same line as the preceding }, as is the catch.

Indent labels by -4.
For example:

public void loopy() {
    int i;
    for (i = 100; i < 1000000; i++) {
        if (isPrime(i) && isPrime(i + 3) && isPrime(i + 5) {
            break LOOP;
No empty { } blocks
A { } block with no code should contain a comment to say why the block is empty. For example,

    try {
    } catch (IOException ex) {
        // we can safely ignore this
No marker comments
It is generally accepted that marker comments (like the following) add little to the readability of a program. In fact, most programmers think they are an eyesore and a waste of space.

    // Start of private methods
Avoid copying javadoc
Instead of copying the javadoc from the parent class or method, use the {@inheritDoc} tag and if needed add some specific javadoc.

     * {@inheritDoc}
    public void myMethod(String param1, int param2) {
Give your references in the javadoc
When you are implementing a class from a reference document, add a link in the javadoc.