Bug 220311 - [1.5][compiler] package-info.java does not recognise duplicate annotations as a problem
Summary: [1.5][compiler] package-info.java does not recognise duplicate annotations as...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.5 M5   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-25 21:20 EST by Paul Cowan CLA
Modified: 2009-01-27 05:58 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Cowan CLA 2008-02-25 21:20:16 EST
Build ID: I20080207-1530

Steps To Reproduce:
1. Create a new package, 'example'
2. Create a java file, 'example/package-info.java'
3. Include the following contents
   @Deprecated
   @Deprecated
   package example;


Expected result: this should be flagged as an error. On a class, this would (correctly) cause 'Duplicate annotation @Deprecated'; on package-info, however, Eclipse ignores it. However on trying to access the package annotations in the Sun JVM at runtime, you'll get:

java.lang.annotation.AnnotationFormatError: Duplicate annotation for class: interface java.lang.Deprecated: @java.lang.Deprecated()
	at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:75)
	at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
	at java.lang.Class.initAnnotationsIfNecessary(Class.java:3072)
	at java.lang.Class.getAnnotation(Class.java:3029)
	at java.lang.Class.isAnnotationPresent(Class.java:3042)
	at java.lang.Package.isAnnotationPresent(Package.java:376)


etc.

More information:
Comment 1 Kent Johnson CLA 2009-01-15 13:12:54 EST
Added AnnotationTest.test266()

Was fixed by the changes for bug 258906

Test released for 3.5M5
Comment 2 David Audel CLA 2009-01-27 05:58:20 EST
Verified for 3.5M5 using I20090126-1300