Details of difference between @see and @inheritDoc

JavaJavadocComments

Java Problem Overview


I have looked over JavaDoc reference, and while I understand basic difference between @see (various links) and {@inheritDoc} (export of superclass JavaDoc comment), I need clarification on how things actually implemented.

In Eclipse IDE when I select “Generate Element Comments” for the inherited method (from interface, or toString() override, and so forth) it creates following comment

/* (non-Javadoc)
 * @see SomeClass#someMethod()
 */

If I am required to produce JavaDoc should I leave it at that, replace @see with {@inheritDoc}, or turn it in bona fide JavaDoc as such:

/**
 * {@inheritDoc}
 */

And when I do that, should I still keep the class#method flag?

Java Solutions


Solution 1 - Java

First of all, you should remove the original eclipse template because it is just noisy junk. Either put meaningful docs in or don't put anything at all. But useless restating of the obvious using IDE templates just clutters the code.

Second, if you are required to produce javadoc, then you have to make the comment start with /**. Otherwise, it's not javadoc.

Lastly, if you are overriding then you should use @inheritDoc (assuming you want to add to the original docs, as @seh noted in a comment, if you just want to duplicate the original docs, then you don't need anything). @see should only really be used to reference other related methods.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiontheUgView Question on Stackoverflow
Solution 1 - JavajtahlbornView Answer on Stackoverflow