> public interface I {
> void foo(@MyAnnotation Object o);
> }
>
> It seems that the annotation is ignored by eclipse JDT. So is it a bug
> in eclipse or is it part of the annotations specifications ?
Does it work using Sun's javac? How have you set up the retention
policy, and how are you determining whether the annotation is present? A
small, complete, compilable example wouldn't go amiss.
Tom Hawtin
Marc - 14 Jul 2007 15:04 GMT
Tom Hawtin a écrit :
>> public interface I {
>> void foo(@MyAnnotation Object o);
[quoted text clipped - 6 lines]
> policy, and how are you determining whether the annotation is present? A
> small, complete, compilable example wouldn't go amiss.
I don't know if it's work with javac, since i'm using eclipse AST API. I
think, it's just a misuse of the eclipse API by me, since the AST view
plugin show the annotation. Sorry for bothering.
Marc - 14 Jul 2007 15:23 GMT
Tom Hawtin a écrit :
>> public interface I {
>> void foo(@MyAnnotation Object o);
[quoted text clipped - 8 lines]
>
> Tom Hawtin
Sorry for the previous post, i was wrong. So the small compilable
example would be:
//--
package org;
public @interface MyAnnotation {
}
//--
// from here, I1.foo() doesn't have any annotations on
// its arguments
public class X implements I1, I2 {
public void foo(Object o1, Object o2) {
}
}
//--
public interface I1 {
void foo(@MyAnnotation Object o1, Object o2);
}
//--
public interface I2 {
void foo(Object o1, @MyAnnotation Object o2);
}
I tried to put @Retention(RetentionPolicy.RUNTIME) but nothing changes.