Skip to content

Commit e030a67

Browse files
sratzlaeubi
authored andcommitted
org.eclipse.core.contenttype: osgi.extender=osgi.component requirement
org.eclipse.core.contenttype declares a service component, so it should also declare the requirement to the service extender. Otherwise, this can lead to exceptions such as the one below, in case no extender is added. This also adjusts org.eclipse.core.tests.harness accordingly, which builds a custom OSGI config.ini in CustomSessionConfigurationImpl and must now also include a SCR bundle (and its dependencies). We use org.apache.felix.scr here. This serves also as a preparation for eclipse-tycho/tycho#5362 org.osgi.framework.BundleException: Exception in org.eclipse.core.resources.ResourcesPlugin.start() of bundle org.eclipse.core.resources. at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:847) at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:768) at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:1066) at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:394) at org.eclipse.osgi.container.Module.doStart(Module.java:643) at org.eclipse.osgi.container.Module.start(Module.java:500) at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:528) at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:122) at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:622) at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:353) at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:417) at org.eclipse.osgi.internal.loader.sources.SingleSourcePackage.loadClass(SingleSourcePackage.java:41) at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:521) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:438) at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:195) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) at java.base/java.lang.Class.getDeclaredMethods0(Native Method) at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3578) at java.base/java.lang.Class.getDeclaredMethods(Class.java:2676) at org.junit.platform.commons.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:1809) at org.junit.platform.commons.util.ReflectionUtils.findMethod(ReflectionUtils.java:1649) at org.junit.platform.commons.util.ReflectionUtils.isMethodPresent(ReflectionUtils.java:1500) at org.junit.jupiter.engine.discovery.predicates.TestClassPredicates.hasTestOrTestFactoryOrTestTemplateMethods(TestClassPredicates.java:106) at org.junit.jupiter.engine.discovery.predicates.TestClassPredicates.looksLikeIntendedTestClass(TestClassPredicates.java:81) at org.junit.jupiter.engine.discovery.predicates.TestClassPredicates.looksLikeIntendedTestClass(TestClassPredicates.java:75) at org.junit.jupiter.engine.discovery.ClassSelectorResolver.isAcceptedStandaloneTestClass(ClassSelectorResolver.java:115) at org.junit.jupiter.engine.discovery.ClassSelectorResolver.resolveStandaloneTestClass(ClassSelectorResolver.java:106) at org.junit.jupiter.engine.discovery.ClassSelectorResolver.resolve(ClassSelectorResolver.java:102) at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.lambda$resolve$2(EngineDiscoveryRequestResolution.java:135) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1685) at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129) at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:647) at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:189) at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:126) at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolveCompletely(EngineDiscoveryRequestResolution.java:92) at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.run(EngineDiscoveryRequestResolution.java:83) at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolver.resolve(EngineDiscoveryRequestResolver.java:148) at org.junit.jupiter.engine.discovery.DiscoverySelectorResolver.resolveSelectors(DiscoverySelectorResolver.java:63) at org.junit.jupiter.engine.JupiterTestEngine.discover(JupiterTestEngine.java:70) at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:195) at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverSafely(EngineDiscoveryOrchestrator.java:174) at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:119) at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:84) at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:104) at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:83) at org.junit.platform.launcher.core.DelegatingLauncher.discover(DelegatingLauncher.java:42) at org.junit.platform.launcher.core.InterceptingLauncher.lambda$discover$0(InterceptingLauncher.java:33) at org.junit.platform.launcher.core.ClasspathAlignmentCheckingLauncherInterceptor.intercept(ClasspathAlignmentCheckingLauncherInterceptor.java:25) at org.junit.platform.launcher.core.InterceptingLauncher.discover(InterceptingLauncher.java:33) at org.junit.platform.launcher.core.DelegatingLauncher.discover(DelegatingLauncher.java:42) at org.apache.maven.surefire.junitplatform.LazyLauncher.discover(LazyLauncher.java:50) at org.apache.maven.surefire.junitplatform.TestPlanScannerFilter.accept(TestPlanScannerFilter.java:52) at org.apache.maven.surefire.api.util.DefaultScanResult.applyFilter(DefaultScanResult.java:87) at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.scanClasspath(JUnitPlatformProvider.java:144) at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:124) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at org.apache.maven.surefire.api.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:137) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:148) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:88) at org.eclipse.tycho.surefire.osgibooter.OsgiSurefireBooter.invokeSureFire(OsgiSurefireBooter.java:195) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at org.eclipse.tycho.surefire.osgibooter.OsgiSurefireBooter.run(OsgiSurefireBooter.java:116) at org.eclipse.tycho.surefire.osgibooter.HeadlessTestApplication.start(HeadlessTestApplication.java:29) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:219) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:149) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:115) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:467) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:298) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:627) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575) at org.eclipse.equinox.launcher.Main.run(Main.java:1431) at org.eclipse.equinox.launcher.Main.main(Main.java:1403) Caused by: java.lang.NullPointerException: Cannot invoke "org.eclipse.core.runtime.content.IContentTypeManager.addContentTypeChangeListener(org.eclipse.core.runtime.content.IContentTypeManager$IContentTypeChangeListener)" because the return value of "org.eclipse.core.runtime.Platform.getContentTypeManager()" is null at org.eclipse.core.internal.resources.CharsetDeltaJob.startup(CharsetDeltaJob.java:266) at org.eclipse.core.internal.resources.CharsetManager.startup(CharsetManager.java:590) at org.eclipse.core.internal.resources.Workspace.startup(Workspace.java:2681) at org.eclipse.core.internal.resources.Workspace.open(Workspace.java:2369) at org.eclipse.core.resources.ResourcesPlugin$WorkspaceInitCustomizer.addingService(ResourcesPlugin.java:591) at org.eclipse.core.resources.ResourcesPlugin$WorkspaceInitCustomizer.addingService(ResourcesPlugin.java:1) at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:947) at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1) at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:257) at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:184) at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:324) at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:267) at org.eclipse.core.resources.ResourcesPlugin.start(ResourcesPlugin.java:565) at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:826) at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:1) at java.base/java.security.AccessController.doPrivileged(AccessController.java:571) at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:818) ... 81 more Root exception: java.lang.NullPointerException: Cannot invoke "org.eclipse.core.runtime.content.IContentTypeManager.addContentTypeChangeListener(org.eclipse.core.runtime.content.IContentTypeManager$IContentTypeChangeListener)" because the return value of "org.eclipse.core.runtime.Platform.getContentTypeManager()" is null at org.eclipse.core.internal.resources.CharsetDeltaJob.startup(CharsetDeltaJob.java:266) at org.eclipse.core.internal.resources.CharsetManager.startup(CharsetManager.java:590) at org.eclipse.core.internal.resources.Workspace.startup(Workspace.java:2681) at org.eclipse.core.internal.resources.Workspace.open(Workspace.java:2369) at org.eclipse.core.resources.ResourcesPlugin$WorkspaceInitCustomizer.addingService(ResourcesPlugin.java:591) at org.eclipse.core.resources.ResourcesPlugin$WorkspaceInitCustomizer.addingService(ResourcesPlugin.java:1) at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:947) at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1) at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:257) at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:184) at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:324) at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:267) at org.eclipse.core.resources.ResourcesPlugin.start(ResourcesPlugin.java:565) at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:826) at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:1) at java.base/java.security.AccessController.doPrivileged(AccessController.java:571) at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:818) at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:768) at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:1066) at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:394) at org.eclipse.osgi.container.Module.doStart(Module.java:643) at org.eclipse.osgi.container.Module.start(Module.java:500) at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:528) at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:122) at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:622) at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:353) at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:417) at org.eclipse.osgi.internal.loader.sources.SingleSourcePackage.loadClass(SingleSourcePackage.java:41) at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:521) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:438) at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:195) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) at java.base/java.lang.Class.getDeclaredMethods0(Native Method) at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3578) at java.base/java.lang.Class.getDeclaredMethods(Class.java:2676) at org.junit.platform.commons.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:1809) at org.junit.platform.commons.util.ReflectionUtils.findMethod(ReflectionUtils.java:1649) at org.junit.platform.commons.util.ReflectionUtils.isMethodPresent(ReflectionUtils.java:1500) at org.junit.jupiter.engine.discovery.predicates.TestClassPredicates.hasTestOrTestFactoryOrTestTemplateMethods(TestClassPredicates.java:106) at org.junit.jupiter.engine.discovery.predicates.TestClassPredicates.looksLikeIntendedTestClass(TestClassPredicates.java:81) at org.junit.jupiter.engine.discovery.predicates.TestClassPredicates.looksLikeIntendedTestClass(TestClassPredicates.java:75) at org.junit.jupiter.engine.discovery.ClassSelectorResolver.isAcceptedStandaloneTestClass(ClassSelectorResolver.java:115) at org.junit.jupiter.engine.discovery.ClassSelectorResolver.resolveStandaloneTestClass(ClassSelectorResolver.java:106) at org.junit.jupiter.engine.discovery.ClassSelectorResolver.resolve(ClassSelectorResolver.java:102) at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.lambda$resolve$2(EngineDiscoveryRequestResolution.java:135) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1685) at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129) at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:647) at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:189) at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:126) at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolveCompletely(EngineDiscoveryRequestResolution.java:92) at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.run(EngineDiscoveryRequestResolution.java:83) at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolver.resolve(EngineDiscoveryRequestResolver.java:148) at org.junit.jupiter.engine.discovery.DiscoverySelectorResolver.resolveSelectors(DiscoverySelectorResolver.java:63) at org.junit.jupiter.engine.JupiterTestEngine.discover(JupiterTestEngine.java:70) at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:195) at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverSafely(EngineDiscoveryOrchestrator.java:174) at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:119) at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:84) at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:104) at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:83) at org.junit.platform.launcher.core.DelegatingLauncher.discover(DelegatingLauncher.java:42) at org.junit.platform.launcher.core.InterceptingLauncher.lambda$discover$0(InterceptingLauncher.java:33) at org.junit.platform.launcher.core.ClasspathAlignmentCheckingLauncherInterceptor.intercept(ClasspathAlignmentCheckingLauncherInterceptor.java:25) at org.junit.platform.launcher.core.InterceptingLauncher.discover(InterceptingLauncher.java:33) at org.junit.platform.launcher.core.DelegatingLauncher.discover(DelegatingLauncher.java:42) at org.apache.maven.surefire.junitplatform.LazyLauncher.discover(LazyLauncher.java:50) at org.apache.maven.surefire.junitplatform.TestPlanScannerFilter.accept(TestPlanScannerFilter.java:52) at org.apache.maven.surefire.api.util.DefaultScanResult.applyFilter(DefaultScanResult.java:87) at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.scanClasspath(JUnitPlatformProvider.java:144) at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:124) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at org.apache.maven.surefire.api.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:137) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:148) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:88) at org.eclipse.tycho.surefire.osgibooter.OsgiSurefireBooter.invokeSureFire(OsgiSurefireBooter.java:195) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at org.eclipse.tycho.surefire.osgibooter.OsgiSurefireBooter.run(OsgiSurefireBooter.java:116) at org.eclipse.tycho.surefire.osgibooter.HeadlessTestApplication.start(HeadlessTestApplication.java:29) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:219) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:149) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:115) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:467) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:298) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:627) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575) at org.eclipse.equinox.launcher.Main.run(Main.java:1431) at org.eclipse.equinox.launcher.Main.main(Main.java:1403)
1 parent 7bfee52 commit e030a67

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

