Checkstyle 没有检测到空的 javadoc 注释

Checkstyle does not detect empty javadoc comment

你能帮我配置 Checkstyle 以在 javadoc 注释为空时警告我吗?

Checkstyle dest 在以下情况下不会警告我(javadoc 注释完全缺失):

/**
 *
 */
public enum MyType{ EQUALS }

我已经查看了文档 here,但我没有看到与此问题相关的任何内容。

为此,您可以使用 Javadoc Comments 部分中的 Style Javadoc Checkstyle 模块。来自 Checkstyle documentation on Style Javadoc:

Validates Javadoc comments to help ensure they are well formed. The following checks are performed:

  • Ensures the first sentence ends with proper punctuation (That is a period, question mark, or exclamation mark, by default). Javadoc automatically places the first sentence in the method summary table and index. Without proper punctuation the Javadoc may be malformed. All items eligible for the {@inheritDoc} tag are exempt from this requirement.
  • Check text for Javadoc statements that do not have any description. This includes both completely empty Javadoc, and Javadoc with only tags such as @param and @return.

确保选中 checkEmptyJavadoc 复选框: