Bug 76751 - [1.5][annot] Can't use annotation classes as argument to generic methods
Summary: [1.5][annot] Can't use annotation classes as argument to generic methods
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.1 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-21 11:02 EDT by Volodymyr M. Lisivka CLA
Modified: 2004-12-15 13:02 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volodymyr M. Lisivka CLA 2004-10-21 11:02:37 EDT
Cannt compile this sample class with Eclipse in JDK 1.5 mode.
I successfully compiled and run it under JDK1.5.0:

C:\eclipse\workspace\annotations\src>"C:\Program
Files\Java\jdk1.5.0\bin\javac.exe" -source 1.5 test/*.java

C:\eclipse\workspace\annotations\src>"C:\Program
Files\Java\jdk1.5.0\bin\java.exe" -cp . test/AnnotationsTest
true

Annotations support is very uncomplete.

Error messages:

"@Retention": "Return type for the method is missing"
"isAnnotationPresent": "The method isAnnotationPresent(Class<? extends
Annotation>) in the type 
 Class<AnnotationsTest.A> is not applicable for the arguments 
 (Class<AnnotationsTest.TestAnnotation>)"

== Sample code ==
package test;

import java.lang.annotation.ElementType;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;

public class AnnotationsTest {

  @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @interface
TestAnnotation {

    String testAttribute();

  }
  @TestAnnotation(testAttribute = "test") class A {
  }

  public static void main(String[] args) {
    System.out.println(A.class.isAnnotationPresent(TestAnnotation.class));
  }

}
Comment 1 Philipe Mulet CLA 2004-10-21 12:21:57 EDT
Annotations are not yet supported.
Comment 2 Olivier Thomann CLA 2004-12-03 16:18:45 EST
Fixed and released in HEAD.
Regression test added in AnnotationTest.test085
Comment 3 Frederic Fusier CLA 2004-12-15 13:02:25 EST
Verified for 3.1 M4 using build I200412142000.