runtime/bundles/org.eclipse.core.contenttype/META-INF/MANIFEST.MF

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %pluginName
44
Bundle-SymbolicName: org.eclipse.core.contenttype; singleton:=true
5-
Bundle-Version: 3.9.700.qualifier
5+
Bundle-Version: 3.9.800.qualifier
66
Bundle-Vendor: %providerName
77
Bundle-Localization: plugin
88
Require-Bundle: org.eclipse.equinox.preferences;bundle-version="[3.2.0,4.0.0)",
@@ -22,3 +22,5 @@ Import-Package: javax.xml.parsers,
2222
Bundle-RequiredExecutionEnvironment: JavaSE-17
2323
Automatic-Module-Name: org.eclipse.core.contenttype
2424
Service-Component: OSGI-INF/org.eclipse.core.internal.content.ContentTypeManager.xml
25+
Require-Capability: osgi.extender;
26+
filter:="(&(osgi.extender=osgi.component)(version>=1.2)(!(version>=2.0)))"

runtime/tests/org.eclipse.core.tests.harness/META-INF/MANIFEST.MF

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: Eclipse Core Tests Harness
44
Bundle-SymbolicName: org.eclipse.core.tests.harness;singleton:=true
5-
Bundle-Version: 3.17.300.qualifier
5+
Bundle-Version: 3.17.400.qualifier
66
Bundle-Vendor: Eclipse.org
77
Export-Package: org.eclipse.core.tests.harness;version="2.0",
88
org.eclipse.core.tests.harness.session,
99
org.eclipse.core.tests.session;version="2.0"
1010
Require-Bundle: org.junit,
11+
org.apache.felix.scr,
1112
org.eclipse.test.performance,
1213
org.eclipse.core.runtime;bundle-version="[3.29.0,4.0.0)",
1314
org.eclipse.jdt.junit.runtime,

