我知道这不是最重要的问题,但我刚刚意识到我可以将 javadoc 注释块放在注释之前或之后。我们希望采用什么作为编码标准?
/** * This is a javadoc comment before the annotation */ @Component public class MyClass { @Autowired /** * This is a javadoc comment after the annotation */ private MyOtherClass other; }
在注解之前,因为注解是“属于”类的代码。请参阅官方文档中的javadoc 示例。
这是我在另一个官方 Java 页面中找到的随机示例:
/** * Delete multiple items from the list. * * @deprecated Not for public use. * This method is expected to be retained only as a package * private method. Replaced by * {@link #remove(int)} and {@link #removeAll()} */ @Deprecated public synchronized void delItems(int start, int end) { ... }