A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/2189 below:

False positive when casting to derived class · Issue #2189 · pmd/pmd · GitHub

#2160 (comment)

Affects PMD Version:
6.20.0
Rule:
LawOfDemeter
Description:
Casting to derived class triggers method chaining error for this rule.
Code Sample demonstrating the issue:

package pmdtests;


  class TaskManager {
   
    private final List<ForkJoinTask<Integer>> tasks;

  
    public void cancelTasks(ForkJoinTask<Integer> cancelTask) {
      for (ForkJoinTask<Integer> task : tasks) {
        if (!task.equals(cancelTask)) {
          task.cancel(true);
          ((SearchNumberTask) task).writeCancelMessage();
        }
      }
    }
}
 

Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4