Tuomas Kiviaho created FELIX-4594:
-------------------------------------

             Summary: Propagation from dependencies overwrites service 
properties
                 Key: FELIX-4594
                 URL: https://issues.apache.org/jira/browse/FELIX-4594
             Project: Felix
          Issue Type: Bug
          Components: Dependency Manager
    Affects Versions: dependencymanager.runtime-3.2.0
            Reporter: Tuomas Kiviaho
            Priority: Blocker


ComponentImpl#calculateServiceProperties() method overwrites implicitly defined 
service properties those coming from propagated dependencies.
{code}
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);
        }
}
{code}

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.

{code}
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);
{code}

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.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to