A RetroSearch Logo

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

Search Query:

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

[apex] ExcessivePublicCount doesn't consider inner classes correctly · Issue #4509 · pmd/pmd · GitHub

Affects PMD Version: 6.x

Rule: ExcessivePublicCount

Description:

The rule counts all methods of a file regardless whether they belong to the same class or not. If you have a file with multiple (inner) classes, then all classes are considered as a single class. This is wrong - the inner classes should be considered separate.

This bug has been fixed with PMD 7.0.0 already.

Found via #3123.

Code Sample demonstrating the issue:

public virtual class OuterClass {
  public virtual class InnerClass1 {
    public virtual void method1() {}
  }

  public virtual class InnerClass2 {
    public virtual void method1() {}
  }

}

Expected outcome:
PMD should count 1 method for each class. But currently, it counts 2 methods for OuterClass, which is wrong.


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