Deepak Negi
Deepak Negi

Reputation: 119

Why am getting error from SONAR even after removing @override Annotation.?

Class A extends B{    
    protected void executeImpl(){
        super.executeImpl();
    }
}

Above class in being Injected in third class

Class C{

    A a;

    public void execute(){
    a.executeImpl()

    }

    }

ERROR: Description Assignee Resource New issue Useless Overriding Method : Overriding method merely calls super

Upvotes: 1

Views: 1424

Answers (1)

benzonico
benzonico

Reputation: 10833

The @Override annotation can only be added on inherited method. This does not mean that if you remove the annotation the method is not inherited anymore. It is still inherited ! And therefore the rule is still valid as it did not change the semantic of your program to remove the annoation.

Upvotes: 1

Related Questions