codestyle; put javadoc before or after annotation?

前端 未结 5 1960
误落风尘
误落风尘 2020-12-07 19:17

I know that it isn\'t the most vital of issues, but I just realised that I can put the javadoc comment block before or after the annotation. What would we want to adopt as a

5条回答
  •  天涯浪人
    2020-12-07 20:00

    Before the annotation, since the annotation is code that "belongs" to the class. See examples with javadoc in the official documentation.

    Here's random example I found in another official Java page:

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

提交回复
热议问题