Utility class without 'private' constructor
Reports utility classes without private
constructors.
Utility classes have all fields and methods declared as static
. Creating private
constructors in utility classes prevents them from being accidentally instantiated.
Use the Ignore if annotated by option to specify special annotations. The inspection ignores classes marked with one of these annotations.
Use the Ignore classes with only a main method option to ignore classes with no methods other than the main one.
Inspection options
Option | Type | Default |
---|---|---|
Ignore if annotated by | StringList | [] |
Ignore classes with only a main method | Checkbox | false |
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |
Last modified: 13 July 2023