Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-4033

Issue warning messages for redundant SCR annotation combinations and an error for declaring the service.id property

    XMLWordPrintableJSON

Details

    Description

      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

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

      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

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

      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

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

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

      Attachments

        Issue Links

          Activity

            People

              cziegeler Carsten Ziegeler
              rombert Robert Munteanu
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: