Uses of Class
net.sourceforge.pmd.lang.java.rule.AbstractJavaRule
Packages that use AbstractJavaRule
Package
Description
Contains the built-in rules bundled with the Java distribution.
-
Uses of AbstractJavaRule in net.sourceforge.pmd.lang.java.rule
Subclasses of AbstractJavaRule in net.sourceforge.pmd.lang.java.ruleModifier and TypeClassDescriptionclassBase class for rules using the rulechain. -
Uses of AbstractJavaRule in net.sourceforge.pmd.lang.java.rule.bestpractices
Subclasses of AbstractJavaRule in net.sourceforge.pmd.lang.java.rule.bestpracticesModifier and TypeClassDescriptionclassclass1.classclassIf a method or constructor receives an array as an argument, the array should be cloned instead of directly stored.classclassclassclassclassRule that verifies, that the return values of next(), first(), last(), etc.classclassCheck that log.debug, log.trace, log.error, etc... statements are guarded by some test expression on log.isDebugEnabled() or log.isTraceEnabled().classclassDeprecated.classDeprecated.The rule was renamedUnitTestContainsTooManyAssertsRuleclassDeprecated.The rule was renamedUnitTestShouldIncludeAssertRuleclassThis rule finds code like this:classclassclassImplementation note: this rule currently ignores return types of y.x.z, currently it handles only local type fields.classFlags missing @Override annotations.classclassclassDetects constructors and methods that use the JVM's default character set instead of explicitly specifying a charset.classclassclassclassclassclassclassclassclassclassThis rule detects private methods, that are not used and can therefore be deleted.classDetect structures like "foo.size() == 0" and suggest replacing them with foo.isEmpty().classDetect cases where EnumSet and EnumMap can be used.final class -
Uses of AbstractJavaRule in net.sourceforge.pmd.lang.java.rule.codestyle
Subclasses of AbstractJavaRule in net.sourceforge.pmd.lang.java.rule.codestyleModifier and TypeClassDescriptionclassThis rule detects non-static classes with no constructors; requiring even the default constructor to be explicit.classConfigurable naming conventions for type declarations.classCheck for Methods, Fields and Nested Classes that have a default access modifier This rule ignores all nodes annotated with @VisibleForTesting by default.classif (x !classclassDetects fields that are declared after methods, constructors, etc.classConfigurable naming conventions for field declarations.final classEnforces a naming convention for lambda and method parameters.classFlags identical catch branches, which can be collapsed into a multi-catch.classclassclassfinal classEnforces a naming convention for local variables and other locally scoped variables.classclassclassclassclassChecks for variables in methods that are defined before they are really needed.classConfigurable naming conventions for type parameters.classclassDetects casts where the operand is already a subtype of the context type, or may be converted to it implicitly.classThis rule detects when a constructor is not necessary; i.e., when there is only one constructor, it’s public, has an empty body, and takes no arguments.classclassDetects unnecessary imports.classDeprecated.Since 7.17.0.classclassclassChecks usages of explicit type arguments in a constructor call that may be replaced by a diamond (<>).final classclass -
Uses of AbstractJavaRule in net.sourceforge.pmd.lang.java.rule.design
Subclasses of AbstractJavaRule in net.sourceforge.pmd.lang.java.rule.designModifier and TypeClassDescriptionclassclassAvoid rethrowing exceptions unless there's a subsequent catch clause that handles a superclass of the exception being rethrown.classFindsthrowstatements containingNullPointerExceptioninstances as thrown valuesclassclassCognitive complexity rule.classCouplingBetweenObjects attempts to capture all unique Class attributes, local variables, and return types to determine how many objects a class is coupled to.classCyclomatic complexity rule using metrics.classclassCatches the use of exception statements as a flow control device.classExcessiveImports attempts to count all unique imports a class contains.classThis rule detects an abnormally long parameter list.classRule attempts to count all public methods and public attributes defined in a class.classclassThe God Class Rule detects the God Class design flaw using metrics.classclassclassThis rule can detect possible violations of the Law of Demeter.classThe loose package coupling Rule can be used to ensure coupling outside of a package hierarchy is minimized to all but an allowed set of classes from within the package hierarchy.final classSimple rule for Ncss.classSimple n-path complexity rule.classA method/constructor shouldn't explicitly throw java.lang.Exception, since it is unclear which exceptions that can be thrown from the methods.classclassclassA singular field is a field that may be converted to a local variable.classSwitch Density - This is the number of statements over the number of cases within a switch.classclass -
Uses of AbstractJavaRule in net.sourceforge.pmd.lang.java.rule.documentation
Subclasses of AbstractJavaRule in net.sourceforge.pmd.lang.java.rule.documentationModifier and TypeClassDescriptionclassA rule that checks for illegal words in the comment text.classclassA rule to manage those who just can't shut up...classLooks for Javadoc that doesn't belong to any particular class, method or field. -
Uses of AbstractJavaRule in net.sourceforge.pmd.lang.java.rule.errorprone
Subclasses of AbstractJavaRule in net.sourceforge.pmd.lang.java.rule.errorproneModifier and TypeClassDescriptionclassclassclassclassclassclassclassclassThe method clone() should only be implemented if the class implements the Cloneable interface with the exception of a final method that only throws CloneNotSupportedException.classMakes sure you close your database connections.classDetects method calls on collections where the passed object cannot possibly be in the collection due to type mismatch.classfinal classSearches through all methods and constructors called from constructors.classclassclassDetects conditional expressions and statements where both branches are equal.classclassclassclassclassclassclassRule that checksComparableclasses for proper equals/hashCode implementations.classclassclassReturns Checks if the singleton rule is used properly.classclassclassclassclassAn operation on an Immutable object (String, BigDecimal or BigInteger) won't change the object itself.classReports usages of pure methods where the result is ignored. -
Uses of AbstractJavaRule in net.sourceforge.pmd.lang.java.rule.internal
Subclasses of AbstractJavaRule in net.sourceforge.pmd.lang.java.rule.internalModifier and TypeClassDescriptionclassnet.sourceforge.pmd.lang.java.rule.internal.AbstractIgnoredAnnotationRuleclassnet.sourceforge.pmd.lang.java.rule.internal.AbstractJavaCounterCheckRule<T extends JavaNode>Abstract class for rules counting the length of some node. -
Uses of AbstractJavaRule in net.sourceforge.pmd.lang.java.rule.multithreading
Subclasses of AbstractJavaRule in net.sourceforge.pmd.lang.java.rule.multithreadingModifier and TypeClassDescriptionclassvoid method() { if (x == null) { synchronized(this){ if (x == null) { x = new | method(); } } } }classclassUsing a Formatter (e.g. -
Uses of AbstractJavaRule in net.sourceforge.pmd.lang.java.rule.performance
Subclasses of AbstractJavaRule in net.sourceforge.pmd.lang.java.rule.performanceModifier and TypeClassDescriptionclassclassThis rule finds the following:classclassRule that marks instantiations of newBigIntegerorBigDecimalobjects, when there is a well-known constant available, such asBigInteger.ZERO.classclassThis rule finds concurrent calls to StringBuffer/Builder.append where String literals are used.classThis rule finds code which inefficiently determines empty strings.classHow this rule works: find additive expressions: + check that the addition is between anything other than two literals if true and also the parent is StringBuffer constructor or append, report a violation.classThis rule finds StringBuffers which may have been pre-sized incorrectly.classDetects redundant field initializers, i.e. the field initializer expressions the JVM would assign by default.classclassclassclass -
Uses of AbstractJavaRule in net.sourceforge.pmd.lang.java.rule.security
Subclasses of AbstractJavaRule in net.sourceforge.pmd.lang.java.rule.securityModifier and TypeClassDescriptionclassFinds hard coded encryption keys that are passed to javax.crypto.spec.SecretKeySpec(key, algorithm).classFinds hardcoded static Initialization Vectors vectors used with cryptographic operations.
UnitTestAssertionsShouldIncludeMessageRule