Skip to content

Latest commit

 

History

History
16 lines (14 loc) · 637 Bytes

AbstractClassWithoutAnyMethod.md

File metadata and controls

16 lines (14 loc) · 637 Bytes

AbstractClassWithoutAnyMethod

Category: pmd
Rule Key: pmd:AbstractClassWithoutAnyMethod

⚠️ This rule is deprecated in favour of S1694.


If an abstract class does not provide any method, 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.

Example:

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