Search code examples
javajavadocjava-annotations

What does `@SuppressWarnings("javadoc")` do? When is it Redundant?


I have @SuppressWarnings("javadoc") on almost every class. My IDE gives me a warning on virtually all of them: "Redundant suppression". I assume advances in technology have made this annotation obsolete, but would like to understand what this annotation did in the first place. I could not find anything helpful. Apparently it suppresses compiles warnings, but I couldn't find anything on the argument "javadoc". And my code does compile, why would javadoc stand in the way of compiling anyway?


Solution

  • @SuppressWarnings("javadoc") suppresses warnings about wrong javadoc, e.g. missing @param descriptions. An IDE will highlight such errors. This highlighting can be suppressed with @SuppressWarnings("javadoc"). The annotation is redundant when there are no such errors in the javadoc of a class. If the annotation is not redundant and removed new warnings will show up detailing the javadoc errors.