Skip to:
Rule S2438 should raise an issue each time a Thread is passed where a Runnable is expected. In this example, the rule fails to raise any issue:
Thread
Runnable
try (ExecutorService executor = Executors.newFixedThreadPool(10)) { Runnable iAmActuallyAThread = new Thread(() -> {}); executor.execute(iAmActuallyAThread); // FN }
The logic of the rule here is “lazy” and does not check if it can resolve more explicitly the actual type of the argument being passed.
Useful links:
RSPEC: https://sonarsource.github.io/rspec/#/rspec/S2438
Legacy RSPEC ticket: https://sonarsource.atlassian.net/browse/RSPEC-2438#icft=RSPEC-2438
Rule S2438 should raise an issue each time a
Thread
is passed where aRunnable
is expected.In this example, the rule fails to raise any issue:
try (ExecutorService executor = Executors.newFixedThreadPool(10)) { Runnable iAmActuallyAThread = new Thread(() -> {}); executor.execute(iAmActuallyAThread); // FN }
The logic of the rule here is “lazy” and does not check if it can resolve more explicitly the actual type of the argument being passed.