Rule Description KPI url
OverrideBothEqualsAndHashcode Override both public boolean Object.equals(Object other), and public int Object.hashCode(), or override neither. Even if you are inheriting a hashCode() from a parent class, consider implementing hashCode and explicitly delegating to your superclass. Accuracy https://pmd.github.io/pmd/pmd_rules_java.html
BrokenNullCheck The null check is broken since it will throw a NullPointerException itself. It is likely that you used || instead of&&or vice versa. Robustness https://pmd.github.io/pmd/pmd_rules_java.html
AvoidMultipleUnaryOperators The use of multiple unary operators may be problematic, and/or confusing. Ensure that the intended usage is not a bug, or consider simplifying the expression. Accuracy https://pmd.github.io/pmd/pmd_rules_java.html
AvoidBranchingStatementAsLastInLoop Using a branching statement as the last part of a loop may be a bug, and/or is confusing. Ensure that the usage is not a bug, or consider using another approach. Accuracy https://pmd.github.io/pmd/pmd_rules_java.html
ProperCloneImplementation Object clone() should be implemented with super.clone(). Accuracy https://pmd.github.io/pmd/pmd_rules_java.html
AvoidUsingVolatile Use of the keyword ‘volatile’ is generally used to fine tune a Java application, and therefore, requires a good expertise of the Java Memory Model. Moreover, its range of action is somewhat misknown. Therefore, the volatile keyword should not be used for maintenance purpose and portability. Maintainability https://pmd.github.io/pmd/pmd_rules_java.html
AvoidUsingNativeCode Unnecessary reliance on Java Native Interface (JNI) calls directly reduces application portability and increases the maintenance burden. Portability https://pmd.github.io/pmd/pmd_rules_java.html
DoNotCallGarbageCollectionExplicitly Calls to System.gc(), Runtime.getRuntime().gc(), and System.runFinalization() are not advised. Code should have the same behavior whether the garbage collection is disabled using the option -Xdisableexplicitgc or not. Moreover, “modern” jvms do a very good job handling garbage collections. If memory usage issues unrelated to memory leaks develop within an application, it should be dealt with JVM options rather than within the code itself. Maintainability https://pmd.github.io/pmd/pmd_rules_java.html
AvoidReassigningParameters Reassigning values to incoming parameters is not recommended. Use temporary local variables instead. Understandability https://pmd.github.io/pmd/pmd_rules_java.html
EqualsNull Tests for null should not use the equals() method. The ‘==’ operator should be used instead. Accuracy https://pmd.github.io/pmd/pmd_rules_java.html
AvoidSynchronizedAtMethodLevel Method-level synchronization can cause problems when new code is added to the method. Block-level synchronization helps to ensure that only the code that needs synchronization gets it. Efficiency https://pmd.github.io/pmd/pmd_rules_java.html
MissingBreakInSwitch Switch statements without break or return statements for each case option may indicate problematic behaviour. Empty cases are ignored as these indicate an intentional fall-through. Accuracy https://pmd.github.io/pmd/pmd_rules_java.html
CompareObjectsWithEquals Use equals() to compare object references; avoid comparing them with == Accuracy https://pmd.github.io/pmd/pmd_rules_java.html
SingleMethodSingleton Some classes contain overloaded getInstance. The problem with overloaded getInstance methods is that the instance created using the overloaded method is not cached and so, for each call and new objects will be created for every invocation. Understandability https://pmd.github.io/pmd/pmd_rules_java.html
SingletonClassReturningNewInstance Some classes contain overloaded getInstance. The problem with overloaded getInstance methods is that the instance created using the overloaded method is not cached and so, for each call and new objects will be created for every invocation. Understandability https://pmd.github.io/pmd/pmd_rules_java.html
ReturnEmptyArrayRatherThanNull For any method that returns an array, it is a better to return an empty array rather than a null reference. This removes the need for null checking all results and avoids inadvertent NullPointerExceptions. Robustness https://pmd.github.io/pmd/pmd_rules_java.html
AbstractClassWithoutAnyMethod If an abstract class does not provides any methods, it may be acting as a simple data container that is not meant to be instantiated. In this case, it is probably better to use a private or protected constructor in order to prevent instantiation than make the class misleadingly abstract. Understandability https://pmd.github.io/pmd/pmd_rules_java.html
GuardLogStatement Whenever using a log level, one should check if the loglevel is actually enabled, or otherwise skip the associate String creation and manipulation. Analyzability https://pmd.github.io/pmd/pmd_rules_java.html
MoreThanOneLogger Normally only one logger is used in each class. Analyzability https://pmd.github.io/pmd/pmd_rules_java.html
LoggerIsNotStaticFinal In most cases, the Logger reference can be declared as static and final. Robustness https://pmd.github.io/pmd/pmd_rules_java.html
SystemPrintln References to System.(out|err).print are usually intended for debugging purposes and can remain in the codebase even in production code. By using a logger one can enable/disable this behaviour at will (and by priority) and avoid clogging the Standard out log. Maintainability https://pmd.github.io/pmd/pmd_rules_java.html
GuardLogStatementJavaUtil Whenever using a log level, one should check if the loglevel is actually enabled, or otherwise skip the associate String creation and manipulation. Analyzability https://pmd.github.io/pmd/pmd_rules_java.html
AvoidEnumAsIdentifier Use of the term ‘enum’ will conflict with newer versions of Java since it is a reserved word. Portability https://pmd.github.io/pmd/pmd_rules_java.html
AvoidAssertAsIdentifier Use of the term ‘assert’ will conflict with newer versions of Java since it is a reserved word. Portability https://pmd.github.io/pmd/pmd_rules_java.html
IntegerInstantiation Calling new Integer() causes memory allocation that can be avoided by the static Integer.valueOf(). It makes use of an internal cache that recycles earlier instances making it more memory efficient. Resource Utilization https://pmd.github.io/pmd/pmd_rules_java.html
ByteInstantiation Calling new Byte() causes memory allocation that can be avoided by the static Byte.valueOf(). It makes use of an internal cache that recycles earlier instances making it more memory efficient. Resource Utilization https://pmd.github.io/pmd/pmd_rules_java.html
ShortInstantiation Calling new Short() causes memory allocation that can be avoided by the static Short.valueOf(). It makes use of an internal cache that recycles earlier instances making it more memory efficient. Resource Utilization https://pmd.github.io/pmd/pmd_rules_java.html
LongInstantiation Calling new Long() causes memory allocation that can be avoided by the static Long.valueOf(). It makes use of an internal cache that recycles earlier instances making it more memory efficient. Resource Utilization https://pmd.github.io/pmd/pmd_rules_java.html
SuspiciousEqualsMethodName The method name and parameter number are suspiciously close to equals(Object), which can denote an intention to override the equals(Object) method. Understandability https://pmd.github.io/pmd/pmd_rules_java.html
AvoidCatchingNPE Code should never throw NullPointerExceptions under normal circumstances. A catch block may hide the original error, causing other, more subtle problems later on. Robustness https://pmd.github.io/pmd/pmd_rules_java.html
AvoidThrowingRawExceptionTypes Avoid throwing certain exception types. Rather than throw a raw RuntimeException, Throwable, Exception, or Error, use a subclassed exception or error instead. Robustness https://pmd.github.io/pmd/pmd_rules_java.html
AvoidLosingExceptionInformation Statements in a catch block that invoke accessors on the exception without using the information only add to code size. Either remove the invocation, or use the return result. Analyzability https://pmd.github.io/pmd/pmd_rules_java.html
StringInstantiation Avoid instantiating String objects; this is usually unnecessary since they are immutable and can be safely shared. Resource Utilization https://pmd.github.io/pmd/pmd_rules_java.html