2015-05-14 9 views
11

Ho seguito il metodo con i tipi generici, ma quando ho eseguito Maven checkstyle (Maven-checkstyle-plugin, 2.121) è mantenuto mi dà Expected @param tag for '<T>' messaggio di errore durante Maven build. Come faccio a superare questo?Maven errore checkstyle: tag @param Previsto per '<T>'

/** 
* 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) 

Ho usato il comando seguente per disattivare il tag param paramico, ma non ha funzionato e ho anche accennato a java doc.

<module name="JavadocType"> 
    <property name="allowMissingParamTags" value="true"/> 
</module> 
+1

Sai è un avvertimento Javadoc, giusto? Si sta dicendo che non si dispone di Javadoc per T. – immibis

+0

Se si desidera disabilitare allowMissingParamTags, è necessario utilizzare il modulo JavadocMethod anziché JavadocType. Documento: http://checkstyle.sourceforge.net/config_javadoc.html – zappee

risposta

11

E vi sta dicendo che non hai scritto il javadoc per il parametro tipo di metodo:

/** 
* ... 
* @param <T> This is the type parameter 
* @param .... 
*/ 
public <T extends Object> T getExpectedValue(
     final HttpServletRequest request, final Class<T> expected) 

javadoc prodotto includerà una sezione come la seguente nell'intestazione:

Type Parameters: 
    T - This is the type parameter 
+1

ma non hai linea suggerisco di aggiungere nella mia risposta –

+0

Devo aggiungere il tuo documento java in aggiunta o sostituire una linea che ho? Potresti farmi sapere quale linea è sbagliata? – user2482822

+1

non hai linee sbagliate, è in aggiunta; è la documentazione del parametro del tipo di metodo, che integra il doc degli argomenti e il ritorno (che hai già) –

3

Aggiungi un tag @param per T al tuo Javadoc.

Qualcosa di simile a questo:

/** 
* ... 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) 

Se non sono usando Javadoc, allora probabilmente non dovrebbe avere avvertimenti Javadoc abilitati.

+0

Potresti controllare il mio documento java che avevo? – user2482822

Problemi correlati