Deprecation should be made using both the @Deprecated Java language annotation and @deprecated Javadoc tag. The annotation enables tools such as IDEs to warn about referencing deprecated elements, and the tag can be used to explain when it was deprecated, why, and how references should be refactored.

The following code illustrates this rule:

class MyClass {

  @Deprecated             // Non-Compliant
  public void foo1() {
  }

  /**
    * @deprecated
    */
  public void foo2() {    // Non-Compliant
  }

  /**
    * @deprecated
    */
  @Deprecated
  public void foo3() {    // Compliant
  }

}