UnusedAnonymousClass
Instance created but never used

Category
Severity
ERROR
Maturity

The problem

Creating a side-effect-free anonymous class and never using it is usually a mistake.

For example:

public static void main(String[] args) {
  new Thread(new Runnable() {
    @Override public void run() {
      preventMissionCriticalDisasters();
    }
  }); // did you mean to call Thread#start()?
}

Suppression

Suppress false positives by adding an @SuppressWarnings("UnusedAnonymousClass") annotation to the enclosing element.