You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Stefan Seifert (Jira)" <ji...@apache.org> on 2021/08/26 23:11:00 UTC
[jira] [Resolved] (SLING-10616) Respect Target filter for
optional/static/greedy reference updates
[ https://issues.apache.org/jira/browse/SLING-10616?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stefan Seifert resolved SLING-10616.
------------------------------------
Assignee: Stefan Seifert
Resolution: Fixed
https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/commit/3fe1004cfc6527ee9a5ab4c85832314a2edeb58b
> Respect Target filter for optional/static/greedy reference updates
> ------------------------------------------------------------------
>
> Key: SLING-10616
> URL: https://issues.apache.org/jira/browse/SLING-10616
> Project: Sling
> Issue Type: Bug
> Components: Testing
> Affects Versions: Testing OSGi Mock 3.1.2
> Reporter: Dirk Rudolph
> Assignee: Stefan Seifert
> Priority: Major
> Fix For: Testing OSGi Mock 3.1.4
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> The MockBundleContext respects the Reference target for dynamic references
> [https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/blob/master/core/src/main/java/org/apache/sling/testing/mock/osgi/MockBundleContext.java#L156]
> but it does not for static+greedy ones
> [https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/blob/master/core/src/main/java/org/apache/sling/testing/mock/osgi/MockBundleContext.java#L177]
> Consider having a ServiceInterfaceA with a DefaultImplementation and a CustomImplementation. When the CustomImplementation references the DefaultImplementation optional+static+greedy with for example a target filter on the objectClass property this will cause a StackOverflowError when registering the services.
> {code:java}
> interface ServiceInterfaceA {}
> class DefaultImplementation implements ServiceInterfaceA {}
> class CustomImplementation implements ServiceInterfaceA {
> @Reference(
> cardinality=OPTIONAL,
> policy=STATIC,
> policyOption = GREEDY,
> target="(objectClass=*DefaultImplementation)")
> private ServiceInterfaceA defaultImplementation;
> }
> {code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)