What are benefits of using the @Deprecated notation on the interface only?
deprecated, java
Solution
I believe it's a shortcoming in the Java Language itself and it is nonsense to specify a method in an interface as deprecated via an annotation and not have the method considered deprecated in the implementing class.
It would be better if the @deprecated-ness of the method were inherited. Unfortunately, it seems Java does not support this.
Consider how tooling, such as an IDE, treats this situation: If the type of a variable is declared to be the interface, then @deprecated methods can be rendered with a strike through. But if the type of a variable is declared to be the implementing class and the class signature does not include @deprecated, then the method will be rendered without a strike through.
The fundamental question is: what does it MEAN for a method to be deprecated in an interface but not in an implementing class (or in an extending interface)? The only reasonable intention is for the method to be deprecated for everything below the interface in the class hierarchy. But the language does not support that behavior.
Problem
For Java programming, what are some benefits of using the @Deprecated notation on and interface method but not on the class that implements it? ``` public interface Joe { @Deprecated public void doSomething(); ... } public final class Joseph implements Joe { public void doSomething() { ... } ... } ```