Affects PMD Version: 7.20.0
Rule:UselessOverridingMethod
Description:
The rule UselessOverridingMethod fails to detect redundant overrides when the super call is wrapped inside an additional nested block (braces {}).
Code Sample demonstrating the issue:
public class UselessOverrideBug {
// Scenario A: Standard useless override (PMD reports this correctly)
public static class ClassA {
@Override
public String toString() {
return super.toString();
}
}
// Scenario B: Useless override wrapped in nested blocks (FN - PMD misses this)
public static class ClassB {
@Override
public String toString() {
{ // Extra block level 1
return super.toString();
}
}
}
}
Expected outcome:
PMD should report a violation for both ClassA and ClassB at their respective toString method declarations, as both methods do nothing but call the superclass implementation.This is a false-negative.
Running PMD through: CLI
Affects PMD Version: 7.20.0
Rule:UselessOverridingMethod
Description:
The rule UselessOverridingMethod fails to detect redundant overrides when the super call is wrapped inside an additional nested block (braces {}).
Code Sample demonstrating the issue:
Expected outcome:
PMD should report a violation for both ClassA and ClassB at their respective toString method declarations, as both methods do nothing but call the superclass implementation.This is a false-negative.
Running PMD through: CLI