I have following method with generic types, but when I run maven checkstyle(maven-checkstyle-plugin, 2.121) it
kept gives me Expected @param tag for '<T>'
error message during maven build. How do I get over with this?
/**
* Read in specified type of object from request body.
* @param request The HttpServletRequest
* @param expected The expected type T
* @return <T> specified type of object
*/
public <T extends Object> T getExpectedValue(
final HttpServletRequest request, final Class<T> expected)
I used following to turn generic param tag off, but it didn't work and I have above mentioned java doc as well.
<module name="JavadocType">
<property name="allowMissingParamTags" value="true"/>
</module>
It is telling you that you did not write the javadoc for the method type parameter:
/**
* ...
* @param <T> This is the type parameter
* @param ....
*/
public <T extends Object> T getExpectedValue(
final HttpServletRequest request, final Class<T> expected)
the produced javadoc will include a section like the following in the header:
Type Parameters:
T - This is the type parameter
You add an @param
tag for T to your Javadoc.
Something like this:
/**
* ... other comments here ...
* @param T The expected class of the value.
* @param request ... other comments here ...
* @param expected ... other comments here ...
* @return ... other comments here ...
*/
public <T extends Object> T getExpectedValue(
final HttpServletRequest request, final Class<T> expected)
If you aren't using Javadoc, then you probably shouldn't have Javadoc warnings enabled.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With