Request for revised terminology describing ways annotations can be present or not

Joe Darcy joe.darcy at oracle.com
Mon Apr 8 12:33:50 PDT 2013


On 03/26/2013 08:09 PM, Alex Buckley wrote:
> On 3/26/2013 4:10 PM, Joe Darcy wrote:
>> In brief, and processing API requires that the set of annotations
>> present on a body of code be computed. To preserve behavioral
>> compatibility, "present" in this context means directly present in the
>> source code or class file representation of a declaration or present via
>> inheritance. Container look-through should *not* be considered.
>>
>> I was hoping to describe this arrangement using the "directly present"
>> and "present" terminology from java.lang.reflect.AnnotatedElement or
>> javax.lang.model.AnnotatedConstruct. Unfortunately, those terms allow
>> look though to occur based on which method is being called.
>>
>> So what I'd like to have is a set of definition in the
>> AnnotatedElement/AnnotatedConstruct types which support the following
>> distinctions:
>>
>> 1) directly present (no inheritance, no container look through)
>> 2) present directly or present indirectly via inheritance
>> 3) present directly or present indirectly via container look through
>> 4) present directly or via the supported interaction of inheritance and
>> look through
>
> The building blocks are easy:
>
> a) An annotation A is DIRECTLY PRESENT on an element E if E is 
> associated with a RuntimeVisibleAnnotations or 
> RuntimeVisibleParameterAnnotations attribute, and the attribute 
> contains A.

For completeness, the attributes used to store declaration annotations 
on type parameters should be included in this list too.

-Joe




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