Typically, when you override a method, you stick to the contract defined in the base class / interface, so you don't want to change the original javadoc. Therefore, the use of the @inheritDoc or @see tag mentioned in other answers is not required and in fact serves only as noise in the code. All reasonable tools inherit the javadoc method from a superclass or interface, as indicated here :
Inherit from classes and interfaces - Inheriting of comments occurs in all three possible cases of inheritance from classes and interfaces: - When a method in a class overrides a method in a superclass - When a method in an interface overrides a method in a superinterface - When a method in a class implements a method in an interface
The fact that some tools (I'm looking at you, Eclipse!) Generate them by default when overriding a method is just a sad state of things, but does not justify cluttering your code with useless noise.
Of course, there may be the opposite case when you really want to add a comment to the override method (as a rule, some additional implementation details or more stringent contract conditions). But in this case, you almost never want to do something like this:
/** * {@inheritDoc} * * This implementation is very, very slow when b equals 3. */
Why? Because an inherited comment can be very long. In that case, who will notice the additional sentence at the end of the three long paragraphs? Instead, just write a slice of your own comment and that’s it. All javadoc tools always show some link by link, which you can click to read the comment on the base class. It makes no sense to mix them.
Natix Oct 11 '16 at 15:41 2016-10-11 15:41
source share