
Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/
> > The thing is, that if I left the method abstract, I'm forced to
> > implement it, so the deprecation does not have any effect.
>
> It has effect for clients of the class.
Surely. That's whom the @deprecated tag is meant to be.
> However, deprecation is not inherited. For instance, IIRC, for a long
> time Component.show was deprecated but Window.show was not.
As for JDK 1.4.2, it is not deprecated. This is the root of the problem
and
here I point a difference between what I want to do and what is done in
the
AWT library.
1) It seems to me that in AWT, they wanted that Window.show() not to be
deprecated, or either they forgot to deprecate it because of the
limitations
of the deprecation mechanism.
2) In class Component, the show() method is not abstract.
> > But if I remove the abstract clause, I'm changing the method signature,
>
> The deprecated flag is not part of the signature.
It's true, but the abstract keyword in the method signature is.
I think that the actual problem here is that current compilers don't
show a
warning when a subclass override deprecated methods (either abstract or
not)
or implement them (when they are declared in an interface)
I think it would be nice to have such a feature in the compiler...
Gabriel
Thomas Hawtin - 11 Apr 2006 06:58 GMT
>>> The thing is, that if I left the method abstract, I'm forced to
>>> implement it, so the deprecation does not have any effect.
[quoted text clipped - 15 lines]
> of the deprecation mechanism.
> 2) In class Component, the show() method is not abstract.
In this particular case "they" seem to have been a bit schizophrenic
about what to do about it.
Bug 4090395, "show() is not flagged as deprecated", 03-NOV-1997, Closed,
not a bug.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4090395
Bug 4689044, "Window.hide() and Window.show() should be deprecated",
21-MAY-2002, Closed, fixed.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4689044
>>> But if I remove the abstract clause, I'm changing the method signature,
>> The deprecated flag is not part of the signature.
>
> It's true, but the abstract keyword in the method signature is.
Nor the abstract flag. (Code compiled referencing a class that uses a
non-abstract method but run with an a version that is abstract, will
dynamically link but throw an AbstractMethodError when the method is
called.)
Therefore, you can safely make an abstract method non-abstract.
> I think that the actual problem here is that current compilers don't
> show a
[quoted text clipped - 3 lines]
>
> I think it would be nice to have such a feature in the compiler...
There are loads of bugs in the Bug Parade related to this. 1.6 currently
does complain. Perhaps there should be a new annotation to state that a
method may override/implement a deprecated method.
@SuppressWarnings("deprecation") works in 1.6, but is heavy-handed as
you don't want it applied to the method body (well, unless it has a
super call).
Tom Hawtin

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/