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

Improve failure message when enabling metatype and using no or private properties only

    XMLWordPrintableJSON

Details

    Description

      @Component(
          label = "Foo",
          description = "SCR Foo Service",
          metatype = true
      )
      @Service
      @Properties({
          @Property(
              name = Constants.SERVICE_VENDOR,
              value = "Example"
          ),
          @Property(
              name = Constants.SERVICE_DESCRIPTION,
              value = "service doing foo"
          )/*,
          @Property(
              name = "foo",
              value = "bar"
          )*/
      })
      public class ScrFooService implements FooService {
      
          public void foo() {
          }
      
      }
      

      metatype = false (or not set):

      [WARNING] /[...]/ScrFooService.java [1:1]:  Component org.apache.felix.FELIX_5373.internal.ScrFooService has set a label. However metatype is set to false. This label is ignored.
      [WARNING] /[...]/ScrFooService.java [1:1]:  Component org.apache.felix.FELIX_5373.internal.ScrFooService has set a description. However metatype is set to false. This description is ignored.
      

      metatype = true:

      [ERROR] /[...]/ScrFooService.java [1:1]: @Component : Component is defined to generate metatype information, however no properties have been defined; in case no properties are wanted, consider to use 'metatype=false'
      

      The build succeeds only without warnings when adding a non-private property (where it should also succeed with private properties only).

      Attachments

        1. FELIX-5373.tar.gz
          2 kB
          Oliver Lietz

        Issue Links

          Activity

            People

              cziegeler Carsten Ziegeler
              olli Oliver Lietz
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: