Bug 80328 - [annotation] annotation problem type should implements java,lang.annotation.Annotation
Summary: [annotation] annotation problem type should implements java,lang.annotation.A...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-06 17:43 EST by Olivier Thomann CLA
Modified: 2005-06-24 13:23 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2004-12-06 17:43:17 EST
Using latest,

@interface I {
	int id default 0;
}

@I() public class X {
	public static void main(String[] s) {
		System.out.println(X.class.getAnnotation(I.class));
	}
}

It reports:
----------
1. ERROR in C:\tests_sources\X.java (at line 2)
	int id default 0;
	       ^^^^^^^
Syntax error on token "default", = expected
----------
2. ERROR in C:\tests_sources\X.java (at line 5)
	@I() public class X {
	 ^
Type mismatch: cannot convert from I to Annotation
----------
3. ERROR in C:\tests_sources\X.java (at line 7)
	System.out.println(X.class.getAnnotation(I.class));
	                           ^^^^^^^^^^^^^
Bound mismatch: The generic method getAnnotation(Class<A>) of type Class<T> is
not applicable for the arguments (Class<I>) since the type I is not a valid
substitute for the bounded parameter <A extends Annotation>
----------
3 problems (3 errors)

I would expect only the first problem.
Comment 1 Olivier Thomann CLA 2004-12-08 17:33:57 EST
Fixed with recovery in annotation types.
Fixed and released in HEAD.
Regression test added in AnnotationTest.test098.