Is there a javadoc tag for documenting generic type parameters?

JavaJavadoc

Java Problem Overview


I've been looking through the javadoc documentation on Sun's site, trying to find if there's a javadoc tag which can be used to document a class or method's generic type signature.

Something like @typeparam, similar to the usual @param, but applicable to types as well as methods,e.g.

/**
 *  @typeparam T This describes my type parameter
 */
class MyClass<T> {
}

I suspect there is no such tag - I can find no mention of it anywhere, and the JavaSE API docs don't show any sign of it, but it seems like an odd omission. Can someone put me right?

Java Solutions


Solution 1 - Java

It should be done just like this:

/**
 * @param <T> This describes my type parameter
 */
class MyClass<T>{

}

Source

Solution 2 - Java

Yes. Just use the @param tag, and include angle brackets around the type parameter.

Like this:

/**
 *  @param <T> This describes my type parameter
 */

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
QuestionskaffmanView Question on Stackoverflow
Solution 1 - JavaTimo WillemsenView Answer on Stackoverflow
Solution 2 - JavaDave DiFrancoView Answer on Stackoverflow