Bug 212147 - [compiler][1.5] Compiler problem related to annotations and/or generics
Summary: [compiler][1.5] Compiler problem related to annotations and/or generics
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.4 M4   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 212175 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-12-06 09:07 EST by Roman Kennke CLA
Modified: 2007-12-12 09:21 EST (History)
2 users (show)

See Also:


Attachments
test case (486 bytes, text/x-java)
2007-12-06 09:07 EST, Roman Kennke CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Kennke CLA 2007-12-06 09:07:48 EST
Created attachment 84627 [details]
test case

I am trying to compile OpenJDK using Eclipse. I get a compiler error on code that I think is correct (and javac compiles it without complaining). I'll attach an example.
Comment 1 Roman Kennke CLA 2007-12-07 04:54:58 EST
It looks like the method Constructor.getAnnotation() returns a <T extends Annotation>, in this case ConstructorProperties, but the compiler treats it as Annotation instead.
Comment 2 Philipe Mulet CLA 2007-12-08 09:07:08 EST
If you change slightly the test to remove dependency onto 1.6 lib (ConstructorProperties), with following snippet:

import java.lang.reflect.Constructor;
public class X {
	public static void main(String[] args) {
		try {
			final Class<MyConstructorProperties> propertyNamesClass = MyConstructorProperties.class;
			Constructor constr = propertyNamesClass.getConstructor();
			String[] propertyNames = constr.getAnnotation(propertyNamesClass).value();
		} catch (Exception ex) {
			// Ignore. 
		}
	}
}

@interface MyConstructorProperties {}

You will get both compile errors with javac1.5 and java1.6
D:>javac X.java -d ..\bin -Xlint
X.java:13: cannot find symbol
symbol  : method value()
location: @interface MyConstructorProperties
                        String[] propertyNames = constr.getAnnotation(propertyNamesClass).value();
                                                                                         ^
1 error


Comment 3 Philipe Mulet CLA 2007-12-08 09:14:31 EST
This is a dup of bug 167952. Pls see javac bug at:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6400189

*** This bug has been marked as a duplicate of bug 167952 ***
Comment 4 Philipe Mulet CLA 2007-12-08 09:14:53 EST
closing as invalid
Comment 5 Kent Johnson CLA 2007-12-11 11:17:00 EST
Verified for 3.4M4 using build I20071210-1800.
Comment 6 Philipe Mulet CLA 2007-12-12 09:15:50 EST
I got confirmation that the javac bug really is a plain javac bug.
Comment 7 Philipe Mulet CLA 2007-12-12 09:21:03 EST
*** Bug 212175 has been marked as a duplicate of this bug. ***