Deprecated container annotations
Alex Buckley
alex.buckley at oracle.com
Wed Sep 25 11:14:39 PDT 2013
Hi Jesper,
You are correct:
- By JLS8 9.6, Foo is a legal repeatable annotation type, and
FooContainer is a legal containing annotation type of Foo, so the Java
language has no warnings or errors for the declarations of Foo and
FooContainer.
- By JLS8 9.6.3.6, the deprecated type FooContainer is used in the
container annotation @FooContainer which is implicitly declared at the
site of @Foo @Foo. So, a deprecation warning is due at @Foo @Foo. A note
in 9.6.3.6 identifies the possibility of an "invisible" container
annotation causing a warning.
Alex
On 9/24/2013 12:09 PM, Jesper Steen Møller wrote:
> Hi List
>
> I'm implementing repeated annotations in the Eclipse Java compiler, and have come across a question as to the interpretation of the deprecation of the containing annotation.
>
> As I read the changes in 9.6.3.6, the following code:
>
> @java.lang.annotation.Repeatable(FooContainer.class)
> @interface Foo {
> }
>
> @Deprecated @interface FooContainer {
> Foo[] value();
> }
>
> @Foo @Foo public class Y {
> }
>
>
> ... should this give a deprecation warning near the repeated usage of @Foo (which causes the implied declaration of @FooContainer), if compiling with -Xlint. Is this correct?
>
> -Jesper
>
More information about the enhanced-metadata-spec-discuss
mailing list