JDK 9 RFR of 6481080 : (ann) @Deprecated annotation has no effect on packages

joe darcy joe.darcy at oracle.com
Wed Jan 7 21:16:44 UTC 2015


On 1/7/2015 1:44 AM, Paul Sandoz wrote:
> On Jan 7, 2015, at 12:12 AM, joe darcy <joe.darcy at oracle.com> wrote:
>
>> Hello,
>>
>> As part of cleaning up the deprecation facility in 9, please review this change to document when a @Deprecated annotation is a no-op:
>>
>>     6481080 : (ann) @Deprecated annotation has no effect on packages
>>     http://cr.openjdk.java.net/~darcy/6481080.0/
>>
> +1
>
> I am curious to know why @Deprecated was originally allowed to be declared on local variables and packages if it has no effect. I can imagine for the latter there might be some computational issue with javac and I suppose there is still some source code documentation value and other tools can still crunch on it.

Back in JDK 5 when annotations were added, the Deprecated annotation 
type was initially unconstrained in what it could be applied to (no 
@Target meta-annotation) [1]. I believe this was just a small oversight 
in part of the libraries work in 5.

A target list was added in 7 as an outgrowth of the JDK 308 work (to 
make sure Deprecated wasn't a TYPE_USE). [2] For compatibility, the 
target list included all the JDK 5-era values. [3]

HTH,

-Joe

[1] http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Deprecated.html

[2] https://bugs.openjdk.java.net/browse/JDK-6908218

[3] http://docs.oracle.com/javase/7/docs/api/java/lang/Deprecated.html



More information about the core-libs-dev mailing list