diff options
author | Carsten Hammer | 2019-05-14 16:27:04 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2019-10-17 20:55:43 +0000 |
commit | 0d428a84171d827d908012f415e437785ef9f566 (patch) | |
tree | 7be2e7b478d0f3f439fb005a9058e29fd541122f | |
parent | 12adf9d240b24cf478eb52768b3b67ae7e5942a7 (diff) | |
download | rt.equinox.bundles-0d428a84171d827d908012f415e437785ef9f566.tar.gz rt.equinox.bundles-0d428a84171d827d908012f415e437785ef9f566.tar.xz rt.equinox.bundles-0d428a84171d827d908012f415e437785ef9f566.zip |
Convert to lambda or member referenceI20191027-1800I20191026-1800I20191025-1805I20191024-1800I20191023-1810I20191022-1800I20191022-0405I20191020-1800I20191019-1800I20191018-1800I20191018-0720
Convert anonymous inner classes to lambda expressions or member
references.
Change-Id: I9f0cc7d4e0457bbdc64355b71ddfc77abe9b4901
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
8 files changed, 33 insertions, 64 deletions
diff --git a/bundles/org.eclipse.equinox.log.stream/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.log.stream/META-INF/MANIFEST.MF index 07650d1c3..758745388 100644 --- a/bundles/org.eclipse.equinox.log.stream/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.log.stream/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %bundleName Bundle-Vendor: %bundleVendor Bundle-SymbolicName: org.eclipse.equinox.log.stream -Bundle-Version: 1.0.100.qualifier +Bundle-Version: 1.0.200.qualifier Bundle-Activator: org.eclipse.equinox.internal.log.stream.LogStreamManager Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-Localization: plugin diff --git a/bundles/org.eclipse.equinox.log.stream/pom.xml b/bundles/org.eclipse.equinox.log.stream/pom.xml index a3391e2cc..e1d878b25 100644 --- a/bundles/org.eclipse.equinox.log.stream/pom.xml +++ b/bundles/org.eclipse.equinox.log.stream/pom.xml @@ -19,7 +19,7 @@ </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.log.stream</artifactId> - <version>1.0.100-SNAPSHOT</version> + <version>1.0.200-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> <build> diff --git a/bundles/org.eclipse.equinox.log.stream/src/org/eclipse/equinox/internal/log/stream/LogStreamProviderFactory.java b/bundles/org.eclipse.equinox.log.stream/src/org/eclipse/equinox/internal/log/stream/LogStreamProviderFactory.java index 511f67d61..3ec523d7b 100644 --- a/bundles/org.eclipse.equinox.log.stream/src/org/eclipse/equinox/internal/log/stream/LogStreamProviderFactory.java +++ b/bundles/org.eclipse.equinox.log.stream/src/org/eclipse/equinox/internal/log/stream/LogStreamProviderFactory.java @@ -7,7 +7,7 @@ * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -17,7 +17,6 @@ import java.util.HashMap; import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import java.util.concurrent.ThreadFactory; import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.locks.ReentrantReadWriteLock; import org.osgi.framework.Bundle; @@ -35,13 +34,10 @@ public class LogStreamProviderFactory implements ServiceFactory<LogStreamProvide ServiceTracker<LogReaderService, AtomicReference<LogReaderService>> logReaderService; private final int cores = Runtime.getRuntime().availableProcessors(); - private final ExecutorService executor = Executors.newFixedThreadPool(cores, new ThreadFactory() { - @Override - public Thread newThread(Runnable r) { - Thread t = new Thread(r, "LogStream thread"); //$NON-NLS-1$ - t.setDaemon(true); - return t; - } + private final ExecutorService executor = Executors.newFixedThreadPool(cores, (Runnable r) -> { + Thread t = new Thread(r, "LogStream thread"); //$NON-NLS-1$ + t.setDaemon(true); + return t; }); public LogStreamProviderFactory(ServiceTracker<LogReaderService, AtomicReference<LogReaderService>> logReaderService) { diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java index f47b4e947..07aadc255 100644 --- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java +++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java @@ -1220,22 +1220,19 @@ public class EclipsePreferences implements IEclipsePreferences, IScope { public String toDeepDebugString() { final StringBuffer buffer = new StringBuffer(); - IPreferenceNodeVisitor visitor = new IPreferenceNodeVisitor() { - @Override - public boolean visit(IEclipsePreferences node) throws BackingStoreException { - buffer.append(node); + IPreferenceNodeVisitor visitor = (IEclipsePreferences node) -> { + buffer.append(node); + buffer.append('\n'); + String[] keys = node.keys(); + for (String key : keys) { + buffer.append(node.absolutePath()); + buffer.append(PATH_SEPARATOR); + buffer.append(key); + buffer.append('='); + buffer.append(node.get(key, "*default*")); //$NON-NLS-1$ buffer.append('\n'); - String[] keys = node.keys(); - for (String key : keys) { - buffer.append(node.absolutePath()); - buffer.append(PATH_SEPARATOR); - buffer.append(key); - buffer.append('='); - buffer.append(node.get(key, "*default*")); //$NON-NLS-1$ - buffer.append('\n'); - } - return true; } + return true; }; try { accept(visitor); diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/SortedProperties.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/SortedProperties.java index 674860c1e..205b92d6c 100644 --- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/SortedProperties.java +++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/SortedProperties.java @@ -44,13 +44,10 @@ public class SortedProperties extends Properties { @Override public Set<Entry<Object, Object>> entrySet() { - TreeSet<Entry<Object, Object>> set = new TreeSet<>(new Comparator<Entry<Object, Object>>() { - @Override - public int compare(Entry<Object, Object> e1, Entry<Object, Object> e2) { - String s1 = (String) e1.getKey(); - String s2 = (String) e2.getKey(); - return s1.compareTo(s2); - } + TreeSet<Entry<Object, Object>> set = new TreeSet<>((Entry<Object, Object> e1, Entry<Object, Object> e2) -> { + String s1 = (String) e1.getKey(); + String s2 = (String) e2.getKey(); + return s1.compareTo(s2); }); for (Iterator<Entry<Object, Object>> i = super.entrySet().iterator(); i.hasNext();) { set.add(i.next()); diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionRegistry.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionRegistry.java index 445ad805a..25f44b892 100644 --- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionRegistry.java +++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionRegistry.java @@ -741,12 +741,7 @@ public class ExtensionRegistry implements IExtensionRegistry, IDynamicExtensionR } if (debugEvents()) - addRegistryChangeListener(new IRegistryChangeListener() { - @Override - public void registryChanged(IRegistryChangeEvent event) { - System.out.println(event); - } - }); + addRegistryChangeListener(System.out::println); // Do extra start processing if specified in the registry strategy strategy.onStart(this); // preserve for backward compatibility; might be removed later diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryProperties.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryProperties.java index 9f2571b6d..4f19d6248 100644 --- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryProperties.java +++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryProperties.java @@ -59,12 +59,9 @@ public class RegistryProperties { try { // Wrap BundleContext into an inner class to make sure it will only get loaded // if OSGi layer is present. - Runnable innerClass = new Runnable() { - @Override - public void run() { - org.osgi.framework.BundleContext bundleContext = (org.osgi.framework.BundleContext) context; - result[0] = bundleContext.getProperty(propertyName); - } + Runnable innerClass = () -> { + org.osgi.framework.BundleContext bundleContext = (org.osgi.framework.BundleContext) context; + result[0] = bundleContext.getProperty(propertyName); }; innerClass.run(); } catch (Exception e) { diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/runtime/dynamichelpers/ExtensionTracker.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/runtime/dynamichelpers/ExtensionTracker.java index dee661b77..c36520ad2 100644 --- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/runtime/dynamichelpers/ExtensionTracker.java +++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/runtime/dynamichelpers/ExtensionTracker.java @@ -259,12 +259,7 @@ public class ExtensionTracker implements IExtensionTracker, IRegistryChangeListe * @return a filter */ public static IFilter createExtensionPointFilter(final IExtensionPoint xpt) { - return new IFilter() { - @Override - public boolean matches(IExtensionPoint target) { - return xpt.equals(target); - } - }; + return xpt::equals; } /** @@ -274,16 +269,13 @@ public class ExtensionTracker implements IExtensionTracker, IRegistryChangeListe * @return a filter */ public static IFilter createExtensionPointFilter(final IExtensionPoint[] xpts) { - return new IFilter() { - @Override - public boolean matches(IExtensionPoint target) { - for (IExtensionPoint xpt : xpts) { - if (xpt.equals(target)) { - return true; - } + return (IExtensionPoint target) -> { + for (IExtensionPoint xpt : xpts) { + if (xpt.equals(target)) { + return true; } - return false; } + return false; }; } @@ -294,12 +286,7 @@ public class ExtensionTracker implements IExtensionTracker, IRegistryChangeListe * @return a filter */ public static IFilter createNamespaceFilter(final String id) { - return new IFilter() { - @Override - public boolean matches(IExtensionPoint target) { - return id.equals(target.getNamespaceIdentifier()); - } - }; + return (IExtensionPoint target) -> id.equals(target.getNamespaceIdentifier()); } private class HandlerWrapper { |