PMD Plugin preferences rule set Avoid throwing a NullPointerException - it's confusing because most people will assume that the virtual machine threw it. Consider using an IllegalArgumentException instead; this will be clearly seen as a programmer initiated exception. 2 Avoid throwing certain exception types. Rather than throw a raw RuntimeException, Throwable, Exception, or Error, use a subclassed exception or error instead. 2 Newbie programmers sometimes get the comparison concepts confused and use equals() to compare to null. 1 A variable naming conventions rule - customize this to your liking. Currently, it checks that final variables should be all caps and non-final variables should not include underscores. 1 Reassigning values to parameters is a questionable practice. Use a temporary local variable instead. 2 Avoid instantiating String objects; this is usually unnecessary. 1 The abstract class does not contain any abstract methods. An abstract class suggests an incomplete implementation, which is to be completed by subclasses implementing the abstract methods. If the class is intended to be used as a base class only (not to be instantiated direcly) a protected constructor can be provided prevent direct instantiation. 2 Avoid assignments in operands; this can make code more complicated and harder to read. 2 Identifies a possible unsafe usage of a static field. 1 Instead of copying data between two arrays, use System.arrayCopy method 1 An interface should be used only to model a behaviour of a class: using an interface as a container of constants is a poor usage pattern. 2 0 ] ]]> Method level synchronization can backfire when new code is added to the method. Block-level synchronization helps to ensure that only the code that needs synchronization gets it. 1 Empty Catch Block finds instances where an exception is caught, but nothing is done. In most circumstances, this swallows an exception which should either be acted on or reported. 1 Avoid empty finally blocks - these can be deleted. 1 Empty If Statement finds instances where a condition is checked but nothing is done about it. 1 An empty statement (aka a semicolon by itself) that is not used as the sole body of a for loop or while loop is probably a bug. It could also be a double semicolon, which is useless and should be removed. 1 Avoid empty try blocks - what's the point? 1 Empty While Statement finds all instances where a while statement does nothing. If it is a timing loop, then you should use Thread.sleep() for it; if it's a while loop that does a lot in the exit expression, rewrite it to make it clearer. 1 If a final field is assigned to a compile-time constant, it could be made static, thus saving overhead in each object 1 Identifies private fields whose values never change once they are initialized either in the declaration of the field or by a constructor. This aids in converting existing classes to immutable classes. 1 No need to import a type that's in the same package. 1 String.trim().length() is an inefficient way to check if a String is really empty, as it creates a new String object just to check its size. Looping through a string, checking Character.isWhitespace() on each character and returning false if a non-whitespace character is found is preferable 0) { doSomething(); } } } ]]> 1 Avoid concatenating non literals in a StringBuffer constructor or append(). 2 Detects when a non-field has a name starting with 'm_'. This usually indicates a field and thus is confusing. 1 Be sure to specify a Locale when creating a new instance of SimpleDateFormat. 1 Avoid unnecessary comparisons in boolean expressions - this makes simple code seem complicated. 2 Avoid calling toString() on String objects; this is unnecessary 1 Switch statements should have a default label. 1 Uncommented Empty Method finds instances where a method does not contain statements, but there is no comment. By explicitly commenting empty methods it is easier to distinguish between intentional (commented) and unintentional empty methods. 1 Avoid unnecessary temporaries when converting primitives to Strings 1 Sometimes expressions are wrapped in unnecessary parentheses, making them look like a function call. 1 Parsing method should be called directy instead. 2 Avoid passing parameters to methods or constructors and then not using those parameters. 2 Detects when a private field is declared and/or assigned a value, but not used. 2 Unused Private Method detects when a private method is declared but is unused. 2 Use valueOf() argument directly. 1 Avoid using 'while' statements without using curly braces 1 Avoid duplicate import statements. 1 System.(out|err).print is used, consider using a logger. 1