JDK-6470991 : Package statement affected by imports
  • Type: Bug
  • Component: specification
  • Sub-Component: language
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2006-09-14
  • Updated: 2014-02-26
  • Resolved: 2013-08-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8
7Fixed 8Fixed
Related Reports
Relates :  
Description
From: 	Bruce Chapman & Barbara Carey <###@###.###>
To: 	Peter von der Ah�� <###@###.###>, Jesse Glick <###@###.###>
Subject: 	FYI Submitted to JLS feedback form    JLS | javac | Netbeans inconsistency
Date: 	Fri, 15 Sep 2006 08:58:23 +1200  (Thu, 13:58 PDT)

The JLS is pretty clear that the annotation types and any class literal 
values are outside the scope of any import statements and so must be 
(unless from java.lang package) fully qualified.

Indeed javac (JDK 6 B97, I haven't checked others) does resolve type 
names in annotations on the package statement using imports.

Comments
While JLS7 said "The scope of the type(s) or member(s) introduced by an import declaration specifically does not include the PackageName of a package declaration, ...", this is undesirable in JLS8 because PackageName should not appear in the PackageDeclaration production (4420532). Better to say "... does not include other compilation units in the same package, other import declarations in the current compilation unit, or a package declaration in the current compilation unit (except for the annotations of such a declaration)."
19-08-2013

EVALUATION Yes. See also http://mail.openjdk.java.net/pipermail/coin-dev/2009-March/000318.html
24-03-2009