[
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.