Contains the Coding checks that are bundled with the main distribution.
Class Summary Class Description AbstractSuperCheckAbstract class for checking that an overriding method with no parameters invokes the super method. AbstractSuperCheck.MethodNodeStack node for a method definition and a record of whether the method has a call to the super method. ArrayTrailingCommaCheckChecks that array initialization contains a trailing comma. AvoidDoubleBraceInitializationCheckDetects double brace initialization. AvoidInlineConditionalsCheckDetects inline conditionals. AvoidNoArgumentSuperConstructorCallCheckChecks if call to superclass constructor without arguments is present. CovariantEqualsCheckChecks that classes and records which define a covariant
equals()method also override method
DeclarationOrderCheckChecks that the parts of a class, record, or interface declaration appear in the order suggested by the Code Conventions for the Java Programming Language. DeclarationOrderCheck.ScopeStatePrivate class to encapsulate the state. DefaultComesLastCheckCheck that the
defaultis after all the cases in a
EmptyStatementCheckDetects empty statements (standalone
EqualsAvoidNullCheckChecks that any combination of String literals is on the left side of an
EqualsAvoidNullCheck.FieldFrameHolds the names of fields of a type. EqualsHashCodeCheckChecks that classes that either override
hashCode()also overrides the other.
ExplicitInitializationCheckChecks if any class or object member is explicitly initialized to default for its type value (
nullfor object references, zero for numeric types and
FallThroughCheckChecks for fall-through in
FinalLocalVariableCheckChecks that local variables that never have their values changed are declared final. FinalLocalVariableCheck.FinalVariableCandidateRepresents information about final local variable candidate. FinalLocalVariableCheck.ScopeDataHolder for the scope data. HiddenFieldCheckChecks that a local variable or a parameter does not shadow a field that is defined in the same class. HiddenFieldCheck.FieldFrameHolds the names of static and instance fields of a type. IllegalCatchCheckChecks that certain exception types do not appear in a
IllegalInstantiationCheckChecks for illegal instantiations where a factory method is preferred. IllegalThrowsCheckChecks that specified types are not declared to be thrown. IllegalTokenCheckChecks for illegal tokens. IllegalTokenTextCheckChecks specified tokens text for matching an illegal pattern. IllegalTypeCheckChecks that particular classes or interfaces are never used. InnerAssignmentCheckChecks for assignments in subexpressions, such as in
String s = Integer.toString(i = 2);.
MagicNumberCheckChecks that there are no "magic numbers" where a magic number is a numeric literal that is not defined as a constant. MatchXpathCheckEvaluates Xpath query and report violation on all matching AST nodes. MissingCtorCheckChecks that classes (except abstract ones) define a constructor and don't rely on the default one. MissingSwitchDefaultCheckChecks that switch statement has a
ModifiedControlVariableCheckChecks that for loop control variables are not modified inside the for block. MultipleStringLiteralsCheckChecks for multiple occurrences of the same string literal within a single file. MultipleVariableDeclarationsCheckChecks that each variable declaration is in its own statement and on its own line. NestedForDepthCheckRestricts nested
forblocks to a specified depth.
NestedIfDepthCheckRestricts nested if-else blocks to a specified depth. NestedTryDepthCheckRestricts nested try-catch-finally blocks to a specified depth. NoArrayTrailingCommaCheckChecks that array initialization do not contain a trailing comma. NoCloneCheckChecks that the clone method is not overridden from the Object class. NoEnumTrailingCommaCheckChecks that enum definition does not contain a trailing comma. NoFinalizerCheckChecks that there is no method
finalizewith zero parameters.
OneStatementPerLineCheckChecks that there is only one statement per line. OverloadMethodsDeclarationOrderCheckChecks that overloaded methods are grouped together. PackageDeclarationCheckEnsures that a class has a package declaration, and (optionally) whether the package name matches the directory name for the source file. ParameterAssignmentCheckDisallows assignment of parameters. RequireThisCheckChecks that references to instance variables and methods of the present object are explicitly of the form "this.varName" or "this.methodName(args)" and that those references don't rely on the default behavior when "this." is absent. RequireThisCheck.AbstractFrameA declaration frame. RequireThisCheck.AnonymousClassFrameAn anonymous class frame; holds instance variable names. RequireThisCheck.BlockFrameA frame initiated on entering a statement list; holds local variable names. RequireThisCheck.CatchFrameA frame initiated on entering a catch block; holds local catch variable names. RequireThisCheck.ClassFrameA frame initiated at class, enum or interface definition; holds instance variable names. RequireThisCheck.ConstructorFrameA frame initiated at constructor definition. RequireThisCheck.ForFrameA frame initiated on entering a for block; holds local for variable names. RequireThisCheck.MethodFrameA frame initiated at method definition; holds a method definition token. RequireThisCheck.TryWithResourcesFrameA frame initiated on entering a try-with-resources construct; holds local resources for the try block. ReturnCountCheckRestricts the number of return statements in methods, constructors and lambda expressions. SimplifyBooleanExpressionCheckChecks for over-complicated boolean expressions. SimplifyBooleanReturnCheckChecks for over-complicated boolean return statements. StringLiteralEqualityCheckChecks that string literals are not used with
SuperCloneCheckChecks that an overriding
SuperFinalizeCheckChecks that an overriding
UnnecessaryParenthesesCheckChecks if unnecessary parentheses are used in a statement or expression. UnnecessarySemicolonAfterOuterTypeDeclarationCheckChecks if unnecessary semicolon is used after type declaration. UnnecessarySemicolonAfterTypeMemberDeclarationCheckChecks if unnecessary semicolon is used after type member declaration. UnnecessarySemicolonInEnumerationCheckChecks if unnecessary semicolon is in enum definitions. UnnecessarySemicolonInTryWithResourcesCheckChecks if unnecessary semicolon is used in last resource declaration. UnusedLocalVariableCheckChecks that a local variable is declared and/or assigned, but not used. UnusedLocalVariableCheck.TypeDeclDescMaintains information about the type declaration. UnusedLocalVariableCheck.VariableDescMaintains information about the variable. VariableDeclarationUsageDistanceCheckChecks the distance between declaration of variable and its first usage.
Enum Summary Enum Description RequireThisCheck.FrameTypeAn AbstractFrame type.