Should JavaDoc go before or after method level annotation?

What is the recommended place to host a JavaDoc for an annotated method? Before or after annotation?

@Test /** * My doc */ public void testMyTest(){ } 

OR

 /** * My doc */ @Test public void testMyTest(){ } 
+4
source share
2 answers

I do not think this is important, but the second format is better. annotations are part of the code and play an important role in their pattern of use. It is better to keep all the entries related to the code.

+7
source

The regular style seems to have a comment after the Javadoc comment.

The reason is because annotations are part of the code, not the documentation — why the documentation should be in between.

This may not be obvious to @Override and @Test , and of course there are documentation-related annotations as well. But technically, annotations are Java specific syntax code .

+4
source

Source: https://habr.com/ru/post/1446063/


All Articles