Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHannes Wellmann2021-07-22 18:06:16 +0000
committerLars Vogel2021-07-23 06:43:44 +0000
commit84793cad4d2a540b3cf268d8848b9592e0726b0c (patch)
tree76e2289d46dbe2a9ee47537392c53100da2eb7bf
parent3bbcbfe8bee49c3534434abf1407ef6c54bc31ed (diff)
downloadrt.equinox.framework-84793cad4d2a540b3cf268d8848b9592e0726b0c.tar.gz
rt.equinox.framework-84793cad4d2a540b3cf268d8848b9592e0726b0c.tar.xz
rt.equinox.framework-84793cad4d2a540b3cf268d8848b9592e0726b0c.zip
Bug 574850 - [Clean-up] Remove generic type arguments where possible (1)
Clean up using the JDT clean-up: - Use diamond operator Change-Id: Ifcf67614c21e64c3c7e73e2191aba762e6b80b38 Signed-off-by: Hannes Wellmann <wellmann.hannes1@gmx.net> Reviewed-on: https://git.eclipse.org/r/c/equinox/rt.equinox.framework/+/183298 Tested-by: Equinox Bot <equinox-bot@eclipse.org> Tested-by: Lars Vogel <Lars.Vogel@vogella.com> Reviewed-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r--bundles/org.eclipse.osgi.services/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.osgi.services/pom.xml2
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/cm/ConfigurationPermission.java10
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/event/Event.java6
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/event/EventProperties.java6
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/event/TopicPermission.java10
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/http/context/ServletContextHelper.java4
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/UserAdminPermission.java4
-rw-r--r--bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/WirePermission.java4
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyContainerAdaptor.java4
-rw-r--r--bundles/org.eclipse.osgi.util/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.osgi.util/pom.xml2
-rw-r--r--bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/DeferredPromiseImpl.java8
-rw-r--r--bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/FailedPromiseImpl.java4
-rw-r--r--bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/PromiseImpl.java10
-rw-r--r--bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/ResolvedPromiseImpl.java4
-rw-r--r--bundles/org.eclipse.osgi.util/src/org/osgi/util/xml/XMLParserActivator.java8
-rwxr-xr-xbundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Candidates.java52
-rwxr-xr-xbundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/ResolverImpl.java102
-rwxr-xr-xbundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Util.java2
-rwxr-xr-xbundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/WrappedCapability.java4
-rwxr-xr-xbundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/WrappedResource.java8
-rwxr-xr-xbundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/ArrayMap.java2
-rwxr-xr-xbundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/CandidateSelector.java2
-rwxr-xr-xbundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/OpenHashMapSet.java4
-rwxr-xr-xbundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/ShadowList.java2
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdaptPermission.java8
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java14
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundlePermission.java10
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java14
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java14
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java14
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java18
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/SignerProperty.java4
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java4
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleSignerCondition.java4
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionInfo.java4
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/ResolutionException.java4
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/ResolveContext.java6
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/AbstractTracked.java8
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTracker.java4
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.java4
42 files changed, 201 insertions, 201 deletions
diff --git a/bundles/org.eclipse.osgi.services/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.services/META-INF/MANIFEST.MF
index bf6dab524..70ecd4b01 100644
--- a/bundles/org.eclipse.osgi.services/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.osgi.services/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %osgiServices
Bundle-SymbolicName: org.eclipse.osgi.services
-Bundle-Version: 3.10.100.qualifier
+Bundle-Version: 3.10.200.qualifier
Bundle-Description: %osgiServicesDes
Bundle-Localization: plugin
Bundle-Vendor: %eclipse.org
diff --git a/bundles/org.eclipse.osgi.services/pom.xml b/bundles/org.eclipse.osgi.services/pom.xml
index a4843471d..8b0e2004a 100644
--- a/bundles/org.eclipse.osgi.services/pom.xml
+++ b/bundles/org.eclipse.osgi.services/pom.xml
@@ -19,7 +19,7 @@
</parent>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
- <version>3.10.100-SNAPSHOT</version>
+ <version>3.10.200-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/cm/ConfigurationPermission.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/cm/ConfigurationPermission.java
index 949278d47..9acbdc187 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/cm/ConfigurationPermission.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/cm/ConfigurationPermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2017). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -245,7 +245,7 @@ public final class ConfigurationPermission extends BasicPermission {
char[] chars = name.toCharArray();
StringBuilder sb = new StringBuilder(chars.length);
- List<String> sub = new ArrayList<String>(10);
+ List<String> sub = new ArrayList<>(10);
for (int pos = 0; pos < chars.length; pos++) {
char c = chars[pos];
@@ -519,7 +519,7 @@ final class ConfigurationPermissionCollection extends PermissionCollection {
*
*/
public ConfigurationPermissionCollection() {
- permissions = new HashMap<String, ConfigurationPermission>();
+ permissions = new HashMap<>();
all_allowed = false;
}
@@ -619,7 +619,7 @@ final class ConfigurationPermissionCollection extends PermissionCollection {
*/
@Override
public synchronized Enumeration<Permission> elements() {
- List<Permission> all = new ArrayList<Permission>(permissions.values());
+ List<Permission> all = new ArrayList<>(permissions.values());
return Collections.enumeration(all);
}
@@ -639,7 +639,7 @@ final class ConfigurationPermissionCollection extends PermissionCollection {
ObjectInputStream.GetField gfields = in.readFields();
boolean hasElement = gfields.get("hasElement", false);
if (hasElement) { // old format
- permissions = new HashMap<String, ConfigurationPermission>();
+ permissions = new HashMap<>();
permissions.put("*", new ConfigurationPermission("*", ConfigurationPermission.CONFIGURE));
all_allowed = true;
} else {
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/Event.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/Event.java
index fd99f3152..b42811d7b 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/Event.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/Event.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2014). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -252,7 +252,7 @@ public class Event {
@Override
public Enumeration<Object> elements() {
Collection<Object> values = properties.values();
- List<Object> result = new ArrayList<Object>(values.size() + 1);
+ List<Object> result = new ArrayList<>(values.size() + 1);
result.add(topic);
result.addAll(values);
return Collections.enumeration(result);
@@ -274,7 +274,7 @@ public class Event {
@Override
public Enumeration<String> keys() {
Collection<String> keys = properties.keySet();
- List<String> result = new ArrayList<String>(keys.size() + 1);
+ List<String> result = new ArrayList<>(keys.size() + 1);
result.add(EVENT_TOPIC);
result.addAll(keys);
return Collections.enumeration(result);
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/EventProperties.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/EventProperties.java
index 1ecc2e9ea..e4cd71cec 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/EventProperties.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/EventProperties.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2015). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -64,7 +64,7 @@ public class EventProperties implements Map<String, Object> {
*/
public EventProperties(Map<String, ?> properties) {
int size = (properties == null) ? 0 : properties.size();
- Map<String, Object> p = new HashMap<String, Object>(size);
+ Map<String, Object> p = new HashMap<>(size);
if (size > 0) {
for (Object key : (Set<?>) properties.keySet()) {
if ((key instanceof String) && !EVENT_TOPIC.equals(key)) {
@@ -90,7 +90,7 @@ public class EventProperties implements Map<String, Object> {
*/
EventProperties(Dictionary<String, ?> properties) {
int size = (properties == null) ? 0 : properties.size();
- Map<String, Object> p = new HashMap<String, Object>(size);
+ Map<String, Object> p = new HashMap<>(size);
if (size > 0) {
for (Enumeration<?> e = properties.keys(); e.hasMoreElements();) {
Object key = e.nextElement();
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/TopicPermission.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/TopicPermission.java
index a315cdc5c..45690ef33 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/TopicPermission.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/event/TopicPermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2016). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -405,7 +405,7 @@ final class TopicPermissionCollection extends PermissionCollection {
*
*/
public TopicPermissionCollection() {
- permissions = new HashMap<String, TopicPermission>();
+ permissions = new HashMap<>();
all_allowed = false;
}
@@ -523,7 +523,7 @@ final class TopicPermissionCollection extends PermissionCollection {
*/
@Override
public synchronized Enumeration<Permission> elements() {
- List<Permission> all = new ArrayList<Permission>(permissions.values());
+ List<Permission> all = new ArrayList<>(permissions.values());
return Collections.enumeration(all);
}
@@ -531,7 +531,7 @@ final class TopicPermissionCollection extends PermissionCollection {
private static final ObjectStreamField[] serialPersistentFields = {new ObjectStreamField("permissions", Hashtable.class), new ObjectStreamField("all_allowed", Boolean.TYPE)};
private synchronized void writeObject(ObjectOutputStream out) throws IOException {
- Hashtable<String, TopicPermission> hashtable = new Hashtable<String, TopicPermission>(permissions);
+ Hashtable<String, TopicPermission> hashtable = new Hashtable<>(permissions);
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("permissions", hashtable);
pfields.put("all_allowed", all_allowed);
@@ -542,7 +542,7 @@ final class TopicPermissionCollection extends PermissionCollection {
ObjectInputStream.GetField gfields = in.readFields();
@SuppressWarnings("unchecked")
Hashtable<String, TopicPermission> hashtable = (Hashtable<String, TopicPermission>) gfields.get("permissions", null);
- permissions = new HashMap<String, TopicPermission>(hashtable);
+ permissions = new HashMap<>(hashtable);
all_allowed = gfields.get("all_allowed", false);
}
}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/context/ServletContextHelper.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/context/ServletContextHelper.java
index 3808a8548..e266f16ed 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/context/ServletContextHelper.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/http/context/ServletContextHelper.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2018). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -305,7 +305,7 @@ public abstract class ServletContextHelper {
if ((path != null) && (bundle != null)) {
final Enumeration<URL> e = bundle.findEntries(path, null, false);
if (e != null) {
- final Set<String> result = new LinkedHashSet<String>();
+ final Set<String> result = new LinkedHashSet<>();
while (e.hasMoreElements()) {
result.add(e.nextElement().getPath());
}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/UserAdminPermission.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/UserAdminPermission.java
index b950fbd87..c2fe44ec8 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/UserAdminPermission.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/useradmin/UserAdminPermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2016). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -613,7 +613,7 @@ final class UserAdminPermissionCollection extends PermissionCollection {
*/
@Override
public Enumeration<Permission> elements() {
- List<Permission> all = new ArrayList<Permission>(permissions.values());
+ List<Permission> all = new ArrayList<>(permissions.values());
return Collections.enumeration(all);
}
}
diff --git a/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/WirePermission.java b/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/WirePermission.java
index 53e2f6000..8dde0aef8 100644
--- a/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/WirePermission.java
+++ b/bundles/org.eclipse.osgi.services/src/org/osgi/service/wireadmin/WirePermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2016). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -466,7 +466,7 @@ final class WirePermissionCollection extends PermissionCollection {
*/
@Override
public Enumeration<Permission> elements() {
- List<Permission> all = new ArrayList<Permission>(permissions.values());
+ List<Permission> all = new ArrayList<>(permissions.values());
return Collections.enumeration(all);
}
}
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyContainerAdaptor.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyContainerAdaptor.java
index bf93063a8..e7f9254ba 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyContainerAdaptor.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/dummys/DummyContainerAdaptor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2018 IBM Corporation and others.
+ * Copyright (c) 2012, 2021 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -57,7 +57,7 @@ public class DummyContainerAdaptor extends ModuleContainerAdaptor {
public DummyContainerAdaptor(ModuleCollisionHook collisionHook, Map<String, String> configuration, ResolverHookFactory resolverHookFactory, DebugOptions debugOptions) {
this.collisionHook = collisionHook;
- this.configuration = configuration == null ? new HashMap<String, String>() : configuration;
+ this.configuration = configuration == null ? new HashMap<>() : configuration;
this.resolverHookFactory = resolverHookFactory;
this.moduleDatabase = new DummyModuleDatabase(this);
this.debugOptions = debugOptions;
diff --git a/bundles/org.eclipse.osgi.util/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.util/META-INF/MANIFEST.MF
index c29543d20..9b5dfddfc 100644
--- a/bundles/org.eclipse.osgi.util/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.osgi.util/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %osgiUtil
Bundle-SymbolicName: org.eclipse.osgi.util
-Bundle-Version: 3.6.0.qualifier
+Bundle-Version: 3.6.100.qualifier
Bundle-Description: %osgiUtilDes
Bundle-Vendor: %eclipse.org
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.osgi.util/pom.xml b/bundles/org.eclipse.osgi.util/pom.xml
index 0351db974..026435de7 100644
--- a/bundles/org.eclipse.osgi.util/pom.xml
+++ b/bundles/org.eclipse.osgi.util/pom.xml
@@ -19,7 +19,7 @@
</parent>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi.util</artifactId>
- <version>3.6.0-SNAPSHOT</version>
+ <version>3.6.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
diff --git a/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/DeferredPromiseImpl.java b/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/DeferredPromiseImpl.java
index dcd40c58a..3969a37c6 100644
--- a/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/DeferredPromiseImpl.java
+++ b/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/DeferredPromiseImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2014, 2018). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2014, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -141,12 +141,12 @@ final class DeferredPromiseImpl<T> extends PromiseImpl<T> {
Result<T> collect() {
// ensure latch open before reading state
if (!isDone()) {
- return new Result<T>(new AssertionError("promise not resolved"));
+ return new Result<>(new AssertionError("promise not resolved"));
}
if (fail == null) {
- return new Result<T>(value);
+ return new Result<>(value);
}
- return new Result<T>(fail);
+ return new Result<>(fail);
}
@Override
diff --git a/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/FailedPromiseImpl.java b/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/FailedPromiseImpl.java
index dd5b6094d..9bec4b56c 100644
--- a/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/FailedPromiseImpl.java
+++ b/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/FailedPromiseImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2017). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2017, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -81,7 +81,7 @@ final class FailedPromiseImpl<T> extends PromiseImpl<T> {
*/
@Override
Result<T> collect() {
- return new Result<T>(fail);
+ return new Result<>(fail);
}
@Override
diff --git a/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/PromiseImpl.java b/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/PromiseImpl.java
index 299222bcf..b8c475de1 100644
--- a/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/PromiseImpl.java
+++ b/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/PromiseImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2014, 2018). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2014, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -392,17 +392,17 @@ abstract class PromiseImpl<T> implements Promise<T> {
return impl.collect();
}
if (!promise.isDone()) {
- return new Result<R>(new AssertionError("promise not resolved"));
+ return new Result<>(new AssertionError("promise not resolved"));
}
final boolean interrupted = Thread.interrupted();
try {
Throwable fail = promise.getFailure();
if (fail == null) {
- return new Result<R>(promise.getValue());
+ return new Result<>(promise.getValue());
}
- return new Result<R>(fail);
+ return new Result<>(fail);
} catch (Throwable e) {
- return new Result<R>(e); // propagate new exception
+ return new Result<>(e); // propagate new exception
} finally {
if (interrupted) { // restore interrupt status
Thread.currentThread().interrupt();
diff --git a/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/ResolvedPromiseImpl.java b/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/ResolvedPromiseImpl.java
index e5fa47a9a..70fbc3f39 100644
--- a/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/ResolvedPromiseImpl.java
+++ b/bundles/org.eclipse.osgi.util/src/org/osgi/util/promise/ResolvedPromiseImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2017). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2017, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -78,7 +78,7 @@ final class ResolvedPromiseImpl<T> extends PromiseImpl<T> {
*/
@Override
Result<T> collect() {
- return new Result<T>(value);
+ return new Result<>(value);
}
@Override
diff --git a/bundles/org.eclipse.osgi.util/src/org/osgi/util/xml/XMLParserActivator.java b/bundles/org.eclipse.osgi.util/src/org/osgi/util/xml/XMLParserActivator.java
index a7e84c4ac..cad340e74 100644
--- a/bundles/org.eclipse.osgi.util/src/org/osgi/util/xml/XMLParserActivator.java
+++ b/bundles/org.eclipse.osgi.util/src/org/osgi/util/xml/XMLParserActivator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2017). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -191,7 +191,7 @@ public class XMLParserActivator implements BundleActivator, ServiceFactory<Objec
if (parserUrl == null) {
return Collections.emptyList();
}
- List<String> v = new ArrayList<String>(1);
+ List<String> v = new ArrayList<>(1);
String parserFactoryClassName = null;
InputStream is = parserUrl.openStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
@@ -234,7 +234,7 @@ public class XMLParserActivator implements BundleActivator, ServiceFactory<Objec
// this class will operate as a service factory and give each
// service requestor it's own SaxParserFactory
SAXParserFactory factory = (SAXParserFactory) getFactory(parserFactoryClassName);
- Hashtable<String, Object> properties = new Hashtable<String, Object>(7);
+ Hashtable<String, Object> properties = new Hashtable<>(7);
// figure out the default properties of the parser
setDefaultSAXProperties(factory, properties, index);
// store the parser factory class name in the properties so that
@@ -333,7 +333,7 @@ public class XMLParserActivator implements BundleActivator, ServiceFactory<Objec
// this class will operate as a service factory and give each
// service requestor it's own DocumentBuilderFactory
DocumentBuilderFactory factory = (DocumentBuilderFactory) getFactory(parserFactoryClassName);
- Hashtable<String, Object> properties = new Hashtable<String, Object>(7);
+ Hashtable<String, Object> properties = new Hashtable<>(7);
// figure out the default properties of the parser
setDefaultDOMProperties(factory, properties, index);
// store the parser factory class name in the properties so that
diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Candidates.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Candidates.java
index bfb1b4681..c06eb7eb1 100755
--- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Candidates.java
+++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Candidates.java
@@ -93,12 +93,12 @@ class Candidates
{
m_session = session;
m_candidateSelectorsUnmodifiable = new AtomicBoolean(false);
- m_dependentMap = new OpenHashMapSet<Capability, Requirement>();
+ m_dependentMap = new OpenHashMapSet<>();
m_candidateMap = new OpenHashMapList();
- m_allWrappedHosts = new HashMap<Resource, WrappedResource>();
- m_populateResultCache = new OpenHashMap<Resource, PopulateResult>();
- m_subtitutableMap = new OpenHashMap<Capability, Requirement>();
- m_delta = new OpenHashMapSet<Requirement, Capability>(3);
+ m_allWrappedHosts = new HashMap<>();
+ m_populateResultCache = new OpenHashMap<>();
+ m_subtitutableMap = new OpenHashMap<>();
+ m_delta = new OpenHashMapSet<>(3);
}
public int getNbResources()
@@ -108,7 +108,7 @@ class Candidates
public Map<Resource, Resource> getRootHosts()
{
- Map<Resource, Resource> hosts = new LinkedHashMap<Resource, Resource>();
+ Map<Resource, Resource> hosts = new LinkedHashMap<>();
for (Resource res : m_session.getMandatoryResources())
{
addHost(res, hosts);
@@ -160,8 +160,8 @@ class Candidates
public void populate(Collection<Resource> resources)
{
ResolveContext rc = m_session.getContext();
- Set<Resource> toRemove = new HashSet<Resource>();
- LinkedList<Resource> toPopulate = new LinkedList<Resource>(resources);
+ Set<Resource> toRemove = new HashSet<>();
+ LinkedList<Resource> toPopulate = new LinkedList<>(resources);
while (!toPopulate.isEmpty())
{
Resource resource = toPopulate.getFirst();
@@ -170,8 +170,8 @@ class Candidates
if (result == null)
{
result = new PopulateResult();
- result.candidates = new OpenHashMap<Requirement, List<Capability>>();
- result.remaining = new ArrayList<Requirement>(resource.getRequirements(null));
+ result.candidates = new OpenHashMap<>();
+ result.remaining = new ArrayList<>(resource.getRequirements(null));
m_populateResultCache.put(resource, result);
}
if (result.success || result.error != null)
@@ -206,7 +206,7 @@ class Candidates
continue;
}
List<Capability> candidates = rc.findProviders(requirement);
- LinkedList<Resource> newToPopulate = new LinkedList<Resource>();
+ LinkedList<Resource> newToPopulate = new LinkedList<>();
ResolutionError thrown = processCandidates(newToPopulate, requirement, candidates);
if (candidates.isEmpty() && !Util.isOptional(requirement))
{
@@ -270,7 +270,7 @@ class Candidates
OpenHashMap<String, List<Capability>> exportNames = new OpenHashMap<String, List<Capability>>() {
@Override
protected List<Capability> compute(String s) {
- return new ArrayList<Capability>(1);
+ return new ArrayList<>(1);
}
};
for (Capability packageExport : resource.getCapabilities(null))
@@ -322,7 +322,7 @@ class Candidates
ResolutionError checkSubstitutes()
{
- OpenHashMap<Capability, Integer> substituteStatuses = new OpenHashMap<Capability, Integer>(m_subtitutableMap.size());
+ OpenHashMap<Capability, Integer> substituteStatuses = new OpenHashMap<>(m_subtitutableMap.size());
for (Capability substitutable : m_subtitutableMap.keySet())
{
// initialize with unprocessed
@@ -451,7 +451,7 @@ class Candidates
// Process the candidates, removing any candidates that
// cannot resolve.
// TODO: verify the two following statements
- LinkedList<Resource> toPopulate = new LinkedList<Resource>();
+ LinkedList<Resource> toPopulate = new LinkedList<>();
ResolutionError rethrow = processCandidates(toPopulate, m_session.getDynamicRequirement(), m_session.getDynamicCandidates());
// Add the dynamic imports candidates.
@@ -509,7 +509,7 @@ class Candidates
{
if (fragmentCands == null)
{
- fragmentCands = new HashSet<Capability>();
+ fragmentCands = new HashSet<>();
}
fragmentCands.add(candCap);
}
@@ -729,7 +729,7 @@ class Candidates
// this is a special case where we need to completely replace the CandidateSelector
// this method should never be called from normal Candidates permutations
CandidateSelector candidates = m_candidateMap.get(req);
- List<Capability> remaining = new ArrayList<Capability>(candidates.getRemainingCandidates());
+ List<Capability> remaining = new ArrayList<>(candidates.getRemainingCandidates());
remaining.removeAll(caps);
candidates = new CandidateSelector(remaining, m_candidateSelectorsUnmodifiable);
m_candidateMap.put(req, candidates);
@@ -776,15 +776,15 @@ class Candidates
// requirements as well as replacing fragment capabilities
// with host's attached fragment capabilities.
// Steps 1 and 2
- List<WrappedResource> hostResources = new ArrayList<WrappedResource>();
- List<Resource> unselectedFragments = new ArrayList<Resource>();
+ List<WrappedResource> hostResources = new ArrayList<>();
+ List<Resource> unselectedFragments = new ArrayList<>();
for (Entry<Capability, Map<String, Map<Version, List<Requirement>>>> hostEntry : hostFragments.entrySet())
{
// Step 1
Capability hostCap = hostEntry.getKey();
Map<String, Map<Version, List<Requirement>>> fragments =
hostEntry.getValue();
- List<Resource> selectedFragments = new ArrayList<Resource>();
+ List<Resource> selectedFragments = new ArrayList<>();
for (Entry<String, Map<Version, List<Requirement>>> fragEntry
: fragments.entrySet())
{
@@ -876,7 +876,7 @@ class Candidates
CopyOnWriteSet<Requirement> dependents = m_dependentMap.get(origCap);
if (dependents != null)
{
- dependents = new CopyOnWriteSet<Requirement>(dependents);
+ dependents = new CopyOnWriteSet<>(dependents);
m_dependentMap.put(c, dependents);
for (Requirement r : dependents)
{
@@ -972,7 +972,7 @@ class Candidates
private Map<Capability, Map<String, Map<Version, List<Requirement>>>> getHostFragments()
{
Map<Capability, Map<String, Map<Version, List<Requirement>>>> hostFragments =
- new HashMap<Capability, Map<String, Map<Version, List<Requirement>>>>();
+ new HashMap<>();
for (Entry<Requirement, CandidateSelector> entry : m_candidateMap.fast())
{
Requirement req = entry.getKey();
@@ -988,20 +988,20 @@ class Candidates
Map<String, Map<Version, List<Requirement>>> fragments = hostFragments.get(cap);
if (fragments == null)
{
- fragments = new HashMap<String, Map<Version, List<Requirement>>>();
+ fragments = new HashMap<>();
hostFragments.put(cap, fragments);
}
Map<Version, List<Requirement>> fragmentVersions = fragments.get(resSymName);
if (fragmentVersions == null)
{
fragmentVersions =
- new TreeMap<Version, List<Requirement>>(Collections.reverseOrder());
+ new TreeMap<>(Collections.reverseOrder());
fragments.put(resSymName, fragmentVersions);
}
List<Requirement> actual = fragmentVersions.get(resVersion);
if (actual == null)
{
- actual = new ArrayList<Requirement>();
+ actual = new ArrayList<>();
if (resVersion == null)
resVersion = new Version(0, 0, 0);
fragmentVersions.put(resVersion, actual);
@@ -1030,7 +1030,7 @@ class Candidates
result.success = false;
result.error = ex;
// Remove from dependents.
- Set<Resource> unresolvedResources = new HashSet<Resource>();
+ Set<Resource> unresolvedResources = new HashSet<>();
remove(resource, unresolvedResources);
// Remove dependents that failed as a result of removing revision.
while (!unresolvedResources.isEmpty())
@@ -1150,7 +1150,7 @@ class Candidates
public void dump(ResolveContext rc)
{
// Create set of all revisions from requirements.
- Set<Resource> resources = new CopyOnWriteSet<Resource>();
+ Set<Resource> resources = new CopyOnWriteSet<>();
for (Entry<Requirement, CandidateSelector> entry
: m_candidateMap.entrySet())
{
diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/ResolverImpl.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/ResolverImpl.java
index 6c9b278db..ab48fd5f4 100755
--- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/ResolverImpl.java
+++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/ResolverImpl.java
@@ -64,19 +64,19 @@ public class ResolverImpl implements Resolver
private final List<Capability> m_dynamicCandidates;
// keeps track of valid related resources that we have seen.
// a null value or TRUE indicate it is valid
- private Map<Resource, Boolean> m_validRelatedResources = new HashMap<Resource, Boolean>(0);
+ private Map<Resource, Boolean> m_validRelatedResources = new HashMap<>(0);
// keeps track of related resources for each resource
- private Map<Resource, Collection<Resource>> m_relatedResources = new HashMap<Resource, Collection<Resource>>(0);
+ private Map<Resource, Collection<Resource>> m_relatedResources = new HashMap<>(0);
// Holds candidate permutations based on permutating "uses" chains.
// These permutations are given higher priority.
- private final List<Candidates> m_usesPermutations = new LinkedList<Candidates>();
+ private final List<Candidates> m_usesPermutations = new LinkedList<>();
private int m_usesIndex = 0;
// Holds candidate permutations based on permutating requirement candidates.
// These permutations represent backtracking on previous decisions.
- private final List<Candidates> m_importPermutations = new LinkedList<Candidates>();
+ private final List<Candidates> m_importPermutations = new LinkedList<>();
private int m_importIndex = 0;
// Holds candidate permutations based on substituted packages
- private final List<Candidates> m_substPermutations = new LinkedList<Candidates>();
+ private final List<Candidates> m_substPermutations = new LinkedList<>();
private int m_substituteIndex = 0;
// Holds candidate permutations based on removing candidates that satisfy
// multiple cardinality requirements.
@@ -84,11 +84,11 @@ public class ResolverImpl implements Resolver
// removed the offending capabilities
private Candidates m_multipleCardCandidates = null;
// The delta is used to detect that we have already processed this particular permutation
- private final Set<Object> m_processedDeltas = new HashSet<Object>();
+ private final Set<Object> m_processedDeltas = new HashSet<>();
private final Executor m_executor;
- private final Set<Requirement> m_mutated = new HashSet<Requirement>();
- private final Set<Requirement> m_sub_mutated = new HashSet<Requirement>();
- private final ConcurrentMap<String, List<String>> m_usesCache = new ConcurrentHashMap<String, List<String>>();
+ private final Set<Requirement> m_mutated = new HashSet<>();
+ private final Set<Requirement> m_sub_mutated = new HashSet<>();
+ private final ConcurrentMap<String, List<String>> m_usesCache = new ConcurrentHashMap<>();
private ResolutionError m_currentError;
volatile private CancellationException m_isCancelled = null;
@@ -114,8 +114,8 @@ public class ResolverImpl implements Resolver
m_optionalResources = Collections.emptyList();
} else {
// Do not call resolve context yet, onCancel must be called first
- m_mandatoryResources = new ArrayList<Resource>();
- m_optionalResources = new ArrayList<Resource>();
+ m_mandatoryResources = new ArrayList<>();
+ m_optionalResources = new ArrayList<>();
}
}
@@ -421,7 +421,7 @@ public class ResolverImpl implements Resolver
}
private Map<Resource, List<Wire>> doResolve(ResolveSession session) throws ResolutionException {
- Map<Resource, List<Wire>> wireMap = new HashMap<Resource, List<Wire>>();
+ Map<Resource, List<Wire>> wireMap = new HashMap<>();
boolean retry;
do
{
@@ -433,7 +433,7 @@ public class ResolverImpl implements Resolver
throw session.getCurrentError().toException();
}
- Map<Resource, ResolutionError> faultyResources = new HashMap<Resource, ResolutionError>();
+ Map<Resource, ResolutionError> faultyResources = new HashMap<>();
Candidates allCandidates = findValidCandidates(session, faultyResources);
session.checkForCancel();
@@ -517,7 +517,7 @@ public class ResolverImpl implements Resolver
return;
}
} else {
- List<Resource> toPopulate = new ArrayList<Resource>();
+ List<Resource> toPopulate = new ArrayList<>();
// Populate mandatory resources; since these are mandatory
// resources, failure throws a resolve exception.
@@ -568,7 +568,7 @@ public class ResolverImpl implements Resolver
//allCandidates.dump();
- Map<Resource, ResolutionError> currentFaultyResources = new HashMap<Resource, ResolutionError>();
+ Map<Resource, ResolutionError> currentFaultyResources = new HashMap<>();
session.setCurrentError(
checkConsistency(
@@ -615,7 +615,7 @@ public class ResolverImpl implements Resolver
ResolutionError error = null;
// Check package consistency
Map<Resource, Object> resultCache =
- new OpenHashMap<Resource, Object>(resourcePkgMap.size());
+ new OpenHashMap<>(resourcePkgMap.size());
for (Entry<Resource, Resource> entry : allhosts.entrySet())
{
rethrow = checkPackageSpaceConsistency(
@@ -678,7 +678,7 @@ public class ResolverImpl implements Resolver
{
// Create a list for requirement and proposed candidate
// capability or actual capability if resource is resolved or not.
- List<WireCandidate> wireCandidates = new ArrayList<WireCandidate>(256);
+ List<WireCandidate> wireCandidates = new ArrayList<>(256);
Wiring wiring = session.getContext().getWirings().get(resource);
if (wiring != null)
{
@@ -825,7 +825,7 @@ public class ResolverImpl implements Resolver
// we need to calculate its uses constraints again to make sure the new
// import is consistent with the existing package space.
Wiring wiring = session.getContext().getWirings().get(resource);
- Set<Capability> usesCycleMap = new HashSet<Capability>();
+ Set<Capability> usesCycleMap = new HashSet<>();
int size = wireCandidates.size();
boolean isDynamicImporting = size > 0
@@ -1094,13 +1094,13 @@ public class ResolverImpl implements Resolver
}
ArrayMap<Set<Capability>, UsedBlames> usedPkgBlames = currentPkgs.m_usedPkgs.getOrCompute(usedPkgName);
- List<Blame> newBlames = new ArrayList<Blame>();
+ List<Blame> newBlames = new ArrayList<>();
for (Blame blame : candSourceBlames)
{
List<Requirement> newBlameReqs;
if (blame.m_reqs != null)
{
- newBlameReqs = new ArrayList<Requirement>(blameReqs.size() + 1);
+ newBlameReqs = new ArrayList<>(blameReqs.size() + 1);
newBlameReqs.addAll(blameReqs);
// Only add the last requirement in blame chain because
// that is the requirement wired to the blamed capability
@@ -1130,9 +1130,9 @@ public class ResolverImpl implements Resolver
final EnhancedExecutor executor = new EnhancedExecutor(session.getExecutor());
// Parallel compute wire candidates
- final Map<Resource, List<WireCandidate>> allWireCandidates = new ConcurrentHashMap<Resource, List<WireCandidate>>();
+ final Map<Resource, List<WireCandidate>> allWireCandidates = new ConcurrentHashMap<>();
{
- final ConcurrentMap<Resource, Runnable> tasks = new ConcurrentHashMap<Resource, Runnable>(allCandidates.getNbResources());
+ final ConcurrentMap<Resource, Runnable> tasks = new ConcurrentHashMap<>(allCandidates.getNbResources());
class Computer implements Runnable
{
final Resource resource;
@@ -1166,7 +1166,7 @@ public class ResolverImpl implements Resolver
}
// Parallel get all exported packages
- final OpenHashMap<Resource, Packages> allPackages = new OpenHashMap<Resource, Packages>(allCandidates.getNbResources());
+ final OpenHashMap<Resource, Packages> allPackages = new OpenHashMap<>(allCandidates.getNbResources());
for (final Resource resource : allWireCandidates.keySet())
{
final Packages packages = new Packages(resource);
@@ -1251,7 +1251,7 @@ public class ResolverImpl implements Resolver
nb++;
}
}
- List<String> uses = new ArrayList<String>(nb);
+ List<String> uses = new ArrayList<>(nb);
int start = 0;
while (true) {
while (start < l) {
@@ -1289,7 +1289,7 @@ public class ResolverImpl implements Resolver
}
else
{
- usedCaps = new HashSet<Capability>();
+ usedCaps = new HashSet<>();
for (Blame blame : blames)
{
usedCaps.addAll(getPackageSources(blame.m_cap, resourcePkgMap));
@@ -1383,8 +1383,8 @@ public class ResolverImpl implements Resolver
// When several reqs are permuted at the same time this reduces the number of solutions tried.
// See the method Candidates::canRemoveCandidate for a case where substitutions must be checked
// because of this code that may permute multiple reqs in on candidates permutation.
- AtomicReference<Candidates> permRef1 = new AtomicReference<Candidates>();
- AtomicReference<Candidates> permRef2 = new AtomicReference<Candidates>();
+ AtomicReference<Candidates> permRef1 = new AtomicReference<>();
+ AtomicReference<Candidates> permRef2 = new AtomicReference<>();
Set<Requirement> mutated = null;
// Check if there are any uses conflicts with exported packages.
@@ -1403,7 +1403,7 @@ public class ResolverImpl implements Resolver
{
mutated = (mutated != null)
? mutated
- : new HashSet<Requirement>();
+ : new HashSet<>();
rethrow = permuteUsedBlames(session, rethrow, allCandidates, resource,
pkgName, null, usedBlames, permRef1, permRef2, mutated);
}
@@ -1437,7 +1437,7 @@ public class ResolverImpl implements Resolver
}
else
{
- allImportRequirePkgs = new OpenHashMap<String, List<Blame>>(pkgs.m_requiredPkgs.size() + pkgs.m_importedPkgs.size());
+ allImportRequirePkgs = new OpenHashMap<>(pkgs.m_requiredPkgs.size() + pkgs.m_importedPkgs.size());
allImportRequirePkgs.putAll(pkgs.m_requiredPkgs);
allImportRequirePkgs.putAll(pkgs.m_importedPkgs);
}
@@ -1458,7 +1458,7 @@ public class ResolverImpl implements Resolver
{
mutated = (mutated != null)
? mutated
- : new HashSet<Requirement>();// Split packages, need to think how to get a good message for split packages (sigh)
+ : new HashSet<>();// Split packages, need to think how to get a good message for split packages (sigh)
// For now we just use the first requirement that brings in the package that conflicts
Blame requirementBlame = requirementBlames.get(0);
rethrow = permuteUsedBlames(session, rethrow, allCandidates, resource, pkgName, requirementBlame, usedBlames, permRef1, permRef2, mutated);
@@ -1734,7 +1734,7 @@ public class ResolverImpl implements Resolver
case 1:
return isCompatible(currentBlames.get(0), candSources, resourcePkgMap);
default:
- Set<Capability> currentSources = new HashSet<Capability>(currentBlames.size());
+ Set<Capability> currentSources = new HashSet<>(currentBlames.size());
for (Blame currentBlame : currentBlames)
{
Set<Capability> blameSources = getPackageSources(currentBlame.m_cap, resourcePkgMap);
@@ -1751,19 +1751,19 @@ public class ResolverImpl implements Resolver
Resource resource = cap.getResource();
if(resource == null)
{
- return new HashSet<Capability>();
+ return new HashSet<>();
}
OpenHashMap<Capability, Set<Capability>> sources = resourcePkgMap.get(resource).m_sources;
if(sources == null)
{
- return new HashSet<Capability>();
+ return new HashSet<>();
}
Set<Capability> packageSources = sources.get(cap);
if(packageSources == null)
{
- return new HashSet<Capability>();
+ return new HashSet<>();
}
return packageSources;
@@ -1780,7 +1780,7 @@ public class ResolverImpl implements Resolver
@SuppressWarnings("serial")
OpenHashMap<String, Set<Capability>> pkgs = new OpenHashMap<String, Set<Capability>>(caps.size()) {
public Set<Capability> compute(String pkgName) {
- return new HashSet<Capability>();
+ return new HashSet<>();
}
};
Map<Capability, Set<Capability>> sources = packages.m_sources;
@@ -1879,9 +1879,9 @@ public class ResolverImpl implements Resolver
{
wireMap.put(unwrappedResource, Collections.<Wire>emptyList());
- List<Wire> packageWires = new ArrayList<Wire>();
- List<Wire> bundleWires = new ArrayList<Wire>();
- List<Wire> capabilityWires = new ArrayList<Wire>();
+ List<Wire> packageWires = new ArrayList<>();
+ List<Wire> bundleWires = new ArrayList<>();
+ List<Wire> capabilityWires = new ArrayList<>();
for (Requirement req : resource.getRequirements(null))
{
@@ -1953,7 +1953,7 @@ public class ResolverImpl implements Resolver
// is attached to more than one host.
List<Wire> fragmentWires = wireMap.get(fragment);
fragmentWires = (fragmentWires == null)
- ? new ArrayList<Wire>() : fragmentWires;
+ ? new ArrayList<>() : fragmentWires;
// Loop through all of the fragment's requirements and create
// any necessary wires for non-payload requirements.
@@ -2038,7 +2038,7 @@ public class ResolverImpl implements Resolver
{
wireMap.put(session.getDynamicHost(), Collections.<Wire>emptyList());
- List<Wire> packageWires = new ArrayList<Wire>();
+ List<Wire> packageWires = new ArrayList<>();
// Get the candidates for the current dynamic requirement.
// Record the dynamic candidate.
@@ -2128,16 +2128,16 @@ public class ResolverImpl implements Resolver
int nbCaps = resource.getCapabilities(null).size();
int nbReqs = resource.getRequirements(null).size();
- m_exportedPkgs = new OpenHashMap<String, Blame>(nbCaps);
- m_substitePkgs = new OpenHashMap<String, Blame>(nbCaps);
+ m_exportedPkgs = new OpenHashMap<>(nbCaps);
+ m_substitePkgs = new OpenHashMap<>(nbCaps);
m_importedPkgs = new OpenHashMap<String, List<Blame>>(nbReqs) {
public List<Blame> compute(String s) {
- return new ArrayList<Blame>();
+ return new ArrayList<>();
}
};
m_requiredPkgs = new OpenHashMap<String, List<Blame>>(nbReqs) {
public List<Blame> compute(String s) {
- return new ArrayList<Blame>();
+ return new ArrayList<>();
}
};
m_usedPkgs = new OpenHashMap<String, ArrayMap<Set<Capability>, UsedBlames>>(128) {
@@ -2151,7 +2151,7 @@ public class ResolverImpl implements Resolver
};
}
};
- m_sources = new OpenHashMap<Capability, Set<Capability>>(nbCaps);
+ m_sources = new OpenHashMap<>(nbCaps);
}
}
@@ -2200,7 +2200,7 @@ public class ResolverImpl implements Resolver
private static class UsedBlames
{
public final Set<Capability> m_caps;
- public final List<Blame> m_blames = new ArrayList<ResolverImpl.Blame>();
+ public final List<Blame> m_blames = new ArrayList<>();
private Map<Requirement, Set<Capability>> m_rootCauses;
public UsedBlames(Set<Capability> caps)
@@ -2230,12 +2230,12 @@ public class ResolverImpl implements Resolver
// capability pulled in is a conflict.
if (m_rootCauses == null)
{
- m_rootCauses = new HashMap<Requirement, Set<Capability>>();
+ m_rootCauses = new HashMap<>();
}
Set<Capability> rootCauses = m_rootCauses.get(req);
if (rootCauses == null)
{
- rootCauses = new HashSet<Capability>();
+ rootCauses = new HashSet<>();
m_rootCauses.put(req, rootCauses);
}
rootCauses.add(matchingRootCause);
@@ -2471,8 +2471,8 @@ public class ResolverImpl implements Resolver
private static class EnhancedExecutor
{
private final Executor executor;
- private final Queue<Future<Void>> awaiting = new ConcurrentLinkedQueue<Future<Void>>();
- private final AtomicReference<Throwable> throwable = new AtomicReference<Throwable>();
+ private final Queue<Future<Void>> awaiting = new ConcurrentLinkedQueue<>();
+ private final AtomicReference<Throwable> throwable = new AtomicReference<>();
public EnhancedExecutor(Executor executor)
{
@@ -2481,7 +2481,7 @@ public class ResolverImpl implements Resolver
public void execute(final Runnable runnable)
{
- FutureTask<Void> task = new FutureTask<Void>(new Runnable()
+ FutureTask<Void> task = new FutureTask<>(new Runnable()
{
public void run()
{
diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Util.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Util.java
index 973cd5b72..647855600 100755
--- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Util.java
+++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Util.java
@@ -99,7 +99,7 @@ public class Util
public static List<Requirement> getDynamicRequirements(List<Requirement> reqs)
{
- List<Requirement> result = new ArrayList<Requirement>();
+ List<Requirement> result = new ArrayList<>();
if (reqs != null)
{
for (Requirement req : reqs)
diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/WrappedCapability.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/WrappedCapability.java
index f17969e30..8fab2a3b3 100755
--- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/WrappedCapability.java
+++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/WrappedCapability.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@ public class WrappedCapability implements HostedCapability
// This is done to work around issues with wrapper resources equality tests.
// Note this is depends on the implementation details of the ResolveContext to actually
// check the osgi.content capability.
- Map<String, Object> augmentedDirs = new HashMap<String, Object>(m_cap.getAttributes());
+ Map<String, Object> augmentedDirs = new HashMap<>(m_cap.getAttributes());
Object wrapperUrl = augmentedDirs.get("url");
wrapperUrl = "wrapper:" + wrapperUrl;
augmentedDirs.put("url", wrapperUrl);
diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/WrappedResource.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/WrappedResource.java
index c51f74ee2..6b0b31fdb 100755
--- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/WrappedResource.java
+++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/WrappedResource.java
@@ -38,7 +38,7 @@ class WrappedResource implements Resource
m_fragments = fragments;
// Wrap host capabilities.
- List<Capability> caps = new ArrayList<Capability>();
+ List<Capability> caps = new ArrayList<>();
for (Capability cap : m_host.getCapabilities(null))
{
caps.add(new WrappedCapability(this, cap));
@@ -58,7 +58,7 @@ class WrappedResource implements Resource
m_cachedCapabilities = Collections.unmodifiableList(caps);
// Wrap host requirements.
- List<Requirement> reqs = new ArrayList<Requirement>();
+ List<Requirement> reqs = new ArrayList<>();
for (Requirement req : m_host.getRequirements(null))
{
reqs.add(new WrappedRequirement(this, req));
@@ -98,7 +98,7 @@ class WrappedResource implements Resource
public List<Capability> getCapabilities(String namespace)
{
if (namespace != null) {
- List<Capability> filtered = new ArrayList<Capability>();
+ List<Capability> filtered = new ArrayList<>();
for (Capability capability : m_cachedCapabilities) {
if (namespace.equals(capability.getNamespace())) {
filtered.add(capability);
@@ -112,7 +112,7 @@ class WrappedResource implements Resource
public List<Requirement> getRequirements(String namespace)
{
if (namespace != null) {
- List<Requirement> filtered = new ArrayList<Requirement>();
+ List<Requirement> filtered = new ArrayList<>();
for (Requirement requirement : m_cachedRequirements) {
if (namespace.equals(requirement.getNamespace())) {
filtered.add(requirement);
diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/ArrayMap.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/ArrayMap.java
index c61a194c9..16a921723 100755
--- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/ArrayMap.java
+++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/ArrayMap.java
@@ -132,7 +132,7 @@ public class ArrayMap<K, V> extends AbstractMap<K, V> {
@Override
public Iterator<Entry<K, V>> iterator() {
return new Iterator<Entry<K, V>>() {
- FastEntry<K, V> entry = new FastEntry<K, V>();
+ FastEntry<K, V> entry = new FastEntry<>();
int index = 0;
public boolean hasNext() {
diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/CandidateSelector.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/CandidateSelector.java
index de8a5f502..bce3386a3 100755
--- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/CandidateSelector.java
+++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/CandidateSelector.java
@@ -32,7 +32,7 @@ public class CandidateSelector {
public CandidateSelector(List<Capability> candidates, AtomicBoolean isUnmodifiable) {
this.isUnmodifiable = isUnmodifiable;
- this.unmodifiable = new ArrayList<Capability>(candidates);
+ this.unmodifiable = new ArrayList<>(candidates);
}
protected CandidateSelector(CandidateSelector candidateSelector) {
diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/OpenHashMapSet.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/OpenHashMapSet.java
index 2cdf70635..6d8f7d63a 100755
--- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/OpenHashMapSet.java
+++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/OpenHashMapSet.java
@@ -35,7 +35,7 @@ public class OpenHashMapSet<K, V> extends OpenHashMap<K, CopyOnWriteSet<V>> {
Object[] values = copy.value;
for (int i = values.length; i-- > 0;) {
if (values[i] != null) {
- values[i] = new CopyOnWriteSet<V>((CopyOnWriteSet<V>) values[i]);
+ values[i] = new CopyOnWriteSet<>((CopyOnWriteSet<V>) values[i]);
}
}
return copy;
@@ -43,7 +43,7 @@ public class OpenHashMapSet<K, V> extends OpenHashMap<K, CopyOnWriteSet<V>> {
@Override
protected CopyOnWriteSet<V> compute(K key) {
- return new CopyOnWriteSet<V>();
+ return new CopyOnWriteSet<>();
}
}
diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/ShadowList.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/ShadowList.java
index a91ba30ee..74f81c79f 100755
--- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/ShadowList.java
+++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/ShadowList.java
@@ -49,7 +49,7 @@ public class ShadowList extends CandidateSelector
private ShadowList(List<Capability> unmodifiable, List<Capability> original, AtomicBoolean isUnmodifiable) {
super(unmodifiable, isUnmodifiable);
- m_original = new ArrayList<Capability>(original);
+ m_original = new ArrayList<>(original);
}
public ShadowList copy() {
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdaptPermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdaptPermission.java
index a2bc7aac5..b940a8c5c 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdaptPermission.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdaptPermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2017). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -437,7 +437,7 @@ public final class AdaptPermission extends BasicPermission {
if (result != null) {
return result;
}
- final Map<String, Object> map = new HashMap<String, Object>(5);
+ final Map<String, Object> map = new HashMap<>(5);
map.put("adaptClass", getName());
if (bundle != null) {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@@ -491,7 +491,7 @@ final class AdaptPermissionCollection extends PermissionCollection {
* Create an empty AdaptPermissions object.
*/
public AdaptPermissionCollection() {
- permissions = new HashMap<String, AdaptPermission>();
+ permissions = new HashMap<>();
all_allowed = false;
}
@@ -597,7 +597,7 @@ final class AdaptPermissionCollection extends PermissionCollection {
*/
@Override
public synchronized Enumeration<Permission> elements() {
- List<Permission> all = new ArrayList<Permission>(permissions.values());
+ List<Permission> all = new ArrayList<>(permissions.values());
return Collections.enumeration(all);
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java
index 7906054ba..354f476cc 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/AdminPermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2017). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -220,7 +220,7 @@ public final class AdminPermission extends BasicPermission {
* ThreadLocal used to determine if we have recursively called
* getProperties.
*/
- private static final ThreadLocal<Bundle> recurse = new ThreadLocal<Bundle>();
+ private static final ThreadLocal<Bundle> recurse = new ThreadLocal<>();
/**
* Creates a new {@code AdminPermission} object that matches all bundles and
@@ -839,7 +839,7 @@ public final class AdminPermission extends BasicPermission {
}
recurse.set(bundle);
try {
- final Map<String, Object> map = new HashMap<String, Object>(4);
+ final Map<String, Object> map = new HashMap<>(4);
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
@@ -888,7 +888,7 @@ final class AdminPermissionCollection extends PermissionCollection {
*
*/
public AdminPermissionCollection() {
- permissions = new HashMap<String, AdminPermission>();
+ permissions = new HashMap<>();
}
/**
@@ -991,7 +991,7 @@ final class AdminPermissionCollection extends PermissionCollection {
*/
@Override
public synchronized Enumeration<Permission> elements() {
- List<Permission> all = new ArrayList<Permission>(permissions.values());
+ List<Permission> all = new ArrayList<>(permissions.values());
return Collections.enumeration(all);
}
@@ -999,7 +999,7 @@ final class AdminPermissionCollection extends PermissionCollection {
private static final ObjectStreamField[] serialPersistentFields = {new ObjectStreamField("permissions", Hashtable.class), new ObjectStreamField("all_allowed", Boolean.TYPE)};
private synchronized void writeObject(ObjectOutputStream out) throws IOException {
- Hashtable<String, AdminPermission> hashtable = new Hashtable<String, AdminPermission>(permissions);
+ Hashtable<String, AdminPermission> hashtable = new Hashtable<>(permissions);
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("permissions", hashtable);
pfields.put("all_allowed", all_allowed);
@@ -1010,7 +1010,7 @@ final class AdminPermissionCollection extends PermissionCollection {
ObjectInputStream.GetField gfields = in.readFields();
@SuppressWarnings("unchecked")
Hashtable<String, AdminPermission> hashtable = (Hashtable<String, AdminPermission>) gfields.get("permissions", null);
- permissions = new HashMap<String, AdminPermission>(hashtable);
+ permissions = new HashMap<>(hashtable);
all_allowed = gfields.get("all_allowed", false);
}
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundlePermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundlePermission.java
index 7a45b1cb5..a0bdb5bb6 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundlePermission.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/BundlePermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2019). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -453,7 +453,7 @@ final class BundlePermissionCollection extends PermissionCollection {
*
*/
public BundlePermissionCollection() {
- permissions = new HashMap<String, BundlePermission>();
+ permissions = new HashMap<>();
all_allowed = false;
}
@@ -568,7 +568,7 @@ final class BundlePermissionCollection extends PermissionCollection {
*/
@Override
public synchronized Enumeration<Permission> elements() {
- List<Permission> all = new ArrayList<Permission>(permissions.values());
+ List<Permission> all = new ArrayList<>(permissions.values());
return Collections.enumeration(all);
}
@@ -576,7 +576,7 @@ final class BundlePermissionCollection extends PermissionCollection {
private static final ObjectStreamField[] serialPersistentFields = {new ObjectStreamField("permissions", Hashtable.class), new ObjectStreamField("all_allowed", Boolean.TYPE)};
private synchronized void writeObject(ObjectOutputStream out) throws IOException {
- Hashtable<String, BundlePermission> hashtable = new Hashtable<String, BundlePermission>(permissions);
+ Hashtable<String, BundlePermission> hashtable = new Hashtable<>(permissions);
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("permissions", hashtable);
pfields.put("all_allowed", all_allowed);
@@ -587,7 +587,7 @@ final class BundlePermissionCollection extends PermissionCollection {
ObjectInputStream.GetField gfields = in.readFields();
@SuppressWarnings("unchecked")
Hashtable<String, BundlePermission> hashtable = (Hashtable<String, BundlePermission>) gfields.get("permissions", null);
- permissions = new HashMap<String, BundlePermission>(hashtable);
+ permissions = new HashMap<>(hashtable);
all_allowed = gfields.get("all_allowed", false);
}
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java
index c7bae50ca..045e9bfb4 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2019). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -184,7 +184,7 @@ public final class CapabilityPermission extends BasicPermission {
if (providingBundle == null) {
throw new IllegalArgumentException("bundle must not be null");
}
- this.attributes = new HashMap<String, Object>(attributes);
+ this.attributes = new HashMap<>(attributes);
this.bundle = providingBundle;
if ((action_mask & ACTION_ALL) != ACTION_REQUIRE) {
throw new IllegalArgumentException("invalid action string");
@@ -499,7 +499,7 @@ public final class CapabilityPermission extends BasicPermission {
if (result != null) {
return result;
}
- final Map<String, Object> props = new HashMap<String, Object>(5);
+ final Map<String, Object> props = new HashMap<>(5);
props.put("capability.namespace", getName());
if (bundle == null) {
return properties = props;
@@ -555,7 +555,7 @@ public final class CapabilityPermission extends BasicPermission {
if (entries != null) {
return entries;
}
- Set<Map.Entry<String, Object>> all = new HashSet<Map.Entry<String, Object>>(attributes.size() + properties.size());
+ Set<Map.Entry<String, Object>> all = new HashSet<>(attributes.size() + properties.size());
all.addAll(attributes.entrySet());
all.addAll(properties.entrySet());
return entries = Collections.unmodifiableSet(all);
@@ -601,7 +601,7 @@ final class CapabilityPermissionCollection extends PermissionCollection {
* Creates an empty CapabilityPermissionCollection object.
*/
public CapabilityPermissionCollection() {
- permissions = new HashMap<String, CapabilityPermission>();
+ permissions = new HashMap<>();
all_allowed = false;
}
@@ -636,7 +636,7 @@ final class CapabilityPermissionCollection extends PermissionCollection {
if (f != null) {
pc = filterPermissions;
if (pc == null) {
- filterPermissions = pc = new HashMap<String, CapabilityPermission>();
+ filterPermissions = pc = new HashMap<>();
}
} else {
pc = permissions;
@@ -752,7 +752,7 @@ final class CapabilityPermissionCollection extends PermissionCollection {
*/
@Override
public synchronized Enumeration<Permission> elements() {
- List<Permission> all = new ArrayList<Permission>(permissions.values());
+ List<Permission> all = new ArrayList<>(permissions.values());
Map<String, CapabilityPermission> pc = filterPermissions;
if (pc != null) {
all.addAll(pc.values());
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java
index 587b532f9..76402ec3b 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/FrameworkUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2020). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -373,7 +373,7 @@ public class FrameworkUtil {
if (pattern == null) {
throw new IllegalArgumentException("The pattern must not be null.");
}
- List<Object> parsed = new ArrayList<Object>();
+ List<Object> parsed = new ArrayList<>();
final int length = pattern.length();
char c = ';'; // start with semi-colon to detect empty pattern
for (int startIndex = skipSpaces(pattern, 0); startIndex < length;) {
@@ -415,7 +415,7 @@ public class FrameworkUtil {
if (dn.equals(STAR_WILDCARD) || dn.equals(MINUS_WILDCARD)) {
continue;
}
- List<Object> rdns = new ArrayList<Object>();
+ List<Object> rdns = new ArrayList<>();
if (dn.charAt(0) == '*') {
int index = skipSpaces(dn, 1);
if (dn.charAt(index) != ',') {
@@ -437,13 +437,13 @@ public class FrameworkUtil {
if (chain == null) {
throw new IllegalArgumentException("DN chain must not be null.");
}
- List<Object> result = new ArrayList<Object>(chain.size());
+ List<Object> result = new ArrayList<>(chain.size());
// Now we parse is a list of strings, lets make List of rdn out
// of them
for (String dn : chain) {
dn = new X500Principal(dn).getName(X500Principal.CANONICAL);
// Now dn is a nice CANONICAL DN
- List<Object> rdns = new ArrayList<Object>();
+ List<Object> rdns = new ArrayList<>();
parseDN(dn, rdns);
result.add(rdns);
}
@@ -475,7 +475,7 @@ public class FrameworkUtil {
private static void parseDN(String dn, List<Object> rdn) {
int startIndex = 0;
char c = '\0';
- List<String> nameValues = new ArrayList<String>();
+ List<String> nameValues = new ArrayList<>();
while (startIndex < dn.length()) {
int endIndex;
for (endIndex = startIndex; endIndex < dn.length(); endIndex++) {
@@ -494,7 +494,7 @@ public class FrameworkUtil {
if (c != '+') {
rdn.add(nameValues);
if (endIndex != dn.length()) {
- nameValues = new ArrayList<String>();
+ nameValues = new ArrayList<>();
} else {
nameValues = null;
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java
index cc8cd627f..a2329ae9b 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/PackagePermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2019). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -538,7 +538,7 @@ public final class PackagePermission extends BasicPermission {
if (result != null) {
return result;
}
- final Map<String, Object> map = new HashMap<String, Object>(5);
+ final Map<String, Object> map = new HashMap<>(5);
map.put("package.name", getName());
if (bundle != null) {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@@ -599,7 +599,7 @@ final class PackagePermissionCollection extends PermissionCollection {
* Create an empty PackagePermissions object.
*/
public PackagePermissionCollection() {
- permissions = new HashMap<String, PackagePermission>();
+ permissions = new HashMap<>();
all_allowed = false;
}
@@ -635,7 +635,7 @@ final class PackagePermissionCollection extends PermissionCollection {
if (f != null) {
pc = filterPermissions;
if (pc == null) {
- filterPermissions = pc = new HashMap<String, PackagePermission>();
+ filterPermissions = pc = new HashMap<>();
}
} else {
pc = permissions;
@@ -751,7 +751,7 @@ final class PackagePermissionCollection extends PermissionCollection {
*/
@Override
public synchronized Enumeration<Permission> elements() {
- List<Permission> all = new ArrayList<Permission>(permissions.values());
+ List<Permission> all = new ArrayList<>(permissions.values());
Map<String, PackagePermission> pc = filterPermissions;
if (pc != null) {
all.addAll(pc.values());
@@ -764,7 +764,7 @@ final class PackagePermissionCollection extends PermissionCollection {
new ObjectStreamField("filterPermissions", HashMap.class) };
private synchronized void writeObject(ObjectOutputStream out) throws IOException {
- Hashtable<String, PackagePermission> hashtable = new Hashtable<String, PackagePermission>(permissions);
+ Hashtable<String, PackagePermission> hashtable = new Hashtable<>(permissions);
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("permissions", hashtable);
pfields.put("all_allowed", all_allowed);
@@ -776,7 +776,7 @@ final class PackagePermissionCollection extends PermissionCollection {
ObjectInputStream.GetField gfields = in.readFields();
@SuppressWarnings("unchecked")
Hashtable<String, PackagePermission> hashtable = (Hashtable<String, PackagePermission>) gfields.get("permissions", null);
- permissions = new HashMap<String, PackagePermission>(hashtable);
+ permissions = new HashMap<>(hashtable);
all_allowed = gfields.get("all_allowed", false);
@SuppressWarnings("unchecked")
HashMap<String, PackagePermission> fp = (HashMap<String, PackagePermission>) gfields.get("filterPermissions", null);
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java
index a6b52521c..bbf1b08ff 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/ServicePermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2019). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -552,11 +552,11 @@ public final class ServicePermission extends BasicPermission {
return result;
}
if (service == null) {
- result = new HashMap<String, Object>(1);
+ result = new HashMap<>(1);
result.put(Constants.OBJECTCLASS, new String[] {getName()});
return properties = result;
}
- final Map<String, Object> props = new HashMap<String, Object>(4);
+ final Map<String, Object> props = new HashMap<>(4);
final Bundle bundle = service.getBundle();
if (bundle != null) {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@@ -611,7 +611,7 @@ public final class ServicePermission extends BasicPermission {
if (entries != null) {
return entries;
}
- Set<Map.Entry<String, Object>> all = new HashSet<Map.Entry<String, Object>>(properties.entrySet());
+ Set<Map.Entry<String, Object>> all = new HashSet<>(properties.entrySet());
add: for (String key : service.getPropertyKeys()) {
for (String k : properties.keySet()) {
if (key.equalsIgnoreCase(k)) {
@@ -715,7 +715,7 @@ final class ServicePermissionCollection extends PermissionCollection {
* Creates an empty ServicePermissions object.
*/
public ServicePermissionCollection() {
- permissions = new HashMap<String, ServicePermission>();
+ permissions = new HashMap<>();
all_allowed = false;
}
@@ -750,7 +750,7 @@ final class ServicePermissionCollection extends PermissionCollection {
if (f != null) {
pc = filterPermissions;
if (pc == null) {
- filterPermissions = pc = new HashMap<String, ServicePermission>();
+ filterPermissions = pc = new HashMap<>();
}
} else {
pc = permissions;
@@ -892,7 +892,7 @@ final class ServicePermissionCollection extends PermissionCollection {
*/
@Override
public synchronized Enumeration<Permission> elements() {
- List<Permission> all = new ArrayList<Permission>(permissions.values());
+ List<Permission> all = new ArrayList<>(permissions.values());
Map<String, ServicePermission> pc = filterPermissions;
if (pc != null) {
all.addAll(pc.values());
@@ -905,7 +905,7 @@ final class ServicePermissionCollection extends PermissionCollection {
new ObjectStreamField("filterPermissions", HashMap.class) };
private synchronized void writeObject(ObjectOutputStream out) throws IOException {
- Hashtable<String, ServicePermission> hashtable = new Hashtable<String, ServicePermission>(permissions);
+ Hashtable<String, ServicePermission> hashtable = new Hashtable<>(permissions);
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("permissions", hashtable);
pfields.put("all_allowed", all_allowed);
@@ -917,7 +917,7 @@ final class ServicePermissionCollection extends PermissionCollection {
ObjectInputStream.GetField gfields = in.readFields();
@SuppressWarnings("unchecked")
Hashtable<String, ServicePermission> hashtable = (Hashtable<String, ServicePermission>) gfields.get("permissions", null);
- permissions = new HashMap<String, ServicePermission>(hashtable);
+ permissions = new HashMap<>(hashtable);
all_allowed = gfields.get("all_allowed", false);
@SuppressWarnings("unchecked")
HashMap<String, ServicePermission> fp = (HashMap<String, ServicePermission>) gfields.get("filterPermissions", null);
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/SignerProperty.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/SignerProperty.java
index 53dec4a36..792b91d4e 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/SignerProperty.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/SignerProperty.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2009, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2009, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -73,7 +73,7 @@ final class SignerProperty {
String matchPattern = bundle != null ? other.pattern : pattern;
Map<X509Certificate, List<X509Certificate>> signers = matchBundle.getSignerCertificates(Bundle.SIGNERS_TRUSTED);
for (List<X509Certificate> signerCerts : signers.values()) {
- List<String> dnChain = new ArrayList<String>(signerCerts.size());
+ List<String> dnChain = new ArrayList<>(signerCerts.size());
for (X509Certificate signerCert : signerCerts) {
dnChain.add(signerCert.getSubjectDN().getName());
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java
index 8a79c1452..d59d86998 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleLocationCondition.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2015). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -79,7 +79,7 @@ public class BundleLocationCondition {
// this should never happen, but just in case
throw new RuntimeException("Invalid filter: " + e.getFilter(), e);
}
- Dictionary<String, String> matchProps = new Hashtable<String, String>(2);
+ Dictionary<String, String> matchProps = new Hashtable<>(2);
matchProps.put("location", bundleLocation);
boolean negate = (args.length == 2) ? "!".equals(args[1]) : false;
return (negate ^ filter.match(matchProps)) ? Condition.TRUE : Condition.FALSE;
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleSignerCondition.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleSignerCondition.java
index 9bb17ecb4..2941be76a 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleSignerCondition.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/BundleSignerCondition.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2005, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -81,7 +81,7 @@ public class BundleSignerCondition {
Map<X509Certificate, List<X509Certificate>> signers = bundle.getSignerCertificates(Bundle.SIGNERS_TRUSTED);
boolean match = false;
for (List<X509Certificate> signerCerts : signers.values()) {
- List<String> dnChain = new ArrayList<String>(signerCerts.size());
+ List<String> dnChain = new ArrayList<>(signerCerts.size());
for (X509Certificate signer : signerCerts) {
dnChain.add(signer.getSubjectDN().getName());
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionInfo.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionInfo.java
index f96821be9..fa529a8c3 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionInfo.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/condpermadmin/ConditionInfo.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2016). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -123,7 +123,7 @@ public class ConditionInfo {
}
/* type may be followed by args which are quoted and encoded */
- List<String> argsList = new ArrayList<String>();
+ List<String> argsList = new ArrayList<>();
while (encoded[pos] == '"') {
pos++;
begin = pos;
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/ResolutionException.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/ResolutionException.java
index 2bcc0ac8e..d9df44a6a 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/ResolutionException.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/ResolutionException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2011, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2011, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@ public class ResolutionException extends Exception {
if ((unresolvedRequirements == null) || unresolvedRequirements.isEmpty()) {
this.unresolvedRequirements = null;
} else {
- this.unresolvedRequirements = Collections.unmodifiableCollection(new ArrayList<Requirement>(unresolvedRequirements));
+ this.unresolvedRequirements = Collections.unmodifiableCollection(new ArrayList<>(unresolvedRequirements));
}
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/ResolveContext.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/ResolveContext.java
index 5a3d32eb9..db9de5a1f 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/ResolveContext.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/service/resolver/ResolveContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2011, 2017). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2011, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -289,7 +289,7 @@ public abstract class ResolveContext {
*/
public List<Wire> getSubstitutionWires(Wiring wiring) {
// Keep track of the declared capability package names
- Set<String> exportNames = new HashSet<String>();
+ Set<String> exportNames = new HashSet<>();
// Add packages declared as provided by the wiring host
for (Capability cap : wiring.getResource().getCapabilities(null)) {
@@ -316,7 +316,7 @@ public abstract class ResolveContext {
// collect the package wires that substitute one of the declared
// export package names
- List<Wire> substitutionWires = new ArrayList<Wire>();
+ List<Wire> substitutionWires = new ArrayList<>();
for (Wire wire : wiring.getRequiredResourceWires(null)) {
if (PackageNamespace.PACKAGE_NAMESPACE
.equals(wire.getCapability().getNamespace())) {
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/AbstractTracked.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/AbstractTracked.java
index 5988d7939..0773bc037 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/AbstractTracked.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/AbstractTracked.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2007, 2013). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2007, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -103,10 +103,10 @@ abstract class AbstractTracked<S, T, R> {
* AbstractTracked constructor.
*/
AbstractTracked() {
- tracked = new HashMap<S, T>();
+ tracked = new HashMap<>();
trackingCount = 0;
- adding = new ArrayList<S>(6);
- initial = new LinkedList<S>();
+ adding = new ArrayList<>(6);
+ initial = new LinkedList<>();
closed = false;
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTracker.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTracker.java
index ac16c218a..1b52ad25a 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTracker.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/BundleTracker.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2007, 2017). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2007, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -383,7 +383,7 @@ public class BundleTracker<T> implements BundleTrackerCustomizer<T> {
* @since 1.5
*/
public Map<Bundle, T> getTracked() {
- Map<Bundle, T> map = new HashMap<Bundle, T>();
+ Map<Bundle, T> map = new HashMap<>();
final Tracked t = tracked();
if (t == null) { /* if BundleTracker is not open */
return map;
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.java
index 3c9016c43..fcf430ca1 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/util/tracker/ServiceTracker.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2017). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2021). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -782,7 +782,7 @@ public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
* @since 1.5
*/
public SortedMap<ServiceReference<S>, T> getTracked() {
- SortedMap<ServiceReference<S>, T> map = new TreeMap<ServiceReference<S>, T>(Collections.reverseOrder());
+ SortedMap<ServiceReference<S>, T> map = new TreeMap<>(Collections.reverseOrder());
final Tracked t = tracked();
if (t == null) { /* if ServiceTracker is not open */
return map;

Back to the top