[jboss-cvs] Re: jboss-cvs-commits Digest, Vol 33, Issue 370

Kabir Khan kabir.khan at jboss.com
Thu Mar 19 19:01:10 EDT 2009


How AspectAnnotationLoader currently gets information from the  
annotated classes, in pseudocode:

for each javassist ClassFiles in the deployment
{
   if (ClassFile has @Aspect)
   {
     for each FieldInfo
     {
        if has @Pointcut etc.
        {
           deploy pointcut etc.
        }
     }
     for each MethodInfo
     {
        if has @BInd, @Mixin etc
        {
           deploy binding, mixin etc.
        }
     }
   }
}

Can the same be done using what is offered by AnnotationEnvironment?  
Bearing in mind that AFAICR at least for @Mixin we need information  
about the full method signature. For other constructs we need access  
to the name of the field that has been annotated. All this needs to be  
available _without_ loading anything from the AnnotationEnvironment,  
it should be accessible from the "Element"s it returns. I don't think  
that is currently possible. If I am right, is fixing  
AnnotationEnvironmen it an easy task?

On 19 Mar 2009, at 23:28, Ståle W. Pedersen wrote:

> ill take a look...
> - what should i be looking for? :)
>
> On Thu, Mar 19, 2009 at 01:19:22PM +0100, Kabir Khan wrote:
>>
>> On 19 Mar 2009, at 12:48, Ales Justin wrote:
>>
>>>>>> Last I looked, the AnnotationEnvironment ends up loading the
>>>>>> classes, so it is no use to AOP. We need all the metadata before
>>>>>> any clases are loaded
>>>>>
>>>>> It only loads annotations.
>>>>> Which should be fine for AOP.
>
>>>> https://svn.jboss.org/repos/jbossas/projects/jboss-deployers/trunk/deployers-spi/src/main/java/org/jboss/deployers/spi/annotations/AnnotationEnvironment.java
>>>> Apart from
>>>> boolean hasClassAnnotatedWith(String annotationName);
>>>> all the methods seem to load up classes, e.g.
>>>> Set<Element<Annotation, Class<?>>> classIsAnnotatedWith(String
>>>> annotationName);
>>>> Set<Element<Annotation, Field>> classHasFieldAnnotatedWith(String
>>>> annotationName);
>>>> So if something is annotated with the annotations, it seems to load
>>>> up the Field, Method, Constructor & Class that has been annotated?
>>>
>>> Where?
>>>
>>> Not until you really need it,
>>> that's why there is an Element class there,
>>> which has the lazy notion.
>> I did not realise that :-) I still think there might be some problems
>> though. Since I am away, Ståle can you have a look at
>> AspectAnnotationLoader vs what is provided by AnnotationEnvironment?





More information about the jboss-cvs-commits mailing list