Well... again a problem. This time it's the annotations.
I have two classes like this:
public @interface Tst {
}
and ...
@Tst public class Test {
public Test() {
super();
}
public static void main(String argz[]) {
Test test = new Test();
System.out.println( Tst.class.isAnnotation() );
System.out.println( test.getClass().getAnnotations().length );
}
}
When I run Test the output is:
true
0
However, according to Java 5, the Test class should be annotated with
Tst.
The second line, I suppose should be 1.
What am I doing wrong?
Thank you
Chris Smith - 06 Apr 2005 21:41 GMT
> When I run Test the output is:
> true
[quoted text clipped - 4 lines]
>
> What am I doing wrong?
Read the API docs for java.lang.annotation.Retention. You need to
specify this meta-annotation on Tst. It defaults to CLASS, and
annotations with a RetentionPolicy of CLASS may not be read via
reflection.

Signature
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
Aleksandar Pecanov - 06 Apr 2005 22:48 GMT
Ok, ok ... ignore the previous posting ... very stupid of me
> Well... again a problem. This time it's the annotations.
> I have two classes like this:
[quoted text clipped - 29 lines]
>
> Thank you