Redundant final on Private Method

ID

java.final_on_private_method

Severity

info

Remediation Complexity

medium

Remediation Risk

low

Remediation Effort

medium

Resource

Code Smell

Language

Java

Tags

code-style

Description

Reports methods that are both private and final.

Rationale

Private methods are not visible to subclasses and therefore cannot be overridden. Applying final to a private method is redundant and suggests the author may have confused visibility semantics. The unnecessary modifier adds noise to the declaration.

// Bad -- final is redundant on a private method
private final void initialize() {
    // ...
}

Remediation

Remove the final modifier from the private method.

// Good
private void initialize() {
    // ...
}