You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Stefan Seifert (JIRA)" <ji...@apache.org> on 2009/06/16 02:18:07 UTC

[jira] Created: (FELIX-1242) Annotation detection does not work when class contains only field-level annotations

Annotation detection does not work when class contains only field-level annotations
-----------------------------------------------------------------------------------

                 Key: FELIX-1242
                 URL: https://issues.apache.org/jira/browse/FELIX-1242
             Project: Felix
          Issue Type: Bug
          Components: Maven SCR Plugin
    Affects Versions: maven-scr-plugin-1.2.0
            Reporter: Stefan Seifert
             Fix For: maven-scr-plugin-1.4.0


in certain situations java classes contain only field-level SCR annotations (i.e. abstract classes where the real @Component annotations is defined on subclasses).
in this case, the existing of annotations is not detecting in this class, resulting in ignoring field-level annotations in this abstract class.

the patch attached [^090616_detectannotationfix.patch] fixes this problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FELIX-1242) Annotation detection does not work when class contains only field-level annotations

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12721101#action_12721101 ] 

Carsten Ziegeler commented on FELIX-1242:
-----------------------------------------

Yes, if we would do it this way it's maybe not a big deal. But I would like to go the other way and ignore the @scr tags if the class has no component tag.
Otherwise it's not possible to prevent a subclass to not inherit the stuff from a base class; I think when I added the support for abstract classes I forget about the check if the base class has the @scr.component tag. But if we change it this way now, this might break existing code.

> Annotation detection does not work when class contains only field-level annotations
> -----------------------------------------------------------------------------------
>
>                 Key: FELIX-1242
>                 URL: https://issues.apache.org/jira/browse/FELIX-1242
>             Project: Felix
>          Issue Type: Bug
>          Components: Maven SCR Plugin
>    Affects Versions: maven-scr-plugin-1.2.0
>            Reporter: Stefan Seifert
>            Priority: Trivial
>             Fix For: maven-scr-plugin-1.4.0
>
>         Attachments: 090616_detectannotationfix.patch
>
>
> in certain situations java classes contain only field-level SCR annotations (i.e. abstract classes where the real @Component annotations is defined on subclasses).
> in this case, the existing of annotations is not detecting in this class, resulting in ignoring field-level annotations in this abstract class.
> the patch attached [^090616_detectannotationfix.patch] fixes this problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FELIX-1242) Annotation detection does not work when class contains only field-level annotations

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12719936#action_12719936 ] 

Carsten Ziegeler commented on FELIX-1242:
-----------------------------------------

The solution for this use case is to use the @Component(componentAbstract=true) annotation on the base class. A special descriptor is then created which is picked up by the sub class.
The reason for this is that the base class might be contained in some other jar which is already compiled and the source and therefore the annotations are not available anymore.
I would like to keep it this way and use the same behaviour as with the javadoc tags.
WDYT?

> Annotation detection does not work when class contains only field-level annotations
> -----------------------------------------------------------------------------------
>
>                 Key: FELIX-1242
>                 URL: https://issues.apache.org/jira/browse/FELIX-1242
>             Project: Felix
>          Issue Type: Bug
>          Components: Maven SCR Plugin
>    Affects Versions: maven-scr-plugin-1.2.0
>            Reporter: Stefan Seifert
>             Fix For: maven-scr-plugin-1.4.0
>
>         Attachments: 090616_detectannotationfix.patch
>
>
> in certain situations java classes contain only field-level SCR annotations (i.e. abstract classes where the real @Component annotations is defined on subclasses).
> in this case, the existing of annotations is not detecting in this class, resulting in ignoring field-level annotations in this abstract class.
> the patch attached [^090616_detectannotationfix.patch] fixes this problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (FELIX-1242) Annotation detection does not work when class contains only field-level annotations

Posted by "Stefan Seifert (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1242?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Seifert updated FELIX-1242:
----------------------------------

    Attachment: 090616_detectannotationfix.patch

> Annotation detection does not work when class contains only field-level annotations
> -----------------------------------------------------------------------------------
>
>                 Key: FELIX-1242
>                 URL: https://issues.apache.org/jira/browse/FELIX-1242
>             Project: Felix
>          Issue Type: Bug
>          Components: Maven SCR Plugin
>    Affects Versions: maven-scr-plugin-1.2.0
>            Reporter: Stefan Seifert
>             Fix For: maven-scr-plugin-1.4.0
>
>         Attachments: 090616_detectannotationfix.patch
>
>
> in certain situations java classes contain only field-level SCR annotations (i.e. abstract classes where the real @Component annotations is defined on subclasses).
> in this case, the existing of annotations is not detecting in this class, resulting in ignoring field-level annotations in this abstract class.
> the patch attached [^090616_detectannotationfix.patch] fixes this problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FELIX-1242) Annotation detection does not work when class contains only field-level annotations

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12721094#action_12721094 ] 

Felix Meschberger commented on FELIX-1242:
------------------------------------------

Cannot tell, whether ignoring all  @scr.* annotations unless the @scr.component annotation is present is correct or wrong. We started off saying -- for simplicity reasons mainly -- that the @scr.component annotation on class level is the one indicator whether a class is to be looked at as a component.

Only later was support for abstract base components added but the requirement to have a @scr.component tag was never removed.

I think, it is probably not a big backwards compatibility issue, if we start supporting classes without @scr.component tags to be used as components.

> Annotation detection does not work when class contains only field-level annotations
> -----------------------------------------------------------------------------------
>
>                 Key: FELIX-1242
>                 URL: https://issues.apache.org/jira/browse/FELIX-1242
>             Project: Felix
>          Issue Type: Bug
>          Components: Maven SCR Plugin
>    Affects Versions: maven-scr-plugin-1.2.0
>            Reporter: Stefan Seifert
>            Priority: Trivial
>             Fix For: maven-scr-plugin-1.4.0
>
>         Attachments: 090616_detectannotationfix.patch
>
>
> in certain situations java classes contain only field-level SCR annotations (i.e. abstract classes where the real @Component annotations is defined on subclasses).
> in this case, the existing of annotations is not detecting in this class, resulting in ignoring field-level annotations in this abstract class.
> the patch attached [^090616_detectannotationfix.patch] fixes this problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (FELIX-1242) Annotation detection does not work when class contains only field-level annotations

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1242?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carsten Ziegeler closed FELIX-1242.
-----------------------------------

    Resolution: Won't Fix
      Assignee: Carsten Ziegeler

I think the current behaviour for the annotations is correct; to not break backwards compatibility we should leave the javadoc tag behaviour like it is today. 
Therefore setting this bug to won't fix

> Annotation detection does not work when class contains only field-level annotations
> -----------------------------------------------------------------------------------
>
>                 Key: FELIX-1242
>                 URL: https://issues.apache.org/jira/browse/FELIX-1242
>             Project: Felix
>          Issue Type: Bug
>          Components: Maven SCR Plugin
>    Affects Versions: maven-scr-plugin-1.2.0
>            Reporter: Stefan Seifert
>            Assignee: Carsten Ziegeler
>            Priority: Trivial
>             Fix For: maven-scr-plugin-1.4.0
>
>         Attachments: 090616_detectannotationfix.patch
>
>
> in certain situations java classes contain only field-level SCR annotations (i.e. abstract classes where the real @Component annotations is defined on subclasses).
> in this case, the existing of annotations is not detecting in this class, resulting in ignoring field-level annotations in this abstract class.
> the patch attached [^090616_detectannotationfix.patch] fixes this problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FELIX-1242) Annotation detection does not work when class contains only field-level annotations

Posted by "Stefan Seifert (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12720387#action_12720387 ] 

Stefan Seifert commented on FELIX-1242:
---------------------------------------

well, today the behavior is inconsistent between qdox and java anntoations. i stumbled about this when migrating a project using qdox annotations to java annotations.

scenario:

1.  an abstract class AbstractService defines one constant as field and two references, but *no* type-level qdox annotations

  /**
   * @scr.property value="crx.default" label="%cq.service.workspace.name" description="%cq.service.workspace.description"
   */
  public static final String WORKSPACE = "cq.service.workspace";

  /**
   * @scr.reference policy="static"
   */
  protected SlingRepository mSlingRepository;

  /**
   * @scr.reference
   */
  protected JcrResourceResolverFactory mJcrResourceResolverFactory;
...

2. another class extending AbstractService

/**
 * @scr.component immediate="true" metatype="no"
 * @scr.service interface="MyService"
 */
public class MyService extends AbstractService {


when using this scenario with qdocx annotations it works as expected (SCR metadata id generated for 1 property and 2 references for MyService component), event without using something like "@Component(componentAbstract=true)".

when i convert this scenarios with excactly the same syntax to java anntoations the property and 2 references are missing for MyService. when the attached patch is applied, the behavior is the same.

> Annotation detection does not work when class contains only field-level annotations
> -----------------------------------------------------------------------------------
>
>                 Key: FELIX-1242
>                 URL: https://issues.apache.org/jira/browse/FELIX-1242
>             Project: Felix
>          Issue Type: Bug
>          Components: Maven SCR Plugin
>    Affects Versions: maven-scr-plugin-1.2.0
>            Reporter: Stefan Seifert
>             Fix For: maven-scr-plugin-1.4.0
>
>         Attachments: 090616_detectannotationfix.patch
>
>
> in certain situations java classes contain only field-level SCR annotations (i.e. abstract classes where the real @Component annotations is defined on subclasses).
> in this case, the existing of annotations is not detecting in this class, resulting in ignoring field-level annotations in this abstract class.
> the patch attached [^090616_detectannotationfix.patch] fixes this problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FELIX-1242) Annotation detection does not work when class contains only field-level annotations

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-1242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12721088#action_12721088 ] 

Carsten Ziegeler commented on FELIX-1242:
-----------------------------------------

I think the qdox behaviour is wrong - but for compatibility reasons I'm unsure if we should change this.

> Annotation detection does not work when class contains only field-level annotations
> -----------------------------------------------------------------------------------
>
>                 Key: FELIX-1242
>                 URL: https://issues.apache.org/jira/browse/FELIX-1242
>             Project: Felix
>          Issue Type: Bug
>          Components: Maven SCR Plugin
>    Affects Versions: maven-scr-plugin-1.2.0
>            Reporter: Stefan Seifert
>            Priority: Trivial
>             Fix For: maven-scr-plugin-1.4.0
>
>         Attachments: 090616_detectannotationfix.patch
>
>
> in certain situations java classes contain only field-level SCR annotations (i.e. abstract classes where the real @Component annotations is defined on subclasses).
> in this case, the existing of annotations is not detecting in this class, resulting in ignoring field-level annotations in this abstract class.
> the patch attached [^090616_detectannotationfix.patch] fixes this problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (FELIX-1242) Annotation detection does not work when class contains only field-level annotations

Posted by "Stefan Seifert (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-1242?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Seifert updated FELIX-1242:
----------------------------------

    Priority: Trivial  (was: Major)

p.s. but besides this different behavoir, adding "@Component(componentAbstract=true)" to the abstract class just works fine and solves the initial problem.
so i lowered the priority of this ticket.
if the current anntoation behavior is considered by design (and perhaps there is wrong behaviour with qdox annotations, yust close this ticket.

> Annotation detection does not work when class contains only field-level annotations
> -----------------------------------------------------------------------------------
>
>                 Key: FELIX-1242
>                 URL: https://issues.apache.org/jira/browse/FELIX-1242
>             Project: Felix
>          Issue Type: Bug
>          Components: Maven SCR Plugin
>    Affects Versions: maven-scr-plugin-1.2.0
>            Reporter: Stefan Seifert
>            Priority: Trivial
>             Fix For: maven-scr-plugin-1.4.0
>
>         Attachments: 090616_detectannotationfix.patch
>
>
> in certain situations java classes contain only field-level SCR annotations (i.e. abstract classes where the real @Component annotations is defined on subclasses).
> in this case, the existing of annotations is not detecting in this class, resulting in ignoring field-level annotations in this abstract class.
> the patch attached [^090616_detectannotationfix.patch] fixes this problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.