All Downloads are FREE. Search and download functionalities are using the official Maven repository.

resources.report.rules.pmd.AbstractClassWithoutAnyMethod.html Maven / Gradle / Ivy

Go to download

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.

The newest version!


AbstractClassWithoutAnyMethod


AbstractClassWithoutAnyMethod

If the abstract class does not provides any methods, it may be just a data container that is not to be instantiated. In this case, it's probably better to use a private or a protected constructor in order to prevent instantiation than make the class misleadingly abstract.

This rule is defined by the following XPath expression:

                    
//ClassOrInterfaceDeclaration[
	(@Abstract = 'true')
	and
	(count(//MethodDeclaration) + count(//ConstructorDeclaration) = 0)
]
                    
                

Example:

                
            
public class abstract Example {
	String field;
	int otherField;
}
            
        
            




© 2015 - 2024 Weber Informatics LLC | Privacy Policy