1

In my checkstyle.xml file, I have javadoc summary enabled:

 <module name="SummaryJavadocCheck"/>

I have a class with following javadoc:

/**
 * @deprecated this class will be removed in future. Use {@link com.mypackage.myclass} instead
 */
@Deprecated(forRemoval = true)
public class MyDeprecatedClass {

I evaluate checkstyle via maven checkstyle plugin (3.1.0) or via CheckStyle-IDEA plugin (version 5.34.0). In the idea plugin, I specify checkstyle version 8.19.

Here's the error that I get:

MyDeprecatedClass.java : 1 item(s)
Summary javadoc is missing (13:0) [SummaryJavadoc]

1) Why is this rule violated? from the description of the SummaryJavadoc, default disallowed value is "empty"

2) How do I make it work? I don't really need a javadoc on this class, but I have to add @deprecated javadoc because of MissingDeprecated checkstyle rule.

Footnote: if I select checkstyle version 8.0 or lower, this error isn't shown.

Linus Fernandes
  • 498
  • 5
  • 30
Ubeogesh
  • 1,633
  • 2
  • 15
  • 22
  • `@deprecated` is just a tag. You are still missing a general description of your class. – VGR Dec 27 '19 at 15:56
  • How do I work around this? I don't want to write some summary for a deprecated class. – Ubeogesh Dec 30 '19 at 07:14
  • 2
    Disable the rule, write a summary, or ignore the checkstyle warning. Those are your options. – JB Nizet Dec 30 '19 at 07:25
  • Just write the summary anyway. It only needs to be one or two sentences. I have to believe it will take you less time to write than it took to write this Stack Overflow question. You can always copy the description from the replacement class the deprecation links to. For what it’s worth, deprecated classes in Java SE still have their descriptions, for example [this](https://docs.oracle.com/en/java/javase/13/docs/api/java.base/java/util/Observer.html) and [this](https://docs.oracle.com/en/java/javase/13/docs/api/java.base/java/io/StringBufferInputStream.html). – VGR Dec 30 '19 at 12:37

0 Answers0