Hi Joe,

I think this a desirable change. Some design questions inline,

Also please note the related work going on here: 
http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-October/022590.html

On 24 okt 2013, at 15:31, Joe Darcy <joe.da...@oracle.com> wrote:

> Hello,
> 
> Please review my initial implementation changes for
> 
>    JDK-8005294 : Consider default methods for additions to AnnotatedElement
>    http://cr.openjdk.java.net/~darcy/8005294.0/
> 
> (Specification aspects of the review are taking place over at
> http://mail.openjdk.java.net/pipermail/enhanced-metadata-spec-discuss/2013-October/000279.html
>  )
> 

Here are some things that aren't clear to me:

Why do you need to add AnnotatedElementSupport? We already have one version of 
getAssociatedAnnotations() (with a long history of being broken). Can we 
somehow unify this?

Also, we did get into trouble when making isAnnotationPresent() a default? is 
it different for getDeclaredAnnotations()? Will this work du to there being a 
concrete impl in all our concrete classes?

Considering Class is the only type where getAnnotationsByType() is different 
from getDeclaredAnnotationsByType() isn't it cleaner to define 
getAnnotationsByType() in terms of getDeclaredAnnotatinosByType() and override 
in Class?

> The webrev above is lacking tests. The basic testing approach I plan to take 
> is:
> 
> * Declare an AnnotedElementDelegate type in the test file
> * An AnnotedElementDelegate wraps an existing AnnotatedElement object, such 
> as a java.lang.Class object or a java.lang.reflect.Method object. Abstract 
> methods of the AnnotatedElement interface are sent to the base object; 
> methods with defaults are run as defaults.
> * For annotation types including {null, PresentAnnotation, MissingAnnotation, 
> RepeatableAnnotation, ...} the behavior of AnnotedElementDelegate.foo(arg) is 
> compared for equality to baseAnnotatedElement.foo(arg).
> * Base annotated elements will include a Class object (where annotation 
> inheritance can some input play) and a non-Class object.
> 

Seems like a good approach.

cheers
/Joel

Reply via email to