diff options
author | Hannes Wellmann | 2021-07-22 19:03:14 +0000 |
---|---|---|
committer | Lars Vogel | 2021-07-26 09:27:22 +0000 |
commit | ba6205dab1f857fe87cf5985f03c1b5e88797064 (patch) | |
tree | 3e4faede9b4637ea544f302449052420cb76d71f | |
parent | 753a02d1552e5dc2fbbdba626f8e229979fd969e (diff) | |
download | rt.equinox.framework-ba6205dab1f857fe87cf5985f03c1b5e88797064.tar.gz rt.equinox.framework-ba6205dab1f857fe87cf5985f03c1b5e88797064.tar.xz rt.equinox.framework-ba6205dab1f857fe87cf5985f03c1b5e88797064.zip |
Bug 574872 - [Clean-up] Use lambda where possible, corrected (3)
Clean up using the JDT clean-up:
- Convert functional interface instances: Use lambda where possible
After the clean up was applied the code had compile errors that had to
be corrected manually.
Change-Id: Icca0ddc7a7d38b7fd08568b2e797ccf100a3ddac
Signed-off-by: Hannes Wellmann <wellmann.hannes1@gmx.net>
Reviewed-on: https://git.eclipse.org/r/c/equinox/rt.equinox.framework/+/183302
Tested-by: Equinox Bot <equinox-bot@eclipse.org>
Reviewed-by: Lars Vogel <Lars.Vogel@vogella.com>
6 files changed, 226 insertions, 263 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceHookTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceHookTests.java index 9e114a7fb..b27996ae3 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceHookTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/serviceregistry/ServiceHookTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 2021 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -44,11 +44,8 @@ public class ServiceHookTests extends AbstractBundleTests { public void testFindHook01() { final String testMethodName = "testFindHook01"; //$NON-NLS-1$ // test the FindHook is called and can remove a reference from the results - Runnable runIt = new Runnable() { - @Override - public void run() { - // nothing - } + Runnable runIt = () -> { + // nothing }; final BundleContext testContext = OSGiTestsActivator.getContext(); // register services @@ -71,50 +68,48 @@ public class ServiceHookTests extends AbstractBundleTests { props.put(Constants.SERVICE_DESCRIPTION, "find hook 1"); //$NON-NLS-1$ props.put(Constants.SERVICE_DESCRIPTION, "min value"); //$NON-NLS-1$ props.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MIN_VALUE)); - ServiceRegistration regHook1 = testContext.registerService(FindHook.class.getName(), new FindHook() { - public void find(BundleContext context, String name, String filter, boolean allServices, Collection references) { - try { - synchronized (hookCalled) { - if (!startTest[0]) - return; - hookCalled[++hookCalled[0]] = 1; + ServiceRegistration regHook1 = testContext.registerService(FindHook.class.getName(), (FindHook) (context, name, filter, allServices, references) -> { + try { + synchronized (hookCalled) { + if (!startTest[0]) + return; + hookCalled[++hookCalled[0]] = 1; + } + assertEquals("wrong context in hook", testContext, context); //$NON-NLS-1$ + assertEquals("wrong name in hook", Runnable.class.getName(), name); //$NON-NLS-1$ + assertEquals("wrong filter in hook", "(name=" + testMethodName + ")", filter); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + assertEquals("wrong allservices in hook", false, allServices); //$NON-NLS-1$ + assertEquals("wrong number of services in hook", 1, references.size()); //$NON-NLS-1$ + Iterator iter = references.iterator(); + while (iter.hasNext()) { + ServiceReference ref = (ServiceReference) iter.next(); + if (ref.equals(reg1.getReference())) { + fail("service 1 is present"); //$NON-NLS-1$ } - assertEquals("wrong context in hook", testContext, context); //$NON-NLS-1$ - assertEquals("wrong name in hook", Runnable.class.getName(), name); //$NON-NLS-1$ - assertEquals("wrong filter in hook", "(name=" + testMethodName + ")", filter); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - assertEquals("wrong allservices in hook", false, allServices); //$NON-NLS-1$ - assertEquals("wrong number of services in hook", 1, references.size()); //$NON-NLS-1$ - Iterator iter = references.iterator(); - while (iter.hasNext()) { - ServiceReference ref = (ServiceReference) iter.next(); - if (ref.equals(reg1.getReference())) { - fail("service 1 is present"); //$NON-NLS-1$ - } - if (ref.equals(reg2.getReference())) { - fail("service 2 is present"); //$NON-NLS-1$ - } + if (ref.equals(reg2.getReference())) { + fail("service 2 is present"); //$NON-NLS-1$ } + } - try { - references.add(reg1.getReference()); - fail("add to collection succeeded"); //$NON-NLS-1$ - } catch (UnsupportedOperationException e) { - // should get an exception - } catch (Exception e) { - fail("incorrect exception", e); //$NON-NLS-1$ - } - try { - references.addAll(Arrays.asList(new ServiceReference[] {reg1.getReference()})); - fail("addAll to collection succeeded"); //$NON-NLS-1$ - } catch (UnsupportedOperationException e) { - // should get an exception - } catch (Exception e) { - fail("incorrect exception", e); //$NON-NLS-1$ - } - } catch (AssertionFailedError a) { - hookErrors[0] = a; - return; + try { + references.add(reg1.getReference()); + fail("add to collection succeeded"); //$NON-NLS-1$ + } catch (UnsupportedOperationException e1) { + // should get an exception + } catch (Exception e2) { + fail("incorrect exception", e2); //$NON-NLS-1$ + } + try { + references.addAll((Collection<? extends ServiceReference<?>>) Arrays.asList(reg1.getReference())); + fail("addAll to collection succeeded"); //$NON-NLS-1$ + } catch (UnsupportedOperationException e3) { + // should get an exception + } catch (Exception e4) { + fail("incorrect exception", e4); //$NON-NLS-1$ } + } catch (AssertionFailedError a) { + hookErrors[0] = a; + return; } }, props); @@ -122,47 +117,45 @@ public class ServiceHookTests extends AbstractBundleTests { props.put(Constants.SERVICE_DESCRIPTION, "find hook 2"); //$NON-NLS-1$ props.put(Constants.SERVICE_DESCRIPTION, "max value first"); //$NON-NLS-1$ props.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MAX_VALUE)); - ServiceRegistration regHook2 = testContext.registerService(FindHook.class.getName(), new FindHook() { - public void find(BundleContext context, String name, String filter, boolean allServices, Collection references) { - try { - synchronized (hookCalled) { - if (!startTest[0]) - return; - hookCalled[++hookCalled[0]] = 2; - } - assertEquals("wrong context in hook", testContext, context); //$NON-NLS-1$ - assertEquals("wrong name in hook", Runnable.class.getName(), name); //$NON-NLS-1$ - assertEquals("wrong filter in hook", "(name=" + testMethodName + ")", filter); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - assertEquals("wrong allservices in hook", false, allServices); //$NON-NLS-1$ - assertEquals("wrong number of services in hook", 3, references.size()); //$NON-NLS-1$ - Iterator iter = references.iterator(); - while (iter.hasNext()) { - ServiceReference ref = (ServiceReference) iter.next(); - if (ref.equals(reg2.getReference())) { - iter.remove(); - } + ServiceRegistration regHook2 = testContext.registerService(FindHook.class.getName(), (FindHook) (context, name, filter, allServices, references) -> { + try { + synchronized (hookCalled) { + if (!startTest[0]) + return; + hookCalled[++hookCalled[0]] = 2; + } + assertEquals("wrong context in hook", testContext, context); //$NON-NLS-1$ + assertEquals("wrong name in hook", Runnable.class.getName(), name); //$NON-NLS-1$ + assertEquals("wrong filter in hook", "(name=" + testMethodName + ")", filter); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + assertEquals("wrong allservices in hook", false, allServices); //$NON-NLS-1$ + assertEquals("wrong number of services in hook", 3, references.size()); //$NON-NLS-1$ + Iterator iter = references.iterator(); + while (iter.hasNext()) { + ServiceReference ref = (ServiceReference) iter.next(); + if (ref.equals(reg2.getReference())) { + iter.remove(); } + } - try { - references.add(reg2.getReference()); - fail("add to collection succeeded"); //$NON-NLS-1$ - } catch (UnsupportedOperationException e) { - // should get an exception - } catch (Exception e) { - fail("incorrect exception", e); //$NON-NLS-1$ - } - try { - references.addAll(Arrays.asList(new ServiceReference[] {reg2.getReference()})); - fail("addAll to collection succeeded"); //$NON-NLS-1$ - } catch (UnsupportedOperationException e) { - // should get an exception - } catch (Exception e) { - fail("incorrect exception", e); //$NON-NLS-1$ - } - } catch (AssertionFailedError a) { - hookErrors[1] = a; - return; + try { + references.add(reg2.getReference()); + fail("add to collection succeeded"); //$NON-NLS-1$ + } catch (UnsupportedOperationException e1) { + // should get an exception + } catch (Exception e2) { + fail("incorrect exception", e2); //$NON-NLS-1$ + } + try { + references.addAll((Collection<? extends ServiceReference<?>>) Arrays.asList(reg2.getReference())); + fail("addAll to collection succeeded"); //$NON-NLS-1$ + } catch (UnsupportedOperationException e3) { + // should get an exception + } catch (Exception e4) { + fail("incorrect exception", e4); //$NON-NLS-1$ } + } catch (AssertionFailedError a) { + hookErrors[1] = a; + return; } }, props); @@ -170,100 +163,96 @@ public class ServiceHookTests extends AbstractBundleTests { props.put(Constants.SERVICE_DESCRIPTION, "find hook 3"); //$NON-NLS-1$ props.put(Constants.SERVICE_DESCRIPTION, "max value second"); //$NON-NLS-1$ props.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MAX_VALUE)); - ServiceRegistration regHook3 = testContext.registerService(FindHook.class.getName(), new FindHook() { - public void find(BundleContext context, String name, String filter, boolean allServices, Collection references) { - try { - synchronized (hookCalled) { - if (!startTest[0]) - return; - hookCalled[++hookCalled[0]] = 3; - } - assertEquals("wrong context in hook", testContext, context); //$NON-NLS-1$ - assertEquals("wrong name in hook", Runnable.class.getName(), name); //$NON-NLS-1$ - assertEquals("wrong filter in hook", "(name=" + testMethodName + ")", filter); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - assertEquals("wrong allservices in hook", false, allServices); //$NON-NLS-1$ - assertEquals("wrong number of services in hook", 2, references.size()); //$NON-NLS-1$ - Iterator iter = references.iterator(); - while (iter.hasNext()) { - ServiceReference ref = (ServiceReference) iter.next(); - if (ref.equals(reg2.getReference())) { - fail("service 2 is present"); //$NON-NLS-1$ - } + ServiceRegistration regHook3 = testContext.registerService(FindHook.class.getName(), (FindHook) (context, name, filter, allServices, references) -> { + try { + synchronized (hookCalled) { + if (!startTest[0]) + return; + hookCalled[++hookCalled[0]] = 3; + } + assertEquals("wrong context in hook", testContext, context); //$NON-NLS-1$ + assertEquals("wrong name in hook", Runnable.class.getName(), name); //$NON-NLS-1$ + assertEquals("wrong filter in hook", "(name=" + testMethodName + ")", filter); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + assertEquals("wrong allservices in hook", false, allServices); //$NON-NLS-1$ + assertEquals("wrong number of services in hook", 2, references.size()); //$NON-NLS-1$ + Iterator iter = references.iterator(); + while (iter.hasNext()) { + ServiceReference ref = (ServiceReference) iter.next(); + if (ref.equals(reg2.getReference())) { + fail("service 2 is present"); //$NON-NLS-1$ } + } - try { - references.add(reg2.getReference()); - fail("add to collection succeeded"); //$NON-NLS-1$ - } catch (UnsupportedOperationException e) { - // should get an exception - } catch (Exception e) { - fail("incorrect exception", e); //$NON-NLS-1$ - } - try { - references.addAll(Arrays.asList(new ServiceReference[] {reg2.getReference()})); - fail("addAll to collection succeeded"); //$NON-NLS-1$ - } catch (UnsupportedOperationException e) { - // should get an exception - } catch (Exception e) { - fail("incorrect exception", e); //$NON-NLS-1$ - } - } catch (AssertionFailedError a) { - hookErrors[2] = a; - return; + try { + references.add(reg2.getReference()); + fail("add to collection succeeded"); //$NON-NLS-1$ + } catch (UnsupportedOperationException e1) { + // should get an exception + } catch (Exception e2) { + fail("incorrect exception", e2); //$NON-NLS-1$ + } + try { + references.addAll((Collection<? extends ServiceReference<?>>) Arrays.asList(reg2.getReference())); + fail("addAll to collection succeeded"); //$NON-NLS-1$ + } catch (UnsupportedOperationException e3) { + // should get an exception + } catch (Exception e4) { + fail("incorrect exception", e4); //$NON-NLS-1$ } - // throw an exception from the hook to test that the next hooks are called. - throw new RuntimeException(testMethodName); + } catch (AssertionFailedError a) { + hookErrors[2] = a; + return; } + // throw an exception from the hook to test that the next hooks are called. + throw new RuntimeException(testMethodName); }, props); // register find hook 4 props.put(Constants.SERVICE_DESCRIPTION, "find hook 4"); //$NON-NLS-1$ props.put(Constants.SERVICE_DESCRIPTION, "max value third"); //$NON-NLS-1$ props.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MAX_VALUE)); - ServiceRegistration regHook4 = testContext.registerService(FindHook.class.getName(), new FindHook() { - public void find(BundleContext context, String name, String filter, boolean allServices, Collection references) { - try { - synchronized (hookCalled) { - if (!startTest[0]) - return; - hookCalled[++hookCalled[0]] = 4; + ServiceRegistration regHook4 = testContext.registerService(FindHook.class.getName(), (FindHook) (context, name, filter, allServices, references) -> { + try { + synchronized (hookCalled) { + if (!startTest[0]) + return; + hookCalled[++hookCalled[0]] = 4; + } + assertEquals("wrong context in hook", testContext, context); //$NON-NLS-1$ + assertEquals("wrong name in hook", Runnable.class.getName(), name); //$NON-NLS-1$ + assertEquals("wrong filter in hook", "(name=" + testMethodName + ")", filter); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + assertEquals("wrong allservices in hook", false, allServices); //$NON-NLS-1$ + assertEquals("wrong number of services in hook", 2, references.size()); //$NON-NLS-1$ + Iterator iter = references.iterator(); + while (iter.hasNext()) { + ServiceReference ref = (ServiceReference) iter.next(); + if (ref.equals(reg1.getReference())) { + iter.remove(); } - assertEquals("wrong context in hook", testContext, context); //$NON-NLS-1$ - assertEquals("wrong name in hook", Runnable.class.getName(), name); //$NON-NLS-1$ - assertEquals("wrong filter in hook", "(name=" + testMethodName + ")", filter); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - assertEquals("wrong allservices in hook", false, allServices); //$NON-NLS-1$ - assertEquals("wrong number of services in hook", 2, references.size()); //$NON-NLS-1$ - Iterator iter = references.iterator(); - while (iter.hasNext()) { - ServiceReference ref = (ServiceReference) iter.next(); - if (ref.equals(reg1.getReference())) { - iter.remove(); - } - if (ref.equals(reg2.getReference())) { - fail("service 2 is present"); //$NON-NLS-1$ - } + if (ref.equals(reg2.getReference())) { + fail("service 2 is present"); //$NON-NLS-1$ } + } - try { - references.add(reg2.getReference()); - fail("add to collection succeeded"); //$NON-NLS-1$ - } catch (UnsupportedOperationException e) { - // should get an exception - } catch (Exception e) { - fail("incorrect exception", e); //$NON-NLS-1$ - } - try { - references.addAll(Arrays.asList(new ServiceReference[] {reg2.getReference()})); - fail("addAll to collection succeeded"); //$NON-NLS-1$ - } catch (UnsupportedOperationException e) { - // should get an exception - } catch (Exception e) { - fail("incorrect exception", e); //$NON-NLS-1$ - } - } catch (AssertionFailedError a) { - hookErrors[3] = a; - return; + try { + references.add(reg2.getReference()); + fail("add to collection succeeded"); //$NON-NLS-1$ + } catch (UnsupportedOperationException e1) { + // should get an exception + } catch (Exception e2) { + fail("incorrect exception", e2); //$NON-NLS-1$ + } + try { + references.addAll((Collection<? extends ServiceReference<?>>) Arrays.asList(reg2.getReference())); + fail("addAll to collection succeeded"); //$NON-NLS-1$ + } catch (UnsupportedOperationException e3) { + // should get an exception + } catch (Exception e4) { + fail("incorrect exception", e4); //$NON-NLS-1$ } + } catch (AssertionFailedError a) { + hookErrors[3] = a; + return; } }, props); @@ -347,11 +336,8 @@ public class ServiceHookTests extends AbstractBundleTests { public void testEventHook01() { final String testMethodName = "testEventHook01"; //$NON-NLS-1$ // test the EventHook is called and can remove a reference from the results - Runnable runIt = new Runnable() { - @Override - public void run() { - // nothing - } + Runnable runIt = () -> { + // nothing }; final BundleContext testContext = OSGiTestsActivator.getContext(); @@ -359,11 +345,9 @@ public class ServiceHookTests extends AbstractBundleTests { final AssertionFailedError[] hookErrors = new AssertionFailedError[] {null}; final List events = new ArrayList(); - final ServiceListener sl = new ServiceListener() { - public void serviceChanged(ServiceEvent event) { - synchronized (events) { - events.add(event); - } + final ServiceListener sl = event -> { + synchronized (events) { + events.add(event); } }; @@ -377,70 +361,66 @@ public class ServiceHookTests extends AbstractBundleTests { } final Filter filter = tmpFilter; - EventHook hook1 = new EventHook() { - public void event(ServiceEvent event, Collection contexts) { - try { - if (!filter.match(event.getServiceReference())) { - return; - } - synchronized (hookCalled) { - hookCalled[++hookCalled[0]] = 1; - } - assertTrue("does not contain test context", contexts.contains(testContext)); //$NON-NLS-1$ - - try { - contexts.add(testContext.getBundle(0).getBundleContext()); - fail("add to collection succeeded"); //$NON-NLS-1$ - } catch (UnsupportedOperationException e) { - // should get an exception - } catch (Exception e) { - fail("incorrect exception", e); //$NON-NLS-1$ - } - try { - contexts.addAll(Arrays.asList(new BundleContext[] {testContext.getBundle(0).getBundleContext()})); - fail("addAll to collection succeeded"); //$NON-NLS-1$ - } catch (UnsupportedOperationException e) { - // should get an exception - } catch (Exception e) { - fail("incorrect exception", e); //$NON-NLS-1$ - } - } catch (AssertionFailedError a) { - hookErrors[0] = a; + EventHook hook1 = (event, contexts) -> { + try { + if (!filter.match(event.getServiceReference())) { return; } + synchronized (hookCalled) { + hookCalled[++hookCalled[0]] = 1; + } + assertTrue("does not contain test context", contexts.contains(testContext)); //$NON-NLS-1$ + + try { + contexts.add(testContext.getBundle(0).getBundleContext()); + fail("add to collection succeeded"); //$NON-NLS-1$ + } catch (UnsupportedOperationException e1) { + // should get an exception + } catch (Exception e2) { + fail("incorrect exception", e2); //$NON-NLS-1$ + } + try { + contexts.addAll(Arrays.asList(new BundleContext[] {testContext.getBundle(0).getBundleContext()})); + fail("addAll to collection succeeded"); //$NON-NLS-1$ + } catch (UnsupportedOperationException e3) { + // should get an exception + } catch (Exception e4) { + fail("incorrect exception", e4); //$NON-NLS-1$ + } + } catch (AssertionFailedError a) { + hookErrors[0] = a; + return; } }; - EventHook hook2 = new EventHook() { - public void event(ServiceEvent event, Collection contexts) { - try { - if (!filter.match(event.getServiceReference())) { - return; - } - synchronized (hookCalled) { - hookCalled[++hookCalled[0]] = 1; - } - assertTrue("does not contain test context", contexts.contains(testContext)); //$NON-NLS-1$ - contexts.remove(testContext); - try { - contexts.add(testContext.getBundle(0).getBundleContext()); - fail("add to collection succeeded"); //$NON-NLS-1$ - } catch (UnsupportedOperationException e) { - // should get an exception - } catch (Exception e) { - fail("incorrect exception", e); //$NON-NLS-1$ - } - try { - contexts.addAll(Arrays.asList(new BundleContext[] {testContext.getBundle(0).getBundleContext()})); - fail("addAll to collection succeeded"); //$NON-NLS-1$ - } catch (UnsupportedOperationException e) { - // should get an exception - } catch (Exception e) { - fail("incorrect exception", e); //$NON-NLS-1$ - } - } catch (AssertionFailedError a) { - hookErrors[0] = a; + EventHook hook2 = (event, contexts) -> { + try { + if (!filter.match(event.getServiceReference())) { return; } + synchronized (hookCalled) { + hookCalled[++hookCalled[0]] = 1; + } + assertTrue("does not contain test context", contexts.contains(testContext)); //$NON-NLS-1$ + contexts.remove(testContext); + try { + contexts.add(testContext.getBundle(0).getBundleContext()); + fail("add to collection succeeded"); //$NON-NLS-1$ + } catch (UnsupportedOperationException e1) { + // should get an exception + } catch (Exception e2) { + fail("incorrect exception", e2); //$NON-NLS-1$ + } + try { + contexts.addAll(Arrays.asList(new BundleContext[] {testContext.getBundle(0).getBundleContext()})); + fail("addAll to collection succeeded"); //$NON-NLS-1$ + } catch (UnsupportedOperationException e3) { + // should get an exception + } catch (Exception e4) { + fail("incorrect exception", e4); //$NON-NLS-1$ + } + } catch (AssertionFailedError a) { + hookErrors[0] = a; + return; } }; @@ -560,10 +540,8 @@ public class ServiceHookTests extends AbstractBundleTests { assertEquals("removed called", 0, hookCalled[1]); //$NON-NLS-1$ int size = result.size(); - ServiceListener testSL = new ServiceListener() { - public void serviceChanged(ServiceEvent event) { - // do nothing - } + ServiceListener testSL = event -> { + // do nothing }; String filterString1 = "(foo=bar)"; //$NON-NLS-1$ testContext.addServiceListener(testSL, filterString1); @@ -675,10 +653,8 @@ public class ServiceHookTests extends AbstractBundleTests { assertEquals("removed called", 0, hookCalled[1]); //$NON-NLS-1$ int size = result.size(); - ServiceListener testSL = new ServiceListener() { - public void serviceChanged(ServiceEvent event) { - // do nothing - } + ServiceListener testSL = event -> { + // do nothing }; String filterString1 = "(" + Constants.OBJECTCLASS + "=bar)"; //$NON-NLS-1$ //$NON-NLS-2$ testContext.addServiceListener(testSL, filterString1); diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolver.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolver.java index 1ff229641..663c96c52 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolver.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolver.java @@ -1279,6 +1279,7 @@ final class ModuleResolver { if (dynamicAttachableFrags.isEmpty()) { return Collections.emptyMap(); } + // we only care about versions here Collections.sort(dynamicAttachableFrags, (r1, r2) -> -(r1.getVersion().compareTo(r2.getVersion()))); Map<ModuleCapability, DynamicFragments> hostDynamicFragments = new HashMap<>(); diff --git a/bundles/org.eclipse.osgi/supplement/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi/supplement/META-INF/MANIFEST.MF index ef800ade3..b4a9f5f89 100644 --- a/bundles/org.eclipse.osgi/supplement/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.osgi/supplement/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.supplement -Bundle-Version: 1.10.100.qualifier +Bundle-Version: 1.10.200.qualifier Bundle-Vendor: %providerName Bundle-Localization: plugin Export-Package: org.eclipse.equinox.log;version="1.1", diff --git a/bundles/org.eclipse.osgi/supplement/pom.xml b/bundles/org.eclipse.osgi/supplement/pom.xml index 56ef4ca33..705fb004d 100644 --- a/bundles/org.eclipse.osgi/supplement/pom.xml +++ b/bundles/org.eclipse.osgi/supplement/pom.xml @@ -21,7 +21,7 @@ <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.supplement</artifactId> - <version>1.10.100-SNAPSHOT</version> + <version>1.10.200-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/EventManager.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/EventManager.java index 32e1067c7..1d5286dd8 100644 --- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/EventManager.java +++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/EventManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2016 IBM Corporation and others. + * Copyright (c) 2003, 2021 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -195,13 +195,7 @@ public class EventManager { } if (thread == null) { /* if there is no thread, then create a new one */ - thread = AccessController.doPrivileged(new PrivilegedAction<EventThread<K, V, E>>() { - @Override - public EventThread<K, V, E> run() { - EventThread<K, V, E> t = new EventThread<>(threadGroup, threadName); - return t; - } - }); + thread = AccessController.doPrivileged((PrivilegedAction<EventThread<K, V, E>>) () -> new EventThread<>(threadGroup, threadName)); /* start the new thread */ thread.start(); } diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/NLS.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/NLS.java index a0c62b1d9..94f345838 100644 --- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/NLS.java +++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/NLS.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2016 IBM Corporation and others. + * Copyright (c) 2005, 2021 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -64,12 +64,7 @@ public abstract class NLS { private static String[] nlSuffixes; private static final String PROP_WARNINGS = "osgi.nls.warnings"; //$NON-NLS-1$ private static final String IGNORE = "ignore"; //$NON-NLS-1$ - private static final boolean ignoreWarnings = AccessController.doPrivileged(new PrivilegedAction<Boolean>() { - @Override - public Boolean run() { - return IGNORE.equals(System.getProperty(PROP_WARNINGS)); - } - }); + private static final boolean ignoreWarnings = AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> IGNORE.equals(System.getProperty(PROP_WARNINGS))); /* * NOTE do not change the name of this field; it is set by the Framework using reflection @@ -152,12 +147,9 @@ public abstract class NLS { load(baseName, clazz); return; } - AccessController.doPrivileged(new PrivilegedAction<Void>() { - @Override - public Void run() { - load(baseName, clazz); - return null; - } + AccessController.doPrivileged((PrivilegedAction<Void>) () -> { + load(baseName, clazz); + return null; }); } |