javac may need to be changed in order to distinguish between **calling** a deprecated method and **subclassing/overriding** a deprecated method.
A suitable annotation that distinguishes these usages hasn't yet been proposed, but the need for it is forseeable.
Consider the following example. (Note that the deprecation syntax for this is merely a straw-man.)
====================
public class A {
@Deprecated
public void foo() { }
@Deprecated(OVERRIDE)
public void bar() { }
}
class B {
void x(A a) {
a.foo(); // should issue a deprecation warning
a.bar(); // should NOT issue a deprecation warning
}
}
class C extends A {
void y(A a) {
a.foo(); // should issue a deprecation warning
a.bar(); // should NOT issue a deprecation warning
}
void z() {
super.foo(); // should this issue a deprecation warning?
super.bar(); // should this issue a deprecation warning?
@Override
public void bar() { // definitely should issue a deprecation warning
}
}
====================
The idea is that it should be possible to deprecate something from being subclassed and overridden, but to continue to allow ordinary calls to the method without warnings.
One way to look at this is that an override-deprecation announces intent to make a method final. This allows direct calls and calls through super but not overriding. In this model the only warning issued for bar() in the above example would be the override in class C.
Scala has some kind of override-deprecation annotation (need to dig up link). It might not be public though. The intent is as above, to make a method final in a future release.