Is there a way to add references to one or more of a method's parameters from the method documentation body?
Something like:
/**
* When {@paramref a} is null, we rely on b for the discombobulation.
*
* @param a this is one of the parameters
* @param b another param
*/
void foo(String a, int b)
{...}
解决方案
As far as I can tell after reading the docs for javadoc there is no such feature.
Don't use foo
as recommended in other answers; you can use {@code foo}. This is especially good to know when you refer to a generic type such as {@code Iterator} -- sure looks nicer than Iterator<String>
, doesn't it!