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

Propagation from dependencies overwrites service properties

    XMLWordPrintableJSON

Details

    Description

      ComponentImpl#calculateServiceProperties() method overwrites implicitly defined service properties those coming from propagated dependencies.

      addTo(properties, m_serviceProperties);
      for (int i = 0; i < m_dependencies.size(); i++) {
      	Dependency d = (Dependency) m_dependencies.get(i);
      	if (d.isPropagated() && d.isAvailable()) {
      		Dictionary dict = d.getProperties();
      		addTo(properties, dict);
      	}
      }
      

      I think that it would be more appropriate to deal clashes so that service properties would be added AFTER dependency propagation inverting the overwrite. Traversal of dependencies should in my opinion be inverted as well.

      for (int i = m_dependencies.size() - 1; i >= 0; i--) {
      	Dependency d = (Dependency) m_dependencies.get(i);
      	if (d.isPropagated() && d.isAvailable()) {
      		Dictionary dict = d.getProperties();
      		addTo(properties, dict);
      	}
      }
      addTo(properties, m_serviceProperties);
      

      My use case involves Service PID which is currently overwritten by propagated dependencies. I'd turn off propagation but @AdapterService (and @AspectService) annotation is missing such option that @BundleAdapterService is providing. I can't work around the issue (without patching) while using annotations so I increased the priority accordingly.

      Attachments

        Issue Links

          Activity

            People

              pderop Pierre De Rop
              tuomas_kiviaho Tuomas Kiviaho
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: