Affects PMD Version:
6.16.0, 6.17.0
Rule:
MissingOverride
Description:
False positive for package-private method triggered by class extended in another package.
A package-private method cannot
be directly overridden by a method in a different package JLS 8.4.8.1.
The method in the derived class is not the inherited method and thus the rule should not flag it as needing an @OverRide annotation. Package-private methods can only be overridden by classes defined in the same package as the base class.
Code Sample demonstrating the issue:
package click;
public class CodeTalk {
public void doIt() {
printMessage();
}
void printMessage() {
System.out.println("Click");
}
}
package hack;
import click.CodeTalk;
public class TypeIt {
private static class ClickIt extends CodeTalk {
void printMessage() {
System.out.println("Hack");
}
}
public static void main(String[] args) {
ClickIt clickit = new ClickIt();
clickit.doIt();
}
}
Running PMD through: *[CLI | Ant] *
Affects PMD Version:
6.16.0, 6.17.0
Rule:
MissingOverride
Description:
False positive for package-private method triggered by class extended in another package.
A package-private method cannot
be directly overridden by a method in a different package JLS 8.4.8.1.
The method in the derived class is not the inherited method and thus the rule should not flag it as needing an @OverRide annotation. Package-private methods can only be overridden by classes defined in the same package as the base class.
Code Sample demonstrating the issue:
Running PMD through: *[CLI | Ant] *