The override method only calls the parent method - useful?

I was browsing the old code base, and I found a method that only calls its parent:

@Override public void select(Object item) { super.select(item); } 

Will there be any precedent for such a method? To me, it looks like I could just delete it.

+6
source share
2 answers

Removing this will hardly change. You will see the difference when using reflection and searching for the select method on the object. If you ask to tell not to look in the base class of the object, it will not find the method after deleting it.

+7
source

Yes, this method can be removed without changing the logic of your code.

Perhaps he had another implementation that was removed or should have had another implementation that was never written.

+5
source

Source: https://habr.com/ru/post/983595/


All Articles