Thorntail Code Style

Currently we have code styles that can be imported for the following IDEs:

The above styles are an embodiment, hopefully, of the following rules:

* Spacing/Tabs
    * Java - 4 spaces
    * XML, and other file types - 2 spaces
    * No tab characters
* Java Imports
    * No '*' imports unless it's for static members

Here are some code examples of what the settings mean:

@Annotation(param1 = "value1", param2 = "value2")
public class Foo<T extends Bar & Abba, U> {

    public void foo(int x, int y) {
        Runnable r = () -> {
        Runnable r1 = this::bar;
        for (int i = 0; i < x; i++) {
            y += (y ^ 0x123) << 2;
        do {
            try (MyResource r1 = getResource(); MyResource r2 = null) {
                if (0 < x && x < 10) {
                    while (x != y) {
                        x = f(x * 3 + 5);
                } else {
                    synchronized (this) {
                        switch (e.getCode()) {
            } catch (MyException e) {
            } finally {
                int[] arr = (int[]) g(y);
                x = y >= 0 ? arr[y] : -1;
                Map<String, String> sMap = new HashMap<String, String>();
                Bar.<String, Integer>mess(null);
        while (true);

    int[] X = new int[]{1, 3, 5, 6, 7, 87, 1213, 2};

    int[] empty = new int[]{};

    void bar() {

class Bar {
    static <U, T> U mess(T t) {
        return null;

interface Abba {

Checkstyle Rules

These are the checkstyle rules that are currently being used


Checks that there are no tab characters. 'eachLine' is set to true so that every tab character found is reported, not just the first one.


Sets a format of \s+$ to ensure there are no trailing spaces on lines.


Checks for import statements with the * notation. allowStaticMemberImports is set to true so that * is allowed in situations such as:

import static org.junit.Assert.*;


Checks any import statements that are not necessary for compilation, due to duplication or it being a java.lang class.


Checks for import statements that are no longer necessary for code compilation.


Checks for imports of illegal packages, such as sun.*. In our case junit.framework has been added as org.junit is the newer package naming.


Checks for modifier order to ensure it conforms with:

  1. public
  2. protected
  3. private
  4. abstract
  5. static
  6. final
  7. transient
  8. volatile
  9. synchronized
  10. native
  11. strictfp


Checks for modifiers that are not necessary. For instance, fields on interfaces are automatically public, static, and final.


Checks that { is placed at the end of the line for classes, constructors, interfaces, methods, switch statements and static initialization blocks.


Looks for ; without code prior to it.


Checks that classes overriding equals() also override hashcode().


Ensure the default is after all case statements in a switch.


Checks for instantiations where a factory is preferred, such as Boolean.TRUE instead of new Boolean(true).


Checks that a switch contains a default.


Check that constants are defined as Long and not long.


Ensures all package annotations are in


Checks all utility classes, such as those with all static methods, don't have a public constructor.


Ensures java.lang.Override is present when {@inheritDoc} is present.


Checks that a class which defines a Covariant equals(MyClass) method also overrides equals(Object) to prevent unexpected behavior.


Checks that inner classes and interfaces are specified at the bottom of the class file.


Prefers "someValue".equals(myVar) over myVar.equals("someValue")


Prefers main(String[] args) over main(String args[])