Why is this an issue?

The default implementation of java.lang.Thread 's run will only perform a task passed as a Runnable. If no Runnable has been provided at construction time, then the thread will not perform any action.

When extending java.lang.Thread, you should override the run method or pass a Runnable target to the constructor of java.lang.Thread.

Noncompliant code example

public class MyThread extends Thread { // Noncompliant
  public void doSomething() {
    System.out.println("Hello, World!");
  }
}

How to fix it

To fix this issue, you have 2 options:

public class MyThread extends Thread {
  @Override
  public void run() {
    System.out.println("Hello, World!");
  }
}
public class MyRunnable implements Runnable {
  @Override
  public void run() {
    System.out.println("Hello, World!");
  }
}
public class MyThread extends Thread {
  public MyThread(Runnable runnable) {
    super(runnable);
  }
}

public class Main() {
  public static void main(String [] args) {
    Runnable runnable = new MyRunnable();
    Thread customThread = new MyThread(runnable);
    Thread regularThread = new Thread(runnable);
  }
}