Turn off Java 17 doclint missing comment warning only for enums in Maven Javadoc Plugin

Viewed 28

I'm using Java 17 with Maven's Javadoc Plugin maven-javadoc-plugin:maven-javadoc-plugin:3.4.1 using mostly the default settings. Normally I want to be notified of missing comments (e.g. no @return), but particularly for enums this gets out of hand and isn't very useful.

Take definitions for the OpenGraph protocol as an illustration:

public enum PredefinedType {
  ACTIVITY, SPORT, BAR, COMPANY, CAFE, HOTEL, RESTAURANT, CAUSE, SPORTS_LEAGUE,
  SPORTS_TEAM, BAND, GOVERNMENT, NON_PROFIT, SCHOOL, UNIVERSITY, ACTOR, ATHLETE,
  AUTHOR, DIRECTOR, MUSICIAN, POLITICIAN, PROFILE, PUBLIC_FIGURE, CITY, COUNTRY,
  LANDMARK, STATE_PROVINCE, ALBUM, BOOK, DRINK, FOOD, GAME, MOVIE, PRODUCT, SONG,
  TV_SHOW, ARTICLE, BLOG, WEBSITE
}

Javadoc via the Maven Javadoc Plugin spits out lines and lines like this:

[WARNING] …\OpenGraph.java:…: warning: no comment
[WARNING] ACTIVITY, SPORT, BAR, COMPANY, CAFE, HOTEL …
[WARNING] ^

I am loathe to go through and add a useless comment to each of those. But I want to know if most other types of comments are missing.

How can I configure the Maven Javadoc Plugin doclint settings to ignore missing comments just for enum values? Or is there a way that I can indicate in code comments that the warning for a particular enum should be suppressed (as is possible for Checkstyle, for example)?

0 Answers
Related