From 33adea0cc5b24e2f542a3bb5fac0583993d7eec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=8A?= =?UTF-8?q?=D1=80=20=D0=9A=D1=83=D1=80=D1=82=D0=B0=D0=BA=D0=BE=D0=B2?= Date: Fri, 15 Dec 2023 10:36:46 +0200 Subject: [PATCH] Convert to lambda in o.e.osgi --- .../osgi/framework/eventmgr/EventManager.java | 9 +++------ .../src/org/eclipse/osgi/util/NLS.java | 17 +++++------------ 2 files changed, 8 insertions(+), 18 deletions(-) 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 2de9e8fe465..151f1fb2669 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 @@ -194,12 +194,9 @@ synchronized EventThread getEventThread() { } if (thread == null) { /* if there is no thread, then create a new one */ - thread = AccessController.doPrivileged(new PrivilegedAction>() { - @Override - public EventThread run() { - EventThread t = new EventThread<>(threadGroup, threadName); - return t; - } + thread = AccessController.doPrivileged((PrivilegedAction>) () -> { + EventThread t = new EventThread<>(threadGroup, threadName); + return t; }); /* 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 0852d630e59..f0ce26bda21 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 @@ -64,12 +64,8 @@ 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() { - @Override - public Boolean run() { - return IGNORE.equals(System.getProperty(PROP_WARNINGS)); - } - }); + private static final boolean ignoreWarnings = AccessController + .doPrivileged((PrivilegedAction) () -> 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 +148,9 @@ public static void initializeMessages(final String baseName, final Class claz load(baseName, clazz); return; } - AccessController.doPrivileged(new PrivilegedAction() { - @Override - public Void run() { - load(baseName, clazz); - return null; - } + AccessController.doPrivileged((PrivilegedAction) () -> { + load(baseName, clazz); + return null; }); }