Why is this an issue?
Once deprecated, classes, and interfaces, and their members should be avoided, rather than used, inherited or extended. Deprecation is a warning
that the class or interface has been superseded, and will eventually be removed. The deprecation period allows you to make a smooth transition away
from the aging, soon-to-be-retired technology.
Noncompliant code example
/**
* @deprecated As of release 1.3, replaced by {@link #Fee}
*/
@Deprecated
public class Fum { ... }
public class Foo {
/**
* @deprecated As of release 1.7, replaced by {@link #doTheThingBetter()}
*/
@Deprecated
public void doTheThing() { ... }
public void doTheThingBetter() { ... }
}
public class Bar extends Foo {
public void doTheThing() { ... } // Noncompliant; don't override a deprecated method or explicitly mark it as @Deprecated
}
public class Bar extends Fum { // Noncompliant; Fum is deprecated
public void myMethod() {
Foo foo = new Foo(); // okay; the class isn't deprecated
foo.doTheThing(); // Noncompliant; doTheThing method is deprecated
}
}
Resources