All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.pmd.rules.pmd.AvoidProtectedMethodInFinalClassNotExtending.html Maven / Gradle / Ivy

There is a newer version: 4.0.3
Show newest version
Do not use protected methods in most final classes since they cannot be subclassed. This should
only be allowed in final classes that extend other classes with protected methods (whose
visibility cannot be reduced). Clarify your intent by using private or package access modifiers instead. Example:
public final class Foo {
  private int bar() {}
  protected int baz() {} // Foo cannot be subclassed, and doesn't extend anything, so is baz() really private or package visible?
}

This rule is deprecated, use {rule:java:S2156} instead.





© 2015 - 2025 Weber Informatics LLC | Privacy Policy