Question for Mike re: changing containers

michael keith michael.keith at oracle.com
Wed Mar 6 23:10:37 PST 2013


Our usage of the container annotation has fairly consistently been a 
trivial mapping from the singular contained annotation to its pluralized 
containing form. We have, during development, changed the name of the 
singular annotation and then had to go and rename the container 
annotation to the plural form of the newly named singular one, but it 
would not be common at all to decide to rename the container one 
independent of the singular one, and I am talking about development, 
before clients exist.

Existing clients of the current getAnnotation(Class) and 
getAnnotations() methods are written to reference both the repeatable 
and the container annotations directly, so renaming either one of them 
would be a breaking change that we would not generally undertake after 
the annotations have been created/released.

I would not have expected a precompiled client of 
getAnnotationsByType(Foo.class) to be affected by such a change, though. 
The container annotation is meant to be transparent to them, isn't it?

-Mike

On 06/03/2013 8:22 PM, Alex Buckley wrote:
> Mike, we're pondering whether the new methods in core reflection 
> should be strict about the relationship of containing type to 
> repeatable type.
>
> Have you ever written @FooContainer({@Foo(1),...}) on a declartion, 
> and later changed it to @OtherContainer({@Foo(1),...}) ? The effect on 
> clients using getAnnotation(Class) and getAnnotations() would be 
> significant.
>
> Effectively we are wondering if a client using 
> getAnnotationsByType(Foo.class) should be affected by such a change.
>
> Alex




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