Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Hammer2019-05-14 12:27:04 -0400
committerAlexander Kurtakov2019-10-17 16:55:43 -0400
commit0d428a84171d827d908012f415e437785ef9f566 (patch)
tree7be2e7b478d0f3f439fb005a9058e29fd541122f
parent12adf9d240b24cf478eb52768b3b67ae7e5942a7 (diff)
downloadrt.equinox.bundles-0d428a84171d827d908012f415e437785ef9f566.tar.gz
rt.equinox.bundles-0d428a84171d827d908012f415e437785ef9f566.tar.xz
rt.equinox.bundles-0d428a84171d827d908012f415e437785ef9f566.zip
Convert anonymous inner classes to lambda expressions or member references. Change-Id: I9f0cc7d4e0457bbdc64355b71ddfc77abe9b4901 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
-rw-r--r--bundles/org.eclipse.equinox.log.stream/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.log.stream/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.log.stream/src/org/eclipse/equinox/internal/log/stream/LogStreamProviderFactory.java14
-rw-r--r--bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java25
-rw-r--r--bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/SortedProperties.java11
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionRegistry.java7
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryProperties.java9
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/runtime/dynamichelpers/ExtensionTracker.java27
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 07650d1c..75874538 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 a3391e2c..e1d878b2 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 511f67d6..3ec523d7 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 f47b4e94..07aadc25 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 674860c1..205b92d6 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 445ad805..25f44b89 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 9f2571b6..4f19d624 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 dee661b7..c36520ad 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 {

Back to the top