diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java index 3bb427f51..bec299978 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java @@ -1077,13 +1077,16 @@ private List> lookupServiceRegistrations(String clazz if (filter instanceof FilterImpl) { // check if we can determine the clazz from the filter String filterObjectClazz = ((FilterImpl) filter).getRequiredObjectClass(); - if (filterObjectClazz != null && ((FilterImpl) filter).getChildren().isEmpty()) { - // this is a simple (objectClass=serviceClass) filter; - // no need to evaluate the filter - filter = null; + if (filterObjectClazz != null) { + result = publishedServicesByClass.get(filterObjectClazz); + if (((FilterImpl) filter).getChildren().isEmpty()) { + // this is a simple (objectClass=serviceClass) filter; + // no need to evaluate the filter + filter = null; + } + } else { + result = allPublishedServices; } - result = filterObjectClazz == null ? allPublishedServices - : publishedServicesByClass.get(filterObjectClazz); } else { // have to check all services result = allPublishedServices;