Checker UnusedClass   as of Julia version 2.6.0 (built on 6 Sep 2018)

belongs to group Basic

Identify unused classes

Classes that are defined in a project but never used are possibly legacy code, that could be removed or left in the version control system only. This would clean the project and avoid spurious code. Moreover, in some cases an unused class might be the sign of a bug, if the programmer expected it to be used.

Action: Remove the class from the program and simplify the code. Verify why the class is not used, when you expect it to be.


Consider the following program:

public class Runner {

  interface Task {
    void go();

  static abstract class SubTask implements Task {
    private static int goCounter;

    public final void go() {

    protected abstract void goImpl();

    public static int howManyRuns() {
      return goCounter;
  public static void main(String[] args) {
    new Task() {

      public void go() {
        System.out.println("I'm running");

This checker issues the following warning: [UnusedClass: UnusedClassWarning] Class Runner$SubTask is not used

since the inner abstract class Runner$Subtask is defined but never used in the code and could hence be removed. Note that the inner interface Runner$Task is used instead, since an anonymous subclass is defined and created (used) in method main().