When contributing code or patches to Jython, please try to follow these guidelines.

Python Code

In general, follow PEP 8. When importing Java code, always use fully qualified class names, not package names ie from java.lang import String instead of from java import lang.

Java Code

   Wrong:
   //XXX: Foo needs refactoring
   // bar.bar()
   Correct:
   // XXX: Quux is flakey
   //Baz baz = new Baz()

Beyond these rules, follow the Sun Java standards.

Eclipse_Formatting.xml can be imported into Eclipse to get it to follow the standards.

Example (adapted from Sun document)

package org.jython.blah;
import org.jython.blah.BlahBlah;
/**
 * Class description goes here.
 */
public class Blah extends SomeClass {
    /* A class implementation comment can go here. */
    /** classVar1 documentation comment */
    public static int classVar1;
    /**
     * classVar2 documentation comment that happens to be
     * more than one line long
     */
    private static Object classVar2;
    /** instanceVar1 documentation comment */
    public Object instanceVar1;
    /** instanceVar2 documentation comment */
    protected int instanceVar2;
    /** instanceVar3 documentation comment */
    private Object[] instanceVar3;
    /**
     * ...constructor Blah documentation comment...
     */
    public Blah() {
        // ...implementation goes here...
    }
    /**
     * ...method doSomething documentation comment...
     */
    public void doSomething() {
        // ...implementation goes here...
    }
    /**
     * ...method doSomethingElse documentation comment...
     * @param someParam description
     */
    public void doSomethingElse(Object someParam) {
        // ...implementation goes here...
    }
}

CodingStandards (last edited 2014-04-24 13:04:50 by AdamBurke)