Affects PMD Version: 7.18.0
Rule: EmptyMethodInAbstractClassShouldBeAbstract
Description:
When overriding a method and making it final in an abstract class, this rule should not give a finding.
This is for example used to prevent a finalizer attack by overriding the finalize method and making the method final without having an implementation in the method body.
Code Sample demonstrating the issue:
package example;
public abstract class PMDTest {
public PMDTest() {
throw new RuntimeException();
}
@Override
protected final void finalize() {
// prevent finalizer attack
}
}
Expected outcome:
PMD reports a violation but that's wrong. That's a false positive.
Running PMD through: Gradle
Affects PMD Version: 7.18.0
Rule: EmptyMethodInAbstractClassShouldBeAbstract
Description:
When overriding a method and making it final in an abstract class, this rule should not give a finding.
This is for example used to prevent a finalizer attack by overriding the
finalizemethod and making the methodfinalwithout having an implementation in the method body.Code Sample demonstrating the issue:
Expected outcome:
PMD reports a violation but that's wrong. That's a false positive.
Running PMD through: Gradle