When Javadoc'ing, I don't know whether you should explicitly say whether the parameters are of type String
or int
. For example
/**
* This method does something
* @param foo an object of type Foo
* @param abc the number of doors, of type int
* @return the number of windows, of type int
*/
public int doSomething(Foo foo, int abc) {
// Do something
}
I use eclipse, so when I look at the user end of a Javadoc, everything has a type description, and eclipse tells me when I used the wrong type reference.
So, should I include type descriptions as above, or does Javadoc/compiler take care of that for me?
No, there's no need, the JavaDoc tool parses the Java code and gets the types from there.
This article on the Oracle Java site may be useful: How to Write Doc Comments for the Javadoc Tool
From the
@param
part of that article:...which sounds like it disagrees with my statement above. That's just poor writing, as the examples it then gives make clear:
It's also clear from the detailed examples.