A simpler model for repeating annotations

michael keith michael.keith at oracle.com
Mon Jan 7 11:27:23 PST 2013


On 07/01/2013 1:55 PM, Alex Buckley wrote:
> On 1/7/2013 8:55 AM, michael keith wrote:
>> Since the get[Declared]Annotations(Class) methods are semantically
>> different from the others they do deserve something different in their
>> names to indicate it. However, given that the javadoc of the lagacy
>> get[Declared]Annotations() methods state simply "Returns *all*
>> annotations [directly] present on this element" (emphasis added) I am
>> not sure that adding "All" to the semantically different
>> get[Declared]Annotations(Class) pair is going to be a very good
>> differentiator. Maybe "multiple" could be used in a different way, for
>> example: get[Declared]AnnotationsWithMultiples?
>
> We will in any case change the specs of legacy methods to avoid "all 
> annotations". We will also say more about container annotation and 
> look-through in the specs of new methods.

Ah, that's good.

> With regard to names, an advantage of 
> getAnnotationsWithMultiples(Class) is that it will appear after the 
> legacy methods, which I think is better than appearing first like 
> getAllAnnotations(Class). Stay tuned.

Yes, I wasn't sure if that was a plus or a minus  :-)

>> Also, I was just wondering if the getDeclaredAnnotation(Class) method
>> will be considered a backfilled "new legacy" method and have similar
>> semantics to getAnnotation(Class), or will it look through?
>
> The former. Per the PDF:
>
> "- Add getDeclaredAnnotation(Class<T>). The behavior is that of 
> getAnnotation(Class<T>) but ignoring inherited annotations on classes. 
> For simplicity, the added method is treated as an "SE 7 method" in the 
> remainder of this document."

Ok.  I haven't read the latest PDF yet but will do so and submit any 
comments ASAP.

-Mike

>
> Alex



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