JDK-7029823 : (ann) test/java/lang/annotation/package-info.java no longer compiles
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-03-22
  • Updated: 2011-04-27
  • Resolved: 2011-04-27
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
7 b138Fixed
Related Reports
Duplicate :  
Relates :  
Description
A recent fix to javac (6993311) means that annotations on packages are now validated. This exposes an existing test in the jdk repository that needs to be re-examined.

--------------------------------------------------
TEST: java/lang/annotation/package-info.java
JDK under test: (/tmp/jprt/P2/T/093336.ab23780/testproduct/linux_x64_2.6-product)
java version "1.7.0-internal"
Java(TM) SE Runtime Environment (build 1.7.0-internal-201103220933.ab23780.TL-b00)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b04, mixed mode)

ACTION: compile -- Failed. Compilation failed: Compilation failed
REASON: User specified action: run compile package-info.java PackageMain.java 
TIME:   0.02 seconds
messages:
command: compile /tmp/jprt/P2/T/093336.ab23780/source/jdk/test/java/lang/annotation/package-info.java /tmp/jprt/P2/T/093336.ab23780/source/jdk/test/java/lang/annotation/PackageMain.java
reason: User specified action: run compile package-info.java PackageMain.java 
elapsed time (seconds): 0.02
direct:
/tmp/jprt/P2/T/093336.ab23780/source/jdk/test/java/lang/annotation/package-info.java:34: error: annotation type not applicable to this kind of declaration
@java.lang.annotation.Documented
^
1 error

TEST RESULT: Failed. Compilation failed: Compilation failed
--------------------------------------------------

Comments
EVALUATION The bug is that @java.lang.annotation.Documented is not allowed on a package declaration, but javac accepted it. Now it does not, so the fix is to change the annotation in the test case to one that _is_ allowed on a package declaration, @Deprecated.
24-03-2011