When do I use @see
when dealing with JavaDocs? What is its usage?
For example if MethodA
calls MethodB
then do I have to put @see
in MethodB
's javadoc and reference MethodA
because that is what called it, or do I have to put a reference to MethodB
from MethodA
because it's calling it. I've read the stuff about @see
on the Oracle website and it seems to me to be incredibly vague, it says it means "see also" but not really what that means!
I use @see to annotate methods of an interface implementation class where the description of the method is already provided in the javadoc of the interface. When we do that I notice that Eclipse pulls up the interface's documentation even when I am looking up method on the implementation reference during code complete
The @see
tag is a bit different than the @link
tag,
limited in some ways and more flexible in others:
@see
items, commas in the description make the output confusingSee the results below:
JavaDoc generation results with different link types
Best regards.
@see is useful for information about related methods/classes in an API. It will produce a link to the referenced method/code on the documentation. Use it when there is related code that might help the user understand how to use the API.
A good example of a situation when @see
can be useful would be implementing or overriding an interface/abstract class method. The declaration would have javadoc
section detailing the method and the overridden/implemented method could use a @see
tag, referring to the base one.
Related question: Writing proper javadoc with @see?
Java SE documentation: @see
Source: Stackoverflow.com