Thread.run is called where start was meant
What it finds
thread.run() runs the thread's task in the calling thread and returns when it is done; no new thread starts. thread.start() starts one.
Only receivers whose type is known to be java.lang.Thread are reported. A subclass of Thread may give run another meaning.
From the rule's source, thread_run.rs.
class Workers { void launch(Runnable task) { Thread worker = new Thread(task); worker.run();tx0 reports: worker.run() runs the task in the current thread new Thread(task).run();tx0 reports: new Thread(task).run() runs the task worker.start(); task.run(); }} Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/java:thread-run" = "off"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/java:thread-run] reason="..."tx0 explain tx0/java:thread-run shows the same in the terminal. Found a false positive? Report it.