Search code examples
javacoding-styleannotationsjavadoc

Should JavaDoc go before or after a method-level annotation?


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(){

}

Solution

  • 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.