Robert Munteanu created FELIX-4033:
--------------------------------------

             Summary: Issue warning messages for redundant SCR annotation 
combinations
                 Key: FELIX-4033
                 URL: https://issues.apache.org/jira/browse/FELIX-4033
             Project: Felix
          Issue Type: Improvement
          Components: Declarative Services (SCR)
            Reporter: Robert Munteanu


When using SCR annotations there are some ways of using annotations which are 
redundant or useless. We should detect these early and log warning messages to 
prevent the user from being suprised when the annotations are ignored.

*1. Labels and descriptions for components with metatype=false*

{code}
@Component(metatype = false,
           label = "Some label",
           description = "Some description")
{code}

Since the value of {{metatype}} is false, the label and description will never 
be shown. So all three attributes should be removed. The warning message could 
be "The labell and description are ignored when metatype is false". The warning 
should take into account the fact that the metatype defaults to false if not 
set.

*2. Redundant combinations of propertyPrivate and metatype*

{code}
@Component(metatype = false)
@Property(name="some.property", value="some.value", propertyPrivate=true)
{code}

The {{propertyPrivate}} flag is useless since there the component will not have 
metatype information. The warning message could be "Redundant 
propertyPrivate=true set for property 'some.property' since the component will 
have no metatype information".

*3. Ignored settings for propertyPrivate*

{code}@Property(name="service.ranking", value="10", propertyPrivate=true{code}

This setting has no effect since {{service.ranking}} is private by default. The 
warning message could be "Redundant propertyPrivate=true set for 
'service.ranking', this property is private by default".

Also, this value is ignored for the built-in service.pid, service.description, 
service.id, service.vendor, service.bundlelocation and service.factoryPid 
values.The warning message could be "Ignoring propertyPrivate setting for 
property 'service.xxx', this property is not taken into account when generating 
metatype.xml".

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to