Pierre De Rop created FELIX-5957:
------------------------------------
Summary: Check if a default implementation is used only on
optional dependencies
Key: FELIX-5957
URL: https://issues.apache.org/jira/browse/FELIX-5957
Project: Felix
Issue Type: Improvement
Components: Dependency Manager Annotations
Affects Versions: org.apache.felix.dependencymanager-r1
Reporter: Pierre De Rop
Assignee: Pierre De Rop
Fix For: org.apache.felix.dependencymanager-r12
When an optional dependency is defined on a class field, then a NullObject is
injected in case the dependency is unavailable.
Now, it is possible to also set a default implementation using the
ServiceDependency.defaultImpl attribute. This attribute refers to class that
will be used when the service dependency is unavailable.
For example:
{code:java}
@Component
class MyComponent {
@ServiceDependency(required=false, defaultImpl=MyDefaultImpl.class)
Dependency m_èdependency;
}
{code}
But it is an error to use the defaultImpl attribute when the dependency is
required or when the dependency is not applied on a class field. So, the DM
annocation scanner should report an error in such a case.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)