JDK-8140692 : javac does not handle @deprecated tag in package-info.java
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Priority: P4
  • Status: Resolved
  • Resolution: Not an Issue
  • OS: generic
  • CPU: generic
  • Submitted: 2015-10-28
  • Updated: 2015-10-29
  • Resolved: 2015-10-29
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
Supposing a package is being deprecated using a package-info.java file as follows:
/**
 * Test pkg1 used.
 * @deprecated This package is Deprecated.
 */
package pkg1;

The deprecated flag in javac does not seem to be reflecting this, thus Elements.isDeprecated(pkginfo) will return false.

Note: when this bug is fixed langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java::isDeprecated(Element e) method needs to be cleaned up
Comments
Filed enhancement for doclint. https://bugs.openjdk.java.net/browse/JDK-8140772
29-10-2015

On a related note, the @Deprecation annotation is a no-op on package-info files: "Use of the @Deprecated annotation on a local variable declaration or on a parameter declaration or a package declaration has no effect." (JDK-6481080)
29-10-2015

Kumar, the decision when this last came up seems to have been that the specification should be amended to not require any effect when @Deprecated annotation and I suppose equivalently the javadoc tag is used is package-info. For https://bugs.openjdk.java.net/browse/JDK-6481080, this change set http://hg.openjdk.java.net/jdk9/dev/jdk/rev/83863e84201c has amended the javadoc of j.l.D and this open ticket tracks the changes needed for JLS: https://bugs.openjdk.java.net/browse/JDK-8068543 So I think the present ticket should be closed as Not an Issue. Do you disagree ?
29-10-2015