Declarative Programming in Java
Subject:   <code>Deprecated</code> annotation
Date:   2004-05-01 18:29:17
From:   pmattos
Just a minor question: Shouldn't the Deprecated annotation have a retention policy of CLASS instead of SOURCE? If not, how the compiler will warn about deprecated elements when you compiling your code againt raw .class files?

Congrats on the excellent article.

Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • <code>Deprecated</code> annotation
    2004-05-01 19:34:27  Narayanan Jayaratchagan [View]

    Class file format already has a way to mark elements with deprecated
    attribute. You may want to check href="">VM
    for more information on the deprecated attribute.

    The Deprecated annotation is intended to be used by the compiler which
    has access to the source code so its marked as a source level
    annotation. The compiler generates the class file with the deprecated attribute
    as mentioned above.

    Even the JSR 175 specification says that the deprecation facility was
    implemented in an ad hoc fashion using documentation comments, but could
    have been implemented atop a program annotation facility, had one
    existed at the time the deprecation facility was designed.

    Hope this answers your question.