If RetentionPolicy of a annotation is Runtime, It should be mapped to below
method in "visible" argument as I know:
This is my modified version and works the way expected. I'm just returning
null when annotation is visible by judging just by looking at visible
argument.
I'm not sure if this "visible" argument is ever sent true when
RetentionPolicy of a annotation is not RetentionPolicy.Runtime.

/**
     * Visit class annotations.
     * This method detects @component and @provides annotations.
     * @param desc : annotation descriptor.
     * @param visible : is the annotation visible at runtime.
     * @return the annotation visitor.
     * @see
org.objectweb.asm.ClassAdapter#visitAnnotation(java.lang.String, boolean)
     */
    public AnnotationVisitor visitAnnotation(String desc, boolean visible) {

     /*
      * Visible annotations are mostly destined to be read by reflection
      * at runtime. We retain runtime visible annotations on component
      * as they are and left them out in meta-data calculation.
      */
     if(visible){
     return null;
     }

        // Return the visitor to be executed (may be null)
        return registry.selection(workbench)
                .type(node)
                .annotatedWith(desc)
                .get();
    }

On Thu, Jan 31, 2013 at 12:02 PM, Guillaume Sauthier (Objectweb) <
guillaume.sauth...@objectweb.org> wrote:

> Hmmm
>
> The issue is that during manipulation, we d'ont have access to the
> metadata of the annotation (retention policy for example).
> What I can propose is to create a new manipulator module with an empty
> binding just for your annotation.
> With this, the manipulator will call your empty binding, and no handler
> metadata will be generated.
> So effectively, it will ignore your annotation (even if it matches the
> custom iPOJO annotation processing)
>
> --G
>
>
> 2013/1/30 Göktürk Gezer <gokturk.ge...@gmail.com>
>
>> No, there is no problem associated with backward compatibility.
>> Actually this is the default behaviour with the old one too.
>>
>> What i'm suggesting is : once some class is annotated with @Component,
>> all other annotations on this type are treated as handlers and there
>> must be a backing handler to use that component. What I want is to be
>> able to put annotations on components which is not handler but to be
>> read in runtime by reflection. So if we left out annotations with
>> runtime retentency in metadata calculation, we're golden. Besides
>> runtime annotations are by their nature should be treated this way IMO.
>>
>>
>> Gokturk From: Guillaume Sauthier (Objectweb)
>> Sent: 1/30/2013 12:50 PM
>>
>> To: dev@felix.apache.org
>> Subject: Re: New IPojo Manipuator, Handler Annotation Management
>> Sorry, I didn't understand the issue.
>> Are you seeing a problem for the old style custom annotation support
>> (looking for annotation with either handler or ipojo in their name) ?
>> --G
>>
>>
>> 2013/1/29 Göktürk Gezer <gokturk.ge...@gmail.com>
>>
>> > Hi,
>> >
>> > New IPojo manipulator picks all annotations for type as handler to wire
>> > them into @Component annotation. This creates a problem when some
>> > annotation is used in component type but not intended as handler
>> purposes.
>> >
>> > I think we should exclude annotations with run-time retention policy
>> from
>> > handler metadatas. WDYT?
>> >
>> >
>> > Regards,
>> > Gokturk
>> >
>>
>
>

Reply via email to