Useless Method Override

ID

java.useless_method_override

Severity

info

Remediation Complexity

auto_fix

Remediation Risk

low

Remediation Effort

low

Resource

Code Smell

Language

Java

Tags

code-style, unused-code

Description

Reports methods that override a parent method but only call super.method() with the same arguments in the same order. Such an override adds no behavior and can be safely removed.

Rationale

A method that merely delegates to its super implementation is dead weight. It increases code volume without adding behavior, makes refactoring harder, and can mislead readers into thinking the override does something special:

class Child extends Parent {
    @Override
    public void process(String s) {
        super.process(s);  // Adds nothing
    }
}

Remediation

Remove the override entirely; the parent method will be inherited automatically:

class Child extends Parent {
    // process(String) is inherited from Parent
}