-
Bug
-
Resolution: Fixed
-
P4
-
6
-
b46
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8084116 | emb-9 | Joe Darcy | P4 | Resolved | Fixed | team |
"A program element annotated @Deprecated is one that programmers are discouraged from using, typically because it is dangerous, or because a better alternative exists. Compilers warn when a deprecated program element is used or overridden in non-deprecated code."
Packages are program elements (as implicitly defined by the ElementType enum) and the @Deprecated annotation does not have a @Target meta-annotation that prevents it from being applied to packages. So the second quoted sentence above says the compiler will warn if you use a package that is deprecated. This is done by adding a @Deprecated annotation to the package declaration in a package-info.java in the package directory. But it does not in fact have any effect.
The meaning of "using" a package is clear. Referencing any class within a package is a use of the package, just as referencing any field or method in a class is a use of the class and will draw a warning if the class is deprecated.
Either the compiler should issue warnings when a deprecated package is referenced, or the quoted text should be modified.
- backported by
-
JDK-8084116 (ann) @Deprecated annotation has no effect on packages
-
- Resolved
-
- csr of
-
CCC-6481080 (ann) @Deprecated annotation has no effect on packages
-
- Closed
-
- relates to
-
JDK-8141099 [javadoc] Remove support for @deprecated tags on packages.
-
- Open
-
-
JDK-6492694 @deprecated tag doesn't work in package-info files.
-
- Closed
-
-
JDK-6493150 @deprecated tag ignored in package-info file
-
- Closed
-
-
JDK-8042566 JEP 211: Elide Deprecation Warnings on Import Statements
-
- Closed
-
-
JDK-8068626 Add javac lint warning when the @Deprecated annotation is used where it is a no-op
-
- Closed
-
-
JDK-6480737 package-info.java should be compiled if any class in the package is
-
- Closed
-
-
JDK-8140692 javac does not handle @deprecated tag in package-info.java
-
- Closed
-
-
JDK-8157735 re-evaluate javadoc support for @deprecated tag
-
- New
-