If the following annotations are specified in different files, javac
(correctly) rejects them:
public @interface Bar {
Baz baz();
}
public @interface Baz {
Bar bar();
}
It seems to me then that the following should also be rejected on the
same grounds:
public class Foo {
public static @interface Bar {
Foo.Baz baz();
}
public static @interface Baz {
Foo.Bar bar();
}
}
However, javac 1.5.0_11 accepts this class. Is there some arcane
scope reason why the above is acceptable, or is javac wrong?

Signature
C. Benson Manica | I *should* know what I'm talking about - if I
cbmanica(at)gmail.com | don't, I need to know. Flames welcome.
Mark Rafn - 16 Mar 2007 17:15 GMT
>If the following annotations are specified in different files, javac
>(correctly) rejects them:
Agreed.
>It seems to me then that the following should also be rejected on the
>same grounds:
[quoted text clipped - 8 lines]
> }
>}
I can't think why javac should accept them. I didn't see anything with a
quick search in bugs.sun.com - if you can't find one, I'd say to file it.
>However, javac 1.5.0_11 accepts this class. Is there some arcane
>scope reason why the above is acceptable, or is javac wrong?
Is there any way to use such an annotation? I think javac is wrong.
--
Mark Rafn dagon@dagon.net <http://www.dagon.net/>