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<>();
    }
  }

Configure the inspection: