[weld-dev] AnnotatedType and the SPI

Stuart Douglas stuart at baileyroberts.com.au
Tue Jan 12 06:52:51 EST 2010


I will double check then, I just had a quick look so there is a good chance I may have been wrong about the behaviour. The way I read the spec I am not sure if this is the correct behavior, from 11.4:

The container must use the operations of Annotated and its subinterfaces to discover program element types and annotations,
instead of directly calling the Java Reflection API. In particular, the container must:

Which would imply that the container cannot use the reflection API to merge the annotations.

Stuart
________________________________________
From: Pete Muir [pmuir at redhat.com]
Sent: Tuesday, 12 January 2010 10:43 PM
To: Stuart Douglas
Cc: Weld-Dev
Subject: Re: [weld-dev] AnnotatedType and the SPI

On 12 Jan 2010, at 09:46, Stuart Douglas wrote:

> Does the spec define what should happen if an AnnotatedType added through the SPI is missing a method/field/parameter etc that is present on the underlying class?
> I had a look but I could not see anything in spec, and as far as I can tell weld is inconsistant with regard to how it treats it. If an AnnotatedParameter is missing it uses the Annotations on the underlying class, however if a field definition is missing it treats it as having no annotations (I have not actually tested this, just has a quick look at the code, so I could be wrong).

We should *always* merge the annotations from the underlying class with any specified through Annotated*. If Weld does differently, it's a bug :-)



More information about the weld-dev mailing list