resources.report.rules.pmd.AbstractClassWithoutAnyMethod.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sanity4j Show documentation
Show all versions of sanity4j Show documentation
Sanity4J was created to simplify running multiple static code
analysis tools on the Java projects. It provides a single entry
point to run all the selected tools and produce a consolidated
report, which presents all findings in an easily accessible
manner.
AbstractClassWithoutAnyMethod
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.
//ClassOrInterfaceDeclaration[
(@Abstract = 'true')
and
(count(//MethodDeclaration) + count(//ConstructorDeclaration) = 0)
]
Example(s):
public class abstract Example {
String field;
int otherField;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy