Developer Notes

Coding Conventions

The Sun Code Conventions are followed.

Every class that is neither static nor abstract should have a toString() method, implemented using the ToStringBuilder from the Jakarta Commons Lang project. For printing the superclass (if required), appendSuper(super.toString()) is called prior to printing the fields. When required, equals(), hashCode(), and compareTo() are also implemented via Commons Lang. The next, currently unused prime for HashCodeBuilder is 37.

final is your friends and should be used whenever possible.

Eclipse Configuration

When using the Eclipse Platform for development, you will need to defined a MAVEN_REPO Java Classpath variable. This is done by selecting the "Window" menu, then "Preferences". In the dialog box, select the "Java" node and then "Build Path / Classpath Variables". Create a new variable named "MAVEN_REPO" that points to your local Maven repository (usually $HOME/.maven/repository or $MAVEN_HOME/repository).

Additionally, some configuration changes ("Window / Preferences" menu) are recommended:

  • On the "Java / Code Style / Code Formatter" page: Click "Edit" button; disable "Indent Javadoc tags" and "New line after @param tags" on the "Comments" tab (Eclipse will query you to name the modified profile: enter "Modified Java Conventions" or whatever you like).
  • "Java / Compiler" page: set "Compiler Compliance Level" to 5.0, enable "Use default compliance settings", and disable "Preserve unused (never read) local variables.
  • "Java / Compiler / Errors/Warnings" page: In the "Potential programming problems" section, set "Possible accidental boolean assignment" and "Empty statement" to "Warning", set "Serializable class without serialVersionUID" to "Ignore"; in "Name shadowing and conflicts", set "Field declaration that hides another field or variable" to "Warning"; in the "Unnecessary code" section, set "Local variable is never read", "Unused or unread private members", and "Unnecessary cast or instanceof operation" to "Warning"."
  • "Java / Compiler / Javadoc" page: set "Malformed Javadoc comments" to "Warning".
  • On the "Team / File Content" page, add these extensions (so their contents will be treated as ASCII): ans, aug, cfg, css, desc, js, org, prefs, vm.

Modified patterns on the "Java / Code Style / Code Templates" page:

  • Comments / Getters:
     * Returns the ${bare_field_name} of this instance.
     * @return the value of the attribute
  • Comments / Setters:
     * Modifies the ${bare_field_name} of this instance.
     * @param ${param} the new value of the attribute
  • Comments / Constructors:
     * Creates a new instance.
     * ${tags}
  • Comments / Types:
  • Code / New Java files:
     * Copyright (C) ${year} Christian Siefkes <>.
     * Development of this software is supported by the German Research Society,
     * Berlin-Brandenburg Graduate School in Distributed Information Systems
     * (DFG grant no. GRK 316).
     * This program is free software; you can redistribute it and/or modify
     * it under the terms of the GNU General Public License as published by
     * the Free Software Foundation; either version 2 of the License, or
     * (at your option) any later version.
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * GNU General Public License for more details.
     * You should have received a copy of the GNU General Public License
     * along with this program; if not, visit
     * or write to the Free Software
     * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     * @author Christian Siefkes
     * @version $$Revision: 1.56 $$, $$Date: 2006/10/21 16:26:45 $$, $$Author: siefkes $$

Eclipse Plugins

  • Eclipse Checkstyle Plug-in: Checkstyle is a development tool to help you ensure that your Java code adheres to a set of coding standards. Checkstyle does this by inspecting your Java source code and pointing out items that deviate from a defined set of coding rules. With the Checkstyle Eclipse plug-in your code is constantly inspected for problems.

    After installing the plugin, open on the "Checkstyle" page of the "Window / Preferences" menu and choose "Import Checkstyle Config" to load the checkstyle.xml file in the main project directory. Open the "ties" project context menu on the "Checkstyle" node and ensure that the imported "checkstyle.xml" configuration is enabled for the file pattern ^src/.*.java$ (i.e., all java files in the src/ folder). To make the Checkstyle warnings visible, click on the "Filters" button in the "Problems" view button and enable "Checkstyle Marker".

    The provided configuraton is based on the default "Sun Checks" configuration with same small changes: "CTOR_DEF" token is disabled for "Size Violations / Maximum Parameters" (the parameter number is checked for normal methods only, but not for constructors). "Size Violations / Maximum Method Length" is set to 300. The "Whitespace / Whitespace Around" check has been disabled for the four operators '<', '>', '+', and '-'. The severity of "Coding Problems / Avoid Inline Conditionals" and "Magic Numbers" is set to ignore. For the "Coding Problems / Illegal Instantiation" rule, "classes" are set to java.lang.Boolean,java.lang.String. For the "Coding Problems / Redundant Throws" rule, "allowUnchecked" and "allowSubclasses" are set to true. The severity of "Class Design / Design For Extension" and "Hide Utility Class Constructor" is set to ignore. The "format" property of "Miscellaneous / Generic Illegal Regexp" is set to "\s\s+$" -- this allows a single trailing space (which is typical for Javadoc comments) and only complains if there are multiple trailing spaces at the end of lines.
  • XMLBuddy: A plugin for editing XML document. After installing this plugin, you should adjust the preferences: Enable "Use spaces for tabs" on the "XMLBuddy / Formatting" page and remove the "project" DTD on the "XMLBuddy / XML / Validation / DTD" page.
  • Velocity editor plugin: An editor for the scripting language of the Velocity template engine, implemented as an Eclipse plugin.