Rules to remove dead code - provided by PMD
Unnecessary Code
UnnecessaryConversionTemporary
Avoid the use temporary objects when converting primitives to Strings. Use the static conversion methodson the wrapper classes instead.
UnnecessaryReturn
Avoid the use of unnecessary return statements.
UnnecessaryFinalModifier
When a class has the final modifier, all the methods are automatically final and do not need to betagged as such.
UselessOverridingMethod
The overriding method merely calls the same method defined in a superclass.
UselessOperationOnImmutable
An operation on an Immutable object (String, BigDecimal or BigInteger) won't change the object itselfsince the result of the operation is a new object. Therefore, ignoring the operation result is an error.
UnusedNullCheckInEquals
After checking an object reference for null, you should invoke equals() on that object rather than passing it to another object's equals() method.
UselessParentheses
Useless parentheses should be removed.
Unused Code
UnusedPrivateField
Detects when a private field is declared and/or assigned a value, but not used.
UnusedLocalVariable
Detects when a local variable is declared and/or assigned, but not used.
UnusedPrivateMethod
Unused Private Method detects when a private method is declared but is unused.
UnusedFormalParameter
Avoid passing parameters to methods or constructors without actually referencing them in the method body.
UnusedModifier
Fields in interfaces are automatically public static final, and methods are public abstract.
Classes or interfaces nested in an interface are automatically public and static (all nested interfaces are automatically static)
For historical reasons, modifiers which are implied by the context are accepted by the compiler, but are superfluous.
Import Statements
DuplicateImports
Duplicate or overlapping import statements should be avoided.
DontImportJavaLang
Avoid importing anything from the package 'java.lang'. These classes are automatically imported.
UnusedImports
Avoid the use of unused import statements to prevent unwanted dependencies.
ImportFromSamePackage
There is no need to import a type that lives in the same package.
TooManyStaticImports
If you overuse the static import feature, it can make your program unreadable and unmaintainable, polluting its namespace with all the static members you import.
Readers of your code (including you, a few months after you wrote it) will not know which class a static member comes from.
UnnecessaryFullyQualifiedName
Import statements allow the use of non-fully qualified names.
The use of a fully qualified name which is covered by an import statement is redundant.
Consider using the non-fully qualified name.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.