runtime/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/session/customization/CustomSessionConfigurationImpl.java

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
import java.io.OutputStream;
2020
import java.nio.file.Files;
2121
import java.nio.file.Path;
22-
import java.util.ArrayList;
2322
import java.util.Collection;
23+
import java.util.HashSet;
24+
import java.util.LinkedHashSet;
2425
import java.util.Objects;
2526
import java.util.Optional;
2627
import java.util.Properties;
@@ -36,6 +37,8 @@
3637
import org.osgi.framework.Constants;
3738
import org.osgi.framework.FrameworkUtil;
3839
import org.osgi.framework.Version;
40+
import org.osgi.framework.wiring.BundleWire;
41+
import org.osgi.framework.wiring.BundleWiring;
3942

4043
@SuppressWarnings("restriction")
4144
public class CustomSessionConfigurationImpl implements CustomSessionConfiguration {
@@ -48,7 +51,7 @@ public class CustomSessionConfigurationImpl implements CustomSessionConfiguratio
4851
private static final String PROP_SHARED_CONFIG_AREA = "osgi.sharedConfiguration.area";
4952
private static final String TEMP_DIR_PREFIX = "eclipse_session_configuration";
5053

51-
private final Collection<BundleReference> bundleReferences = new ArrayList<>();
54+
private final Collection<BundleReference> bundleReferences = new LinkedHashSet<>();
5255
private Path configurationDirectory;
5356
private boolean readOnly = false;
5457
private boolean cascaded = false;
@@ -58,6 +61,18 @@ public CustomSessionConfigurationImpl() {
5861
addMinimalBundleSet();
5962
}
6063

64+
private static void collectDependencies(Bundle bundle, Collection<Bundle> dependencyClosure) {
65+
if (!dependencyClosure.add(bundle)) {
66+
return;
67+
}
68+
BundleWiring wiring = bundle.adapt(BundleWiring.class);
69+
if (wiring != null) {
70+
for (BundleWire wire : wiring.getRequiredWires(null)) {
71+
collectDependencies(wire.getProviderWiring().getBundle(), dependencyClosure);
72+
}
73+
}
74+
}
75+
6176
@SuppressWarnings("deprecation")
6277
private void addMinimalBundleSet() {
6378
// Just use any class from the bundles we want to add as minimal bundle set
@@ -71,6 +86,12 @@ private void addMinimalBundleSet() {
7186
addBundle(org.eclipse.core.runtime.content.IContentType.class); // org.eclipse.core.contenttype
7287
addBundle(org.eclipse.equinox.app.IApplication.class); // org.eclipse.equinox.app
7388

89+
// org.apache.felix.scr + dependencies
90+
Bundle scrBundle = FrameworkUtil.getBundle(org.apache.felix.scr.info.ScrInfo.class);
91+
Collection<Bundle> scrAndDependencies = new HashSet<>();
92+
collectDependencies(scrBundle, scrAndDependencies);
93+
scrAndDependencies.forEach(this::addBundle);
94+
7495
addBundle(org.eclipse.core.tests.harness.TestHarnessPlugin.class); // org.eclipse.core.tests.harness
7596
addBundle(org.eclipse.test.performance.Performance.class); // org.eclipse.test.performance
7697

0 commit comments

Comments
 (0)