What is the recommended place to put JavaDoc for a method with an annotation? Before or after the annotation?
@Test
/**
* My doc
*/
public void testMyTest(){
}
OR
/**
* My doc
*/
@Test
public void testMyTest(){
}
I don't think it matters but second format is better. annotations
are part of the code and play crucial role per their usage pattern. Better to keep all code related entries together.
The usual style seems to be to have the annotation after the Javadoc comment.
The reason is that the annotations are part of the code, not of the documentation - why should the documentation sit inbetween.
This may not be obvious for @Override
and @Test
, and of course there are documentation related annotations, too. But technically, annotations are Java code of a particular syntax.
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