Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2018-05-15 08:47:31 +0000
committerLars Vogel2018-06-01 09:44:52 +0000
commit306daa015ce7a333db41287b24525b4485b88bc7 (patch)
tree30ce22967c781d2acecb8d303b409b05ff9e8af5 /bundles/org.eclipse.e4.core.di/src/org
parent81075b5966b4aa916b38e31efc15e9cadc4e7fe8 (diff)
downloadeclipse.platform.runtime-306daa015ce7a333db41287b24525b4485b88bc7.tar.gz
eclipse.platform.runtime-306daa015ce7a333db41287b24525b4485b88bc7.tar.xz
eclipse.platform.runtime-306daa015ce7a333db41287b24525b4485b88bc7.zip
Use lambdas in org.eclipse.e4.core.di
Change-Id: Ieb055388f3b13a6b7e22d4e52ace924d9bcdbaf0 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
Diffstat (limited to 'bundles/org.eclipse.e4.core.di/src/org')
-rw-r--r--bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/InjectorImpl.java23
-rw-r--r--bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/osgi/ProviderHelper.java11
2 files changed, 11 insertions, 23 deletions
diff --git a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/InjectorImpl.java b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/InjectorImpl.java
index 9492e2e1c..c47f75c73 100644
--- a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/InjectorImpl.java
+++ b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/InjectorImpl.java
@@ -25,7 +25,6 @@ import java.security.CodeSource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -382,13 +381,10 @@ public class InjectorImpl implements IInjector {
ArrayList<Constructor<?>> sortedConstructors = new ArrayList<>(constructors.length);
for (Constructor<?> constructor : constructors)
sortedConstructors.add(constructor);
- Collections.sort(sortedConstructors, new Comparator<Constructor<?>>() {
- @Override
- public int compare(Constructor<?> c1, Constructor<?> c2) {
- int l1 = c1.getParameterTypes().length;
- int l2 = c2.getParameterTypes().length;
- return l2 - l1;
- }
+ Collections.sort(sortedConstructors, (c1, c2) -> {
+ int l1 = c1.getParameterTypes().length;
+ int l2 = c2.getParameterTypes().length;
+ return l2 - l1;
});
for (Constructor<?> constructor : sortedConstructors) {
@@ -822,13 +818,10 @@ public class InjectorImpl implements IInjector {
constructors = c.getDeclaredConstructors();
// Sort the constructors by descending number of constructor
// arguments
- Arrays.sort(constructors, new Comparator<Constructor<?>>() {
- @Override
- public int compare(Constructor<?> c1, Constructor<?> c2) {
- int l1 = c1.getParameterTypes().length;
- int l2 = c2.getParameterTypes().length;
- return l2 - l1;
- }
+ Arrays.sort(constructors, (c1, c2) -> {
+ int l1 = c1.getParameterTypes().length;
+ int l2 = c2.getParameterTypes().length;
+ return l2 - l1;
});
constructorsCache.put(c, constructors);
}
diff --git a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/osgi/ProviderHelper.java b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/osgi/ProviderHelper.java
index e318be4ac..82e63053d 100644
--- a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/osgi/ProviderHelper.java
+++ b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/osgi/ProviderHelper.java
@@ -24,8 +24,6 @@ import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceListener;
import org.osgi.framework.ServiceReference;
/**
@@ -43,12 +41,9 @@ public class ProviderHelper {
BundleContext bundleContext = bundle.getBundleContext();
String filter = '(' + Constants.OBJECTCLASS + '=' + ExtendedObjectSupplier.SERVICE_NAME + ')';
try {
- bundleContext.addServiceListener(new ServiceListener() {
- @Override
- public void serviceChanged(ServiceEvent event) {
- synchronized (extendedSuppliers) {
- extendedSuppliers.clear();
- }
+ bundleContext.addServiceListener(event -> {
+ synchronized (extendedSuppliers) {
+ extendedSuppliers.clear();
}
}, filter);
} catch (InvalidSyntaxException e) {

Back to the top