Inspectopedia Help

Redundant empty class

Reports empty classes and Java files without any defined classes.

A class is empty if it doesn't contain any fields, methods, constructors, or initializers. Empty classes often remain after significant changes or refactorings.

Configure the inspection:

  • Use the Ignore if annotated by option to specify special annotations. The inspection will ignore the classes marked with these annotations.

  • Use the Ignore class if it is a parametrization of a super type option to ignore classes that parameterize a superclass. For example:

    class MyList extends ArrayList<String> {}

  • Use the Ignore subclasses of java.lang.Throwable to ignore classes that extend java.lang.Throwable.

  • Use the Comments count as content option to ignore classes that contain comments.

Inspection options

Option

Type

Default

Ignore if annotated by

StringList

[]

Ignore class if it is a parameterization of a super type

Checkbox

false

Ignore subclasses of java.lang.Throwable

Checkbox

true

Comments count as content

Checkbox

true

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023