Inspectopedia 2025.2 Help

Empty class

Reports empty classes and empty Java files.

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

Example:

class Example { List<String> getList() { return new ArrayList<>() { }; } }

After the quick-fix is applied:

class Example { List<String> getList() { return new ArrayList<>(); } }

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

EmptyClass
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Java | Class structure

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

Here you can find the description of settings available for the Empty class inspection, and the reference of their default values.

Ignore if annotated by

Default value:

Empty
Ignore class if it is a parameterization of a super type

Default value:

Not selected
Ignore subclasses of java.lang.Throwable

Default value:

Selected
Comments count as content

Default value:

Selected

Suppressing Inspection

You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:

//noinspection EmptyClass

More detailed instructions as well as other ways and options that you have can be found in the product documentation:

Inspection Details

By default bundled with:

IntelliJ IDEA 2025.2, Qodana for JVM 2025.2,

Last modified: 18 September 2025