enhanced-metadata-spec-discuss Digest, Vol 13, Issue 6

Srikanth S Adayapalam srikanth_sankaran at in.ibm.com
Wed Sep 25 20:06:52 PDT 2013


> From: enhanced-metadata-spec-discuss-request at openjdk.java.net
> Sent by: enhanced-metadata-spec-discuss-bounces at openjdk.java.net

> 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?


[...]

> - 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, could you please recheck if 9.6.3.6 is clear enough - Everytime I
read it, I get confused, I grant that it could just be me.

"The only time a deprecation warning can occur for a construct which is 
implicitly declared
is if a container annotation (§9.7.5) has a containing annotation type 
which is deprecated."

Is this better worded as "... if a repeating (and repeatable) annotation 
has a container annotation type which is deprecated" ?"

or "declared is for container annotations which are deprecated"

The present wording "container annotation (§9.7.5) has a containing 
annotation type" 
seems to invoke images of container's container.

Srikanth


More information about the enhanced-metadata-spec-discuss mailing list