Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.osgi')
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/core/runtime/adaptor/EclipseStarter.java24
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleCapability.java2
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainer.java72
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleDatabase.java54
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleRequirement.java2
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolutionReport.java14
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolver.java96
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleRevision.java10
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleRevisionBuilder.java14
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleRevisions.java6
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleWiring.java24
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/SystemModule.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java50
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/ArrayMap.java14
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/Headers.java8
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/ObjectPool.java2
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/AtomicLazyInitializer.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/Capabilities.java18
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/ComputeNodeOrder.java16
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/LockSet.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/debug/FrameworkDebugOptions.java10
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/AliasMapper.java22
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/BundleContextImpl.java14
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/ContextFinder.java6
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/DTOBuilder.java42
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java10
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java8
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java6
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainerAdaptor.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxEventPublisher.java26
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/FilterImpl.java20
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/OSGiFrameworkHooks.java12
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/SystemBundleActivator.java8
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/legacy/PackageAdminImpl.java20
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hookregistry/HookRegistry.java14
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hooks/EclipseLazyStarter.java10
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java32
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/ModuleClassLoader.java2
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/buddy/DependentPolicy.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/buddy/PolicyHandler.java10
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/classpath/ClasspathEntry.java2
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/classpath/ClasspathManager.java22
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/sources/MultiSourcePackage.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/BasicReadWriteLock.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EquinoxLogServices.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminAdapter.java8
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminLogListener.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogEntryImpl.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogReaderServiceFactory.java16
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogReaderServiceImpl.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogServiceFactory.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogServiceImpl.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/LogServiceManager.java6
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/SerializedTaskQueue.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/EquinoxSecurityManager.java16
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/PermissionAdminTable.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/PermissionInfoCollection.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/PermissionsHash.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/SecurityAdmin.java18
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/SecurityRow.java10
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/SecurityTableUpdate.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/provisional/service/security/AuthorizationEngine.java8
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/service/security/KeyStoreTrustEngine.java7
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl.java14
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java40
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableCollection.java8
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableEntrySetValueCollection.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableValueCollectionMap.java8
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/PKCS7Processor.java10
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignatureBlockProcessor.java12
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java10
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedContentFile.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedContentImpl.java6
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedStorageHook.java8
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/TrustEngineListener.java6
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/ContentHandlerFactoryImpl.java6
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/ContentHandlerProxy.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/MultiplexingFactory.java8
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/URLStreamHandlerFactoryImpl.java10
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/URLStreamHandlerProxy.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/weaving/DynamicImportList.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/weaving/WeavingHookConfigurator.java6
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/BundleInfo.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/FrameworkExtensionInstaller.java8
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/ManifestLocalization.java8
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/NativeCodeFinder.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/PermissionData.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java48
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/StorageUtil.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/DirBundleFile.java4
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/MRUBundleFileList.java8
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/ZipBundleFile.java4
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/CopyOnWriteIdentityMap.java12
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/EventListeners.java4
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/EventManager.java6
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/ListenerQueue.java4
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFile.java6
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/util/Tokenizer.java4
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/ManifestElement.java12
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/NLS.java6
100 files changed, 597 insertions, 608 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/core/runtime/adaptor/EclipseStarter.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/core/runtime/adaptor/EclipseStarter.java
index 1492cff74..60b24eb3c 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/core/runtime/adaptor/EclipseStarter.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/core/runtime/adaptor/EclipseStarter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2015 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -137,7 +137,7 @@ public class EclipseStarter {
private static FrameworkLog log;
// directory of serch candidates keyed by directory abs path -> directory listing (bug 122024)
- private static Map<String, String[]> searchCandidates = new HashMap<String, String[]>(4);
+ private static Map<String, String[]> searchCandidates = new HashMap<>(4);
private static EclipseAppLauncher appLauncher;
private static List<Runnable> shutdownHandlers;
@@ -184,7 +184,7 @@ public class EclipseStarter {
private synchronized static Map<String, String> getConfiguration() {
if (configuration == null) {
- configuration = new HashMap<String, String>();
+ configuration = new HashMap<>();
// TODO hack to set these to defaults for EclipseStarter
// Note that this hack does not allow this property to be specified in config.ini
configuration.put(EquinoxConfiguration.PROP_USE_SYSTEM_PROPERTIES, System.getProperty(EquinoxConfiguration.PROP_USE_SYSTEM_PROPERTIES, "true")); //$NON-NLS-1$
@@ -476,7 +476,7 @@ public class EclipseStarter {
Method method = endSplashHandler.getClass().getMethod("getOutputStream", new Class[0]); //$NON-NLS-1$
Object outputStream = method.invoke(endSplashHandler, new Object[0]);
if (outputStream instanceof OutputStream) {
- Dictionary<String, Object> osProperties = new Hashtable<String, Object>();
+ Dictionary<String, Object> osProperties = new Hashtable<>();
osProperties.put("name", "splashstream"); //$NON-NLS-1$//$NON-NLS-2$
splashStreamRegistration = context.registerService(OutputStream.class.getName(), outputStream, osProperties);
}
@@ -485,7 +485,7 @@ public class EclipseStarter {
}
// keep this splash handler as the default startup monitor
try {
- Dictionary<String, Object> monitorProps = new Hashtable<String, Object>();
+ Dictionary<String, Object> monitorProps = new Hashtable<>();
monitorProps.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MIN_VALUE));
defaultMonitorRegistration = context.registerService(StartupMonitor.class.getName(), new DefaultStartupMonitor(endSplashHandler, equinoxConfig), monitorProps);
} catch (IllegalStateException e) {
@@ -572,14 +572,14 @@ public class EclipseStarter {
Bundle[] curInitBundles = getCurrentBundles(true);
// list of bundles to be refreshed
- List<Bundle> toRefresh = new ArrayList<Bundle>(curInitBundles.length);
+ List<Bundle> toRefresh = new ArrayList<>(curInitBundles.length);
// uninstall any of the currently installed bundles that do not exist in the
// initial bundle list from installEntries.
uninstallBundles(curInitBundles, initialBundles, toRefresh);
// install the initialBundles that are not already installed.
- List<Bundle> startBundles = new ArrayList<Bundle>(installEntries.length);
- List<Bundle> lazyActivationBundles = new ArrayList<Bundle>(installEntries.length);
+ List<Bundle> startBundles = new ArrayList<>(installEntries.length);
+ List<Bundle> lazyActivationBundles = new ArrayList<>(installEntries.length);
installBundles(initialBundles, curInitBundles, startBundles, lazyActivationBundles, toRefresh);
// If we installed/uninstalled something, force a refresh of all installed/uninstalled bundles
@@ -598,7 +598,7 @@ public class EclipseStarter {
private static InitialBundle[] getInitialBundles(String[] installEntries) {
searchCandidates.clear();
- List<InitialBundle> result = new ArrayList<InitialBundle>(installEntries.length);
+ List<InitialBundle> result = new ArrayList<>(installEntries.length);
int defaultStartLevel = Integer.parseInt(getProperty(PROP_BUNDLES_STARTLEVEL, DEFAULT_BUNDLES_STARTLEVEL));
String syspath = getSysPath();
// should canonicalize the syspath.
@@ -922,7 +922,7 @@ public class EclipseStarter {
private static Bundle[] getCurrentBundles(boolean includeInitial) {
Bundle[] installed = context.getBundles();
- List<Bundle> initial = new ArrayList<Bundle>();
+ List<Bundle> initial = new ArrayList<>();
for (int i = 0; i < installed.length; i++) {
Bundle bundle = installed[i];
if (bundle.getLocation().startsWith(INITIAL_LOCATION)) {
@@ -1156,7 +1156,7 @@ public class EclipseStarter {
}
private static void updateSplash(Semaphore semaphore, StartupEventListener listener) throws InterruptedException {
- ServiceTracker<StartupMonitor, StartupMonitor> monitorTracker = new ServiceTracker<StartupMonitor, StartupMonitor>(context, StartupMonitor.class.getName(), null);
+ ServiceTracker<StartupMonitor, StartupMonitor> monitorTracker = new ServiceTracker<>(context, StartupMonitor.class.getName(), null);
try {
monitorTracker.open();
} catch (IllegalStateException e) {
@@ -1386,7 +1386,7 @@ public class EclipseStarter {
throw new IllegalStateException(Msg.ECLIPSE_STARTUP_ALREADY_RUNNING);
if (shutdownHandlers == null)
- shutdownHandlers = new ArrayList<Runnable>();
+ shutdownHandlers = new ArrayList<>();
shutdownHandlers.add(handler);
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleCapability.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleCapability.java
index b9a414e39..967e9bc40 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleCapability.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleCapability.java
@@ -52,7 +52,7 @@ public final class ModuleCapability implements BundleCapability {
public Map<String, Object> getAttributes() {
if (transientAttrs == null)
return attributes;
- Map<String, Object> result = new HashMap<String, Object>(transientAttrs);
+ Map<String, Object> result = new HashMap<>(transientAttrs);
result.putAll(attributes);
return Collections.unmodifiableMap(result);
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainer.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainer.java
index a3c29c16f..802b9f6a1 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainer.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainer.java
@@ -50,12 +50,12 @@ public final class ModuleContainer implements DebugOptionsListener {
/**
* Used by install operations to establish a write lock on an install location
*/
- private final LockSet<String> locationLocks = new LockSet<String>();
+ private final LockSet<String> locationLocks = new LockSet<>();
/**
* Used by install and update operations to establish a write lock for a name
*/
- private final LockSet<String> nameLocks = new LockSet<String>();
+ private final LockSet<String> nameLocks = new LockSet<>();
/**
* An implementation of FrameworkWiring for this container
@@ -86,7 +86,7 @@ public final class ModuleContainer implements DebugOptionsListener {
/**
* Holds the system module while it is being refreshed
*/
- private final AtomicReference<SystemModule> refreshingSystemModule = new AtomicReference<SystemModule>();
+ private final AtomicReference<SystemModule> refreshingSystemModule = new AtomicReference<>();
private final long moduleLockTimeout;
@@ -229,7 +229,7 @@ public final class ModuleContainer implements DebugOptionsListener {
// This is to perform the collision check below
List<ModuleCapability> sameIdentity = moduleDatabase.findCapabilities(getIdentityRequirement(name, builder.getVersion()));
if (!sameIdentity.isEmpty()) {
- collisionCandidates = new ArrayList<Module>(1);
+ collisionCandidates = new ArrayList<>(1);
for (ModuleCapability identity : sameIdentity) {
ModuleRevision equinoxRevision = identity.getRevision();
if (!equinoxRevision.isCurrent())
@@ -313,7 +313,7 @@ public final class ModuleContainer implements DebugOptionsListener {
// This is to perform the collision check below
List<ModuleCapability> sameIdentity = moduleDatabase.findCapabilities(getIdentityRequirement(name, builder.getVersion()));
if (!sameIdentity.isEmpty()) {
- collisionCandidates = new ArrayList<Module>(1);
+ collisionCandidates = new ArrayList<>(1);
for (ModuleCapability identity : sameIdentity) {
ModuleRevision equinoxRevision = identity.getRevision();
if (!equinoxRevision.isCurrent())
@@ -464,9 +464,9 @@ public final class ModuleContainer implements DebugOptionsListener {
private ResolutionReport resolveAndApply(Collection<Module> triggers, boolean triggersMandatory, boolean restartTriggers) {
if (triggers == null)
- triggers = new ArrayList<Module>(0);
- Collection<ModuleRevision> triggerRevisions = new ArrayList<ModuleRevision>(triggers.size());
- Collection<ModuleRevision> unresolved = new ArrayList<ModuleRevision>();
+ triggers = new ArrayList<>(0);
+ Collection<ModuleRevision> triggerRevisions = new ArrayList<>(triggers.size());
+ Collection<ModuleRevision> unresolved = new ArrayList<>();
Map<ModuleRevision, ModuleWiring> wiringClone;
long timestamp;
moduleDatabase.readLock();
@@ -496,7 +496,7 @@ public final class ModuleContainer implements DebugOptionsListener {
if (deltaWiring.isEmpty())
return report; // nothing to do
- Collection<Module> modulesResolved = new ArrayList<Module>();
+ Collection<Module> modulesResolved = new ArrayList<>();
for (ModuleRevision deltaRevision : deltaWiring.keySet()) {
if (!wiringClone.containsKey(deltaRevision))
modulesResolved.add(deltaRevision.getRevisions().getModule());
@@ -521,7 +521,7 @@ public final class ModuleContainer implements DebugOptionsListener {
result = null;
Map<ModuleRevision, ModuleWiring> wiringClone = null;
List<DynamicModuleRequirement> dynamicReqs = null;
- Collection<ModuleRevision> unresolved = new ArrayList<ModuleRevision>();
+ Collection<ModuleRevision> unresolved = new ArrayList<>();
moduleDatabase.readLock();
try {
ModuleWiring wiring = revision.getWiring();
@@ -591,7 +591,7 @@ public final class ModuleContainer implements DebugOptionsListener {
return null; // nothing to do
}
- modulesResolved = new ArrayList<Module>();
+ modulesResolved = new ArrayList<>();
for (ModuleRevision deltaRevision : deltaWiring.keySet()) {
if (!wiringClone.containsKey(deltaRevision))
modulesResolved.add(deltaRevision.getRevisions().getModule());
@@ -627,7 +627,7 @@ public final class ModuleContainer implements DebugOptionsListener {
private final Object stateLockMonitor = new Object();
private boolean applyDelta(Map<ModuleRevision, ModuleWiring> deltaWiring, Collection<Module> modulesResolved, Collection<Module> triggers, long timestamp, boolean restartTriggers) {
- List<Module> modulesLocked = new ArrayList<Module>(modulesResolved.size());
+ List<Module> modulesLocked = new ArrayList<>(modulesResolved.size());
// now attempt to apply the delta
try {
synchronized (stateLockMonitor) {
@@ -655,7 +655,7 @@ public final class ModuleContainer implements DebugOptionsListener {
}
}
}
- Map<ModuleWiring, Collection<ModuleRevision>> hostsWithDynamicFrags = new HashMap<ModuleWiring, Collection<ModuleRevision>>(0);
+ Map<ModuleWiring, Collection<ModuleRevision>> hostsWithDynamicFrags = new HashMap<>(0);
moduleDatabase.writeLock();
try {
if (timestamp != moduleDatabase.getRevisionsTimestamp())
@@ -680,7 +680,7 @@ public final class ModuleContainer implements DebugOptionsListener {
if (hostWiring != null) {
Collection<ModuleRevision> dynamicFragments = hostsWithDynamicFrags.get(hostWiring);
if (dynamicFragments == null) {
- dynamicFragments = new ArrayList<ModuleRevision>();
+ dynamicFragments = new ArrayList<>();
hostsWithDynamicFrags.put(hostWiring, dynamicFragments);
}
dynamicFragments.add(hostWire.getRequirer());
@@ -714,7 +714,7 @@ public final class ModuleContainer implements DebugOptionsListener {
}
// If there are any triggers re-start them now if requested
- Set<Module> triggerSet = restartTriggers ? new HashSet<Module>(triggers) : Collections.<Module> emptySet();
+ Set<Module> triggerSet = restartTriggers ? new HashSet<>(triggers) : Collections.<Module> emptySet();
if (restartTriggers) {
for (Module module : triggers) {
if (module.getId() != 0 && Module.RESOLVED_SET.contains(module.getState())) {
@@ -768,7 +768,7 @@ public final class ModuleContainer implements DebugOptionsListener {
// not resolved!
return Collections.emptyList();
}
- List<DynamicModuleRequirement> result = new ArrayList<ModuleRequirement.DynamicModuleRequirement>(1);
+ List<DynamicModuleRequirement> result = new ArrayList<>(1);
// check the dynamic import packages
DynamicModuleRequirement dynamicRequirement;
for (ModuleRequirement requirement : wiring.getModuleRequirements(PackageNamespace.PACKAGE_NAMESPACE)) {
@@ -810,10 +810,10 @@ public final class ModuleContainer implements DebugOptionsListener {
checkSystemExtensionRefresh(initial);
timestamp = moduleDatabase.getRevisionsTimestamp();
wiringCopy = moduleDatabase.getWiringsCopy();
- refreshTriggers = new ArrayList<Module>(getRefreshClosure(initial, wiringCopy));
- toRemoveRevisions = new ArrayList<ModuleRevision>();
- toRemoveWirings = new ArrayList<ModuleWiring>();
- toRemoveWireLists = new HashMap<ModuleWiring, Collection<ModuleWire>>();
+ refreshTriggers = new ArrayList<>(getRefreshClosure(initial, wiringCopy));
+ toRemoveRevisions = new ArrayList<>();
+ toRemoveWirings = new ArrayList<>();
+ toRemoveWireLists = new HashMap<>();
for (Iterator<Module> iTriggers = refreshTriggers.iterator(); iTriggers.hasNext();) {
Module module = iTriggers.next();
boolean first = true;
@@ -825,7 +825,7 @@ public final class ModuleContainer implements DebugOptionsListener {
for (ModuleWire wire : removedWires) {
Collection<ModuleWire> providerWires = toRemoveWireLists.get(wire.getProviderWiring());
if (providerWires == null) {
- providerWires = new ArrayList<ModuleWire>();
+ providerWires = new ArrayList<>();
toRemoveWireLists.put(wire.getProviderWiring(), providerWires);
}
providerWires.add(wire);
@@ -850,8 +850,8 @@ public final class ModuleContainer implements DebugOptionsListener {
refreshSystemModule();
return Collections.emptyList();
}
- Collection<Module> modulesLocked = new ArrayList<Module>(refreshTriggers.size());
- Collection<Module> modulesUnresolved = new ArrayList<Module>();
+ Collection<Module> modulesLocked = new ArrayList<>(refreshTriggers.size());
+ Collection<Module> modulesUnresolved = new ArrayList<>();
try {
// Acquire the module state change locks.
// Note this is done while holding a global lock to avoid multiple threads trying to compete over
@@ -989,7 +989,7 @@ public final class ModuleContainer implements DebugOptionsListener {
* @see FrameworkWiring#refreshBundles(Collection, FrameworkListener...)
*/
public ResolutionReport refresh(Collection<Module> initial) {
- initial = initial == null ? null : new ArrayList<Module>(initial);
+ initial = initial == null ? null : new ArrayList<>(initial);
Collection<Module> refreshTriggers = unresolve(initial);
if (!isRefreshingSystemModule()) {
return resolve(refreshTriggers, false, true);
@@ -1161,9 +1161,9 @@ public final class ModuleContainer implements DebugOptionsListener {
}
Set<Module> getRefreshClosure(Collection<Module> initial, Map<ModuleRevision, ModuleWiring> wiringCopy) {
- Set<Module> refreshClosure = new HashSet<Module>();
+ Set<Module> refreshClosure = new HashSet<>();
if (initial == null) {
- initial = new HashSet<Module>();
+ initial = new HashSet<>();
Collection<ModuleRevision> removalPending = moduleDatabase.getRemovalPending();
for (ModuleRevision revision : removalPending) {
initial.add(revision.getRevisions().getModule());
@@ -1200,7 +1200,7 @@ public final class ModuleContainer implements DebugOptionsListener {
}
static Collection<ModuleRevision> getDependencyClosure(ModuleRevision initial, Map<ModuleRevision, ModuleWiring> wiringCopy) {
- Set<ModuleRevision> dependencyClosure = new HashSet<ModuleRevision>();
+ Set<ModuleRevision> dependencyClosure = new HashSet<>();
addDependents(initial, wiringCopy, dependencyClosure);
return dependencyClosure;
}
@@ -1291,9 +1291,9 @@ public final class ModuleContainer implements DebugOptionsListener {
// queue to refresh in the background
// notice that we only do one refresh operation at a time
- CopyOnWriteIdentityMap<ContainerWiring, FrameworkListener[]> dispatchListeners = new CopyOnWriteIdentityMap<ModuleContainer.ContainerWiring, FrameworkListener[]>();
+ CopyOnWriteIdentityMap<ContainerWiring, FrameworkListener[]> dispatchListeners = new CopyOnWriteIdentityMap<>();
dispatchListeners.put(this, listeners);
- ListenerQueue<ContainerWiring, FrameworkListener[], Collection<Module>> queue = new ListenerQueue<ModuleContainer.ContainerWiring, FrameworkListener[], Collection<Module>>(getManager());
+ ListenerQueue<ContainerWiring, FrameworkListener[], Collection<Module>> queue = new ListenerQueue<>(getManager());
queue.queueListeners(dispatchListeners.entrySet(), this);
// dispatch the refresh job
@@ -1320,7 +1320,7 @@ public final class ModuleContainer implements DebugOptionsListener {
public Collection<Bundle> getRemovalPendingBundles() {
moduleDatabase.readLock();
try {
- Collection<Bundle> removalPendingBundles = new HashSet<Bundle>();
+ Collection<Bundle> removalPendingBundles = new HashSet<>();
Collection<ModuleRevision> removalPending = moduleDatabase.getRemovalPending();
for (ModuleRevision moduleRevision : removalPending) {
removalPendingBundles.add(moduleRevision.getBundle());
@@ -1337,7 +1337,7 @@ public final class ModuleContainer implements DebugOptionsListener {
moduleDatabase.readLock();
try {
Collection<Module> closure = getRefreshClosure(modules, moduleDatabase.getWiringsCopy());
- Collection<Bundle> result = new ArrayList<Bundle>(closure.size());
+ Collection<Bundle> result = new ArrayList<>(closure.size());
for (Module module : closure) {
result.add(module.getBundle());
}
@@ -1358,7 +1358,7 @@ public final class ModuleContainer implements DebugOptionsListener {
return AccessController.doPrivileged(new PrivilegedAction<Collection<Module>>() {
@Override
public Collection<Module> run() {
- Collection<Module> result = new ArrayList<Module>(bundles.size());
+ Collection<Module> result = new ArrayList<>(bundles.size());
for (Bundle bundle : bundles) {
Module module = bundle.adapt(Module.class);
if (module == null)
@@ -1467,9 +1467,9 @@ public final class ModuleContainer implements DebugOptionsListener {
if (currentLevel < startlevel || module.isPersistentlyStarted()) {
// queue start level operation in the background
// notice that we only do one start level operation at a time
- CopyOnWriteIdentityMap<Module, FrameworkListener[]> dispatchListeners = new CopyOnWriteIdentityMap<Module, FrameworkListener[]>();
+ CopyOnWriteIdentityMap<Module, FrameworkListener[]> dispatchListeners = new CopyOnWriteIdentityMap<>();
dispatchListeners.put(module, new FrameworkListener[0]);
- ListenerQueue<Module, FrameworkListener[], Integer> queue = new ListenerQueue<Module, FrameworkListener[], Integer>(getManager());
+ ListenerQueue<Module, FrameworkListener[], Integer> queue = new ListenerQueue<>(getManager());
queue.queueListeners(dispatchListeners.entrySet(), this);
// dispatch the start level job
@@ -1492,9 +1492,9 @@ public final class ModuleContainer implements DebugOptionsListener {
}
// queue start level operation in the background
// notice that we only do one start level operation at a time
- CopyOnWriteIdentityMap<Module, FrameworkListener[]> dispatchListeners = new CopyOnWriteIdentityMap<Module, FrameworkListener[]>();
+ CopyOnWriteIdentityMap<Module, FrameworkListener[]> dispatchListeners = new CopyOnWriteIdentityMap<>();
dispatchListeners.put(moduleDatabase.getModule(0), listeners);
- ListenerQueue<Module, FrameworkListener[], Integer> queue = new ListenerQueue<Module, FrameworkListener[], Integer>(getManager());
+ ListenerQueue<Module, FrameworkListener[], Integer> queue = new ListenerQueue<>(getManager());
queue.queueListeners(dispatchListeners.entrySet(), this);
// dispatch the start level job
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleDatabase.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleDatabase.java
index 70a26dd36..001e020dc 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleDatabase.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleDatabase.java
@@ -140,16 +140,16 @@ public class ModuleDatabase {
*/
public ModuleDatabase(ModuleContainerAdaptor adaptor) {
this.adaptor = adaptor;
- this.modulesByLocations = new HashMap<String, Module>();
- this.modulesById = new HashMap<Long, Module>();
- this.wirings = new HashMap<ModuleRevision, ModuleWiring>();
+ this.modulesByLocations = new HashMap<>();
+ this.modulesById = new HashMap<>();
+ this.wirings = new HashMap<>();
// Start at id 1 because 0 is reserved for the system bundle
this.nextId = new AtomicLong(1);
// seed with current time to avoid duplicate timestamps after using -clean
this.constructionTime = System.currentTimeMillis();
this.revisionsTimeStamp = new AtomicLong(constructionTime);
this.allTimeStamp = new AtomicLong(constructionTime);
- this.moduleSettings = new HashMap<Long, EnumSet<Settings>>();
+ this.moduleSettings = new HashMap<>();
this.capabilities = new Capabilities();
}
@@ -355,8 +355,8 @@ public class ModuleDatabase {
}
}
if (allPendingRemoval) {
- Collection<ModuleWiring> toRemoveWirings = new ArrayList<ModuleWiring>();
- Map<ModuleWiring, Collection<ModuleWire>> toRemoveWireLists = new HashMap<ModuleWiring, Collection<ModuleWire>>();
+ Collection<ModuleWiring> toRemoveWirings = new ArrayList<>();
+ Map<ModuleWiring, Collection<ModuleWire>> toRemoveWireLists = new HashMap<>();
for (ModuleRevision pendingRemoval : dependencyClosure) {
ModuleWiring removedWiring = wirings.get(pendingRemoval);
if (removedWiring == null) {
@@ -367,7 +367,7 @@ public class ModuleDatabase {
for (ModuleWire wire : removedWires) {
Collection<ModuleWire> providerWires = toRemoveWireLists.get(wire.getProviderWiring());
if (providerWires == null) {
- providerWires = new ArrayList<ModuleWire>();
+ providerWires = new ArrayList<>();
toRemoveWireLists.put(wire.getProviderWiring(), providerWires);
}
providerWires.add(wire);
@@ -404,7 +404,7 @@ public class ModuleDatabase {
* @return all revisions with a removal pending wiring.
*/
final Collection<ModuleRevision> getRemovalPending() {
- Collection<ModuleRevision> removalPending = new ArrayList<ModuleRevision>();
+ Collection<ModuleRevision> removalPending = new ArrayList<>();
readLock();
try {
for (ModuleWiring wiring : wirings.values()) {
@@ -444,7 +444,7 @@ public class ModuleDatabase {
final Map<ModuleRevision, ModuleWiring> getWiringsCopy() {
readLock();
try {
- return new HashMap<ModuleRevision, ModuleWiring>(wirings);
+ return new HashMap<>(wirings);
} finally {
readUnlock();
}
@@ -472,7 +472,7 @@ public class ModuleDatabase {
final Map<ModuleRevision, ModuleWiring> getWiringsClone() {
readLock();
try {
- Map<ModuleRevision, ModuleWiring> clonedWirings = new HashMap<ModuleRevision, ModuleWiring>();
+ Map<ModuleRevision, ModuleWiring> clonedWirings = new HashMap<>();
for (Map.Entry<ModuleRevision, ModuleWiring> entry : wirings.entrySet()) {
ModuleWiring wiring = new ModuleWiring(entry.getKey(), entry.getValue().getModuleCapabilities(null), entry.getValue().getModuleRequirements(null), entry.getValue().getProvidedModuleWires(null), entry.getValue().getRequiredModuleWires(null), entry.getValue().getSubstitutedNames());
clonedWirings.put(entry.getKey(), wiring);
@@ -537,7 +537,7 @@ public class ModuleDatabase {
final List<Module> getSortedModules(Sort... sortOptions) {
readLock();
try {
- List<Module> modules = new ArrayList<Module>(modulesByLocations.values());
+ List<Module> modules = new ArrayList<>(modulesByLocations.values());
sortModules(modules, sortOptions);
return modules;
} finally {
@@ -590,7 +590,7 @@ public class ModuleDatabase {
private Collection<List<Module>> sortByDependencies(List<Module> toSort) {
// Build references so we can sort
- List<Module[]> references = new ArrayList<Module[]>(toSort.size());
+ List<Module[]> references = new ArrayList<>(toSort.size());
for (Module module : toSort) {
ModuleRevision current = module.getCurrentRevision();
if (current == null) {
@@ -623,9 +623,9 @@ public class ModuleDatabase {
if (cycles.length == 0)
return Collections.emptyList();
- Collection<List<Module>> moduleCycles = new ArrayList<List<Module>>(cycles.length);
+ Collection<List<Module>> moduleCycles = new ArrayList<>(cycles.length);
for (Object[] cycle : cycles) {
- List<Module> moduleCycle = new ArrayList<Module>(cycle.length);
+ List<Module> moduleCycle = new ArrayList<>(cycle.length);
for (Object module : cycle) {
moduleCycle.add((Module) module);
}
@@ -964,9 +964,9 @@ public class ModuleDatabase {
out.writeInt(moduleDatabase.getInitialModuleStartLevel());
// prime the object table with all the strings, versions and maps
- Set<String> allStrings = new HashSet<String>();
- Set<Version> allVersions = new HashSet<Version>();
- Set<Map<String, ?>> allMaps = new HashSet<Map<String, ?>>();
+ Set<String> allStrings = new HashSet<>();
+ Set<Version> allVersions = new HashSet<>();
+ Set<Map<String, ?>> allMaps = new HashSet<>();
// first gather all the strings, versions and maps from the modules
List<Module> modules = moduleDatabase.getModules();
@@ -983,7 +983,7 @@ public class ModuleDatabase {
}
// Now persist all the Strings
- Map<Object, Integer> objectTable = new HashMap<Object, Integer>();
+ Map<Object, Integer> objectTable = new HashMap<>();
allStrings.remove(null);
out.writeInt(allStrings.size());
for (String string : allStrings) {
@@ -1106,7 +1106,7 @@ public class ModuleDatabase {
moduleDatabase.nextId.set(in.readLong());
moduleDatabase.setInitialModuleStartLevel(in.readInt());
- Map<Integer, Object> objectTable = new HashMap<Integer, Object>();
+ Map<Integer, Object> objectTable = new HashMap<>();
if (version >= 2) {
int numStrings = in.readInt();
for (int i = 0; i < numStrings; i++) {
@@ -1141,7 +1141,7 @@ public class ModuleDatabase {
}
// now read all the info about each wiring using only indexes
- Map<ModuleRevision, ModuleWiring> wirings = new HashMap<ModuleRevision, ModuleWiring>();
+ Map<ModuleRevision, ModuleWiring> wirings = new HashMap<>();
for (int i = 0; i < numWirings; i++) {
ModuleWiring wiring = readWiring(in, objectTable);
wirings.put(wiring.getRevision(), wiring);
@@ -1346,31 +1346,31 @@ public class ModuleDatabase {
throw new NullPointerException("Could not find revision for wiring."); //$NON-NLS-1$
int numCapabilities = in.readInt();
- List<ModuleCapability> capabilities = new ArrayList<ModuleCapability>(numCapabilities);
+ List<ModuleCapability> capabilities = new ArrayList<>(numCapabilities);
for (int i = 0; i < numCapabilities; i++) {
capabilities.add((ModuleCapability) objectTable.get(in.readInt()));
}
int numRequirements = in.readInt();
- List<ModuleRequirement> requirements = new ArrayList<ModuleRequirement>(numRequirements);
+ List<ModuleRequirement> requirements = new ArrayList<>(numRequirements);
for (int i = 0; i < numRequirements; i++) {
requirements.add((ModuleRequirement) objectTable.get(in.readInt()));
}
int numProvidedWires = in.readInt();
- List<ModuleWire> providedWires = new ArrayList<ModuleWire>(numProvidedWires);
+ List<ModuleWire> providedWires = new ArrayList<>(numProvidedWires);
for (int i = 0; i < numProvidedWires; i++) {
providedWires.add((ModuleWire) objectTable.get(in.readInt()));
}
int numRequiredWires = in.readInt();
- List<ModuleWire> requiredWires = new ArrayList<ModuleWire>(numRequiredWires);
+ List<ModuleWire> requiredWires = new ArrayList<>(numRequiredWires);
for (int i = 0; i < numRequiredWires; i++) {
requiredWires.add((ModuleWire) objectTable.get(in.readInt()));
}
int numSubstitutedNames = in.readInt();
- Collection<String> substituted = new ArrayList<String>(numSubstitutedNames);
+ Collection<String> substituted = new ArrayList<>(numSubstitutedNames);
for (int i = 0; i < numSubstitutedNames; i++) {
substituted.add(readString(in, objectTable));
}
@@ -1456,7 +1456,7 @@ public class ModuleDatabase {
Object value = readMapValue(in, type, objectTable);
result = Collections.singletonMap(key, value);
} else {
- result = new HashMap<String, Object>(count);
+ result = new HashMap<>(count);
for (int i = 0; i < count; i++) {
String key = readString(in, objectTable);
byte type = in.readByte();
@@ -1544,7 +1544,7 @@ public class ModuleDatabase {
if (size == 1) {
return Collections.singletonList(readListValue(listType, in, objectTable));
}
- List<Object> list = new ArrayList<Object>(size);
+ List<Object> list = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
list.add(readListValue(listType, in, objectTable));
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleRequirement.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleRequirement.java
index 9bcc3d0bc..a0ccd36db 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleRequirement.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleRequirement.java
@@ -123,7 +123,7 @@ public class ModuleRequirement implements BundleRequirement {
}
if (specificPackageFilter != null) {
- Map<String, String> dynamicDirectives = new HashMap<String, String>(directives);
+ Map<String, String> dynamicDirectives = new HashMap<>(directives);
dynamicDirectives.put(PackageNamespace.REQUIREMENT_FILTER_DIRECTIVE, specificPackageFilter);
return new DynamicModuleRequirement(host, dynamicDirectives);
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolutionReport.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolutionReport.java
index eba7c0d90..359ef9ec2 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolutionReport.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolutionReport.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013, 2014 IBM Corporation and others.
+ * Copyright (c) 2013, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,12 +28,12 @@ import org.osgi.service.resolver.ResolutionException;
class ModuleResolutionReport implements ResolutionReport {
static class Builder {
- private final Map<Resource, List<Entry>> resourceToEntries = new HashMap<Resource, List<Entry>>();
+ private final Map<Resource, List<Entry>> resourceToEntries = new HashMap<>();
public void addEntry(Resource resource, Entry.Type type, Object data) {
List<Entry> entries = resourceToEntries.get(resource);
if (entries == null) {
- entries = new ArrayList<Entry>();
+ entries = new ArrayList<>();
resourceToEntries.put(resource, entries);
}
entries.add(new EntryImpl(type, data));
@@ -69,7 +69,7 @@ class ModuleResolutionReport implements ResolutionReport {
private final Map<Resource, List<Wire>> resolutionResult;
ModuleResolutionReport(Map<Resource, List<Wire>> resolutionResult, Map<Resource, List<Entry>> entries, ResolutionException cause) {
- this.entries = entries == null ? Collections.<Resource, List<Entry>> emptyMap() : Collections.unmodifiableMap(new HashMap<Resource, List<ResolutionReport.Entry>>(entries));
+ this.entries = entries == null ? Collections.<Resource, List<Entry>> emptyMap() : Collections.unmodifiableMap(new HashMap<>(entries));
this.resolutionResult = resolutionResult == null ? Collections.<Resource, List<Wire>> emptyMap() : Collections.unmodifiableMap(resolutionResult);
this.resolutionException = cause;
}
@@ -93,7 +93,7 @@ class ModuleResolutionReport implements ResolutionReport {
prepend = ""; //$NON-NLS-1$
}
if (visited == null) {
- visited = new HashSet<BundleRevision>();
+ visited = new HashSet<>();
}
if (visited.contains(revision)) {
return ""; //$NON-NLS-1$
@@ -164,7 +164,7 @@ class ModuleResolutionReport implements ResolutionReport {
}
private static String createOSGiCapability(Capability cap) {
- Map<String, Object> attributes = new HashMap<String, Object>(cap.getAttributes());
+ Map<String, Object> attributes = new HashMap<>(cap.getAttributes());
Map<String, String> directives = cap.getDirectives();
String name = (String) attributes.remove(cap.getNamespace());
return name + ModuleRevision.toString(attributes, false, true) + ModuleRevision.toString(directives, true, true);
@@ -186,7 +186,7 @@ class ModuleResolutionReport implements ResolutionReport {
}
private static String createOSGiRequirement(Requirement requirement, String... versions) {
- Map<String, String> directives = new HashMap<String, String>(requirement.getDirectives());
+ Map<String, String> directives = new HashMap<>(requirement.getDirectives());
String filter = directives.remove(Namespace.REQUIREMENT_FILTER_DIRECTIVE);
if (filter == null)
throw new IllegalArgumentException("No filter directive found:" + requirement); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolver.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolver.java
index 9a829516b..fb3920413 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolver.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolver.java
@@ -80,7 +80,7 @@ final class ModuleResolver {
private static final Collection<String> NON_PAYLOAD_CAPABILITIES = Arrays.asList(IdentityNamespace.IDENTITY_NAMESPACE);
static final Collection<String> NON_PAYLOAD_REQUIREMENTS = Arrays.asList(HostNamespace.HOST_NAMESPACE, ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE);
- final ThreadLocal<Boolean> threadResolving = new ThreadLocal<Boolean>();
+ final ThreadLocal<Boolean> threadResolving = new ThreadLocal<>();
final ModuleContainerAdaptor adaptor;
/**
@@ -137,24 +137,24 @@ final class ModuleResolver {
}
Map<ModuleRevision, ModuleWiring> generateDelta(Map<Resource, List<Wire>> result, Map<ModuleRevision, ModuleWiring> wiringCopy) {
- Map<ModuleRevision, Map<ModuleCapability, List<ModuleWire>>> provided = new HashMap<ModuleRevision, Map<ModuleCapability, List<ModuleWire>>>();
- Map<ModuleRevision, List<ModuleWire>> required = new HashMap<ModuleRevision, List<ModuleWire>>();
+ Map<ModuleRevision, Map<ModuleCapability, List<ModuleWire>>> provided = new HashMap<>();
+ Map<ModuleRevision, List<ModuleWire>> required = new HashMap<>();
// First populate the list of provided and required wires for revision
// This is done this way to share the wire object between both the provider and requirer
for (Map.Entry<Resource, List<Wire>> resultEntry : result.entrySet()) {
ModuleRevision revision = (ModuleRevision) resultEntry.getKey();
- List<ModuleWire> requiredWires = new ArrayList<ModuleWire>(resultEntry.getValue().size());
+ List<ModuleWire> requiredWires = new ArrayList<>(resultEntry.getValue().size());
for (Wire wire : resultEntry.getValue()) {
ModuleWire moduleWire = new ModuleWire((ModuleCapability) wire.getCapability(), (ModuleRevision) wire.getProvider(), (ModuleRequirement) wire.getRequirement(), (ModuleRevision) wire.getRequirer());
requiredWires.add(moduleWire);
Map<ModuleCapability, List<ModuleWire>> providedWiresMap = provided.get(moduleWire.getProvider());
if (providedWiresMap == null) {
- providedWiresMap = new HashMap<ModuleCapability, List<ModuleWire>>();
+ providedWiresMap = new HashMap<>();
provided.put(moduleWire.getProvider(), providedWiresMap);
}
List<ModuleWire> providedWires = providedWiresMap.get(moduleWire.getCapability());
if (providedWires == null) {
- providedWires = new ArrayList<ModuleWire>();
+ providedWires = new ArrayList<>();
providedWiresMap.put(moduleWire.getCapability(), providedWires);
}
providedWires.add(moduleWire);
@@ -162,7 +162,7 @@ final class ModuleResolver {
required.put(revision, requiredWires);
}
- Map<ModuleRevision, ModuleWiring> delta = new HashMap<ModuleRevision, ModuleWiring>();
+ Map<ModuleRevision, ModuleWiring> delta = new HashMap<>();
// now create the ModuleWiring for the newly resolved revisions
for (ModuleRevision revision : required.keySet()) {
ModuleWiring existingWiring = wiringCopy.get(revision);
@@ -193,9 +193,9 @@ final class ModuleResolver {
if (requiredWires == null)
requiredWires = Collections.emptyList();
- List<ModuleCapability> capabilities = new ArrayList<ModuleCapability>(revision.getModuleCapabilities(null));
+ List<ModuleCapability> capabilities = new ArrayList<>(revision.getModuleCapabilities(null));
ListIterator<ModuleCapability> iCapabilities = capabilities.listIterator(capabilities.size());
- List<ModuleRequirement> requirements = new ArrayList<ModuleRequirement>(revision.getModuleRequirements(null));
+ List<ModuleRequirement> requirements = new ArrayList<>(revision.getModuleRequirements(null));
ListIterator<ModuleRequirement> iRequirements = requirements.listIterator(requirements.size());
// if revision is a fragment remove payload requirements and capabilities
@@ -214,7 +214,7 @@ final class ModuleResolver {
removeNonEffectiveRequirements(iRequirements, requiredWires);
Collection<String> substituted = removeSubstitutedCapabilities(iCapabilities, requiredWires);
- List<ModuleWire> providedWires = new ArrayList<ModuleWire>();
+ List<ModuleWire> providedWires = new ArrayList<>();
addProvidedWires(providedWireMap, providedWires, capabilities);
InternalUtils.filterCapabilityPermissions(capabilities);
@@ -252,7 +252,7 @@ final class ModuleResolver {
// this indicates a substitution
iCapabilities.remove();
if (substituted == null) {
- substituted = new ArrayList<String>();
+ substituted = new ArrayList<>();
}
if (!substituted.contains(packageName)) {
substituted.add(packageName);
@@ -266,7 +266,7 @@ final class ModuleResolver {
private static void removeNonEffectiveRequirements(ListIterator<ModuleRequirement> iRequirements, List<ModuleWire> requiredWires) {
- Set<ModuleRequirement> wireRequirements = new HashSet<ModuleRequirement>();
+ Set<ModuleRequirement> wireRequirements = new HashSet<>();
for (ModuleWire mw : requiredWires) {
wireRequirements.add(mw.getRequirement());
}
@@ -488,7 +488,7 @@ final class ModuleResolver {
@Override
public void logUsesConstraintViolation(Resource resource, ResolutionError error) {
if (errors == null) {
- errors = new HashMap<Resource, ResolutionException>();
+ errors = new HashMap<>();
}
errors.put(resource, error.toException());
if (DEBUG_USES) {
@@ -550,8 +550,8 @@ final class ModuleResolver {
private volatile Map<String, Collection<ModuleRevision>> byName = null;
private volatile List<Resource> currentlyResolving = null;
private volatile boolean currentlyResolvingMandatory = false;
- private final Set<Resource> transitivelyResolveFailures = new LinkedHashSet<Resource>();
- private final Set<Resource> failedToResolve = new HashSet<Resource>();
+ private final Set<Resource> transitivelyResolveFailures = new LinkedHashSet<>();
+ private final Set<Resource> failedToResolve = new HashSet<>();
private final long resolveTimeout = System.currentTimeMillis() + resolverBatchTimeout;
private volatile boolean checkTimeout = true;
/*
@@ -563,36 +563,36 @@ final class ModuleResolver {
* up from the set of unresolved resources, if any, after the resolution
* has occurred.
*/
- private final Map<Resource, Map<Requirement, Set<Capability>>> unresolvedProviders = new HashMap<Resource, Map<Requirement, Set<Capability>>>();
+ private final Map<Resource, Map<Requirement, Set<Capability>>> unresolvedProviders = new HashMap<>();
ResolveProcess(Collection<ModuleRevision> unresolved, Collection<ModuleRevision> triggers, boolean triggersMandatory, Map<ModuleRevision, ModuleWiring> wirings, ModuleDatabase moduleDatabase) {
this.unresolved = unresolved;
- this.disabled = new HashSet<ModuleRevision>(unresolved);
- this.triggers = new ArrayList<ModuleRevision>(triggers);
+ this.disabled = new HashSet<>(unresolved);
+ this.triggers = new ArrayList<>(triggers);
this.triggersMandatory = triggersMandatory;
- this.optionals = new LinkedHashSet<ModuleRevision>(unresolved);
+ this.optionals = new LinkedHashSet<>(unresolved);
if (this.triggersMandatory) {
// do this the hard way because the 'optimization' in removeAll hurts us
for (ModuleRevision triggerRevision : triggers) {
this.optionals.remove(triggerRevision);
}
}
- this.wirings = new HashMap<ModuleRevision, ModuleWiring>(wirings);
- this.previouslyResolved = new HashSet<ModuleRevision>(wirings.keySet());
+ this.wirings = new HashMap<>(wirings);
+ this.previouslyResolved = new HashSet<>(wirings.keySet());
this.moduleDatabase = moduleDatabase;
this.dynamicReq = null;
}
ResolveProcess(Collection<ModuleRevision> unresolved, DynamicModuleRequirement dynamicReq, Map<ModuleRevision, ModuleWiring> wirings, ModuleDatabase moduleDatabase) {
this.unresolved = unresolved;
- this.disabled = new HashSet<ModuleRevision>(unresolved);
+ this.disabled = new HashSet<>(unresolved);
ModuleRevision revision = dynamicReq.getRevision();
- this.triggers = new ArrayList<ModuleRevision>(1);
+ this.triggers = new ArrayList<>(1);
this.triggers.add(revision);
this.triggersMandatory = false;
- this.optionals = new ArrayList<ModuleRevision>(unresolved);
+ this.optionals = new ArrayList<>(unresolved);
this.wirings = wirings;
- this.previouslyResolved = new HashSet<ModuleRevision>(wirings.keySet());
+ this.previouslyResolved = new HashSet<>(wirings.keySet());
this.moduleDatabase = moduleDatabase;
this.dynamicReq = dynamicReq;
}
@@ -645,7 +645,7 @@ final class ModuleResolver {
List<ModuleCapability> filteredMatches = null;
if (DEBUG_PROVIDERS || DEBUG_HOOKS) {
- filteredMatches = new ArrayList<ModuleCapability>(candidates);
+ filteredMatches = new ArrayList<>(candidates);
}
hook.filterMatches((BundleRequirement) requirement, InternalUtils.asListBundleCapability(candidates));
if (DEBUG_PROVIDERS || DEBUG_HOOKS) {
@@ -851,7 +851,7 @@ final class ModuleResolver {
return Collections.emptyList();
}
- Collection<Resource> ondemandFragments = new ArrayList<Resource>();
+ Collection<Resource> ondemandFragments = new ArrayList<>();
for (String hostBSN : getHostBSNs(hostCaps)) {
String matchFilter = "(" + EquinoxFragmentNamespace.FRAGMENT_NAMESPACE + "=" + hostBSN + ")"; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
Requirement fragmentRequirement = ModuleContainer.createRequirement(EquinoxFragmentNamespace.FRAGMENT_NAMESPACE, Collections.<String, String> singletonMap(Namespace.REQUIREMENT_FILTER_DIRECTIVE, matchFilter), Collections.<String, Object> emptyMap());
@@ -878,7 +878,7 @@ final class ModuleResolver {
// optimization and likely the only case since you are not supposed to have multiple host caps
return getHostBSNs(hostCaps.get(0));
}
- Set<String> result = new HashSet<String>();
+ Set<String> result = new HashSet<>();
for (ModuleCapability hostCap : hostCaps) {
result.addAll(getHostBSNs(hostCap));
}
@@ -934,7 +934,7 @@ final class ModuleResolver {
if (dynamicReq != null) {
result = resolveDynamic();
} else {
- result = new HashMap<Resource, List<Wire>>();
+ result = new HashMap<>();
Map<Resource, List<Wire>> dynamicAttachWirings = resolveNonPayLoadFragments();
applyInterimResultToWiringCopy(dynamicAttachWirings);
if (!dynamicAttachWirings.isEmpty()) {
@@ -1013,8 +1013,8 @@ final class ModuleResolver {
long maxUsedMemory = 0;
// make a copy so we do not modify the input
- revisions = new LinkedList<ModuleRevision>(revisions);
- List<Resource> toResolve = new ArrayList<Resource>();
+ revisions = new LinkedList<>(revisions);
+ List<Resource> toResolve = new ArrayList<>();
try {
for (Iterator<ModuleRevision> iResources = revisions.iterator(); iResources.hasNext();) {
ModuleRevision single = iResources.next();
@@ -1183,12 +1183,12 @@ final class ModuleResolver {
Resource requirer = requirement.getResource();
Map<Requirement, Set<Capability>> requirementToCapabilities = unresolvedProviders.get(requirer);
if (requirementToCapabilities == null) {
- requirementToCapabilities = new HashMap<Requirement, Set<Capability>>();
+ requirementToCapabilities = new HashMap<>();
unresolvedProviders.put(requirer, requirementToCapabilities);
}
Set<Capability> value = requirementToCapabilities.get(requirement);
if (value == null) {
- value = new HashSet<Capability>(capabilities.size());
+ value = new HashSet<>(capabilities.size());
requirementToCapabilities.put(requirement, value);
}
for (Capability capability : capabilities)
@@ -1203,7 +1203,7 @@ final class ModuleResolver {
// host is always resolved.
// It is also useful for things like NLS fragments that are installed later
// without the need to refresh the host.
- Collection<ModuleRevision> nonPayLoadFrags = new ArrayList<ModuleRevision>();
+ Collection<ModuleRevision> nonPayLoadFrags = new ArrayList<>();
if (triggersMandatory) {
for (ModuleRevision moduleRevision : triggers) {
if (nonPayLoad(moduleRevision)) {
@@ -1220,12 +1220,12 @@ final class ModuleResolver {
if (nonPayLoadFrags.isEmpty()) {
return Collections.emptyMap();
}
- Map<Resource, List<Wire>> dynamicAttachment = new HashMap<Resource, List<Wire>>(0);
+ Map<Resource, List<Wire>> dynamicAttachment = new HashMap<>(0);
for (ModuleRevision nonPayLoad : nonPayLoadFrags) {
- List<Wire> allNonPayloadWires = new ArrayList<Wire>(0);
+ List<Wire> allNonPayloadWires = new ArrayList<>(0);
for (ModuleRequirement requirement : nonPayLoad.getModuleRequirements(null)) {
List<ModuleCapability> matching = moduleDatabase.findCapabilities(requirement);
- List<Wire> newWires = new ArrayList<Wire>(0);
+ List<Wire> newWires = new ArrayList<>(0);
filterProviders(requirement, matching, false);
for (ModuleCapability candidate : matching) {
if (HostNamespace.HOST_NAMESPACE.equals(requirement.getNamespace())) {
@@ -1280,7 +1280,7 @@ final class ModuleResolver {
}
private void filterResolvable() {
- Collection<ModuleRevision> enabledCandidates = new ArrayList<ModuleRevision>(unresolved);
+ Collection<ModuleRevision> enabledCandidates = new ArrayList<>(unresolved);
hook.filterResolvable(InternalUtils.asListBundleRevision((List<? extends BundleRevision>) enabledCandidates));
// do this the hard way because the 'optimization' in removeAll hurts us
for (ModuleRevision enabledRevision : enabledCandidates) {
@@ -1295,7 +1295,7 @@ final class ModuleResolver {
}
private void selectSingletons() {
- Map<String, Collection<ModuleRevision>> selectedSingletons = new HashMap<String, Collection<ModuleRevision>>();
+ Map<String, Collection<ModuleRevision>> selectedSingletons = new HashMap<>();
for (ModuleRevision revision : unresolved) {
if (!isSingleton(revision) || disabled.contains(revision))
continue;
@@ -1303,7 +1303,7 @@ final class ModuleResolver {
Collection<ModuleRevision> selected = selectedSingletons.get(bsn);
if (selected != null)
continue; // already processed the bsn
- selected = new ArrayList<ModuleRevision>(1);
+ selected = new ArrayList<>(1);
selectedSingletons.put(bsn, selected);
Collection<ModuleRevision> sameBSN = getRevisions(bsn);
@@ -1325,7 +1325,7 @@ final class ModuleResolver {
Collection<ModuleRevision> collisions = collisionMap.get(singleton);
if (collisions == null || disabled.contains(singleton))
continue; // not a singleton or not resolvable
- Collection<ModuleRevision> pickOneToResolve = new ArrayList<ModuleRevision>();
+ Collection<ModuleRevision> pickOneToResolve = new ArrayList<>();
for (ModuleRevision collision : collisions) {
if (selected.contains(collision)) {
// Must fail since there is already a selected bundle which is a collision of the singleton bundle
@@ -1364,14 +1364,14 @@ final class ModuleResolver {
if (current == null) {
// generate the map using unresolved collection and wiring snap shot
// this is to avoid interacting with the module database
- Set<ModuleRevision> revisions = new HashSet<ModuleRevision>();
+ Set<ModuleRevision> revisions = new HashSet<>();
revisions.addAll(unresolved);
revisions.addAll(previouslyResolved);
- current = new HashMap<String, Collection<ModuleRevision>>();
+ current = new HashMap<>();
for (ModuleRevision revision : revisions) {
Collection<ModuleRevision> sameName = current.get(revision.getSymbolicName());
if (sameName == null) {
- sameName = new ArrayList<ModuleRevision>();
+ sameName = new ArrayList<>();
current.put(revision.getSymbolicName(), sameName);
}
sameName.add(revision);
@@ -1405,23 +1405,23 @@ final class ModuleResolver {
}
private Map<ModuleRevision, Collection<ModuleRevision>> getCollisionMap(Collection<ModuleRevision> sameBSN) {
- Map<ModuleRevision, Collection<ModuleRevision>> result = new HashMap<ModuleRevision, Collection<ModuleRevision>>();
+ Map<ModuleRevision, Collection<ModuleRevision>> result = new HashMap<>();
for (ModuleRevision singleton : sameBSN) {
if (!isSingleton(singleton) || disabled.contains(singleton))
continue; // ignore non-singleton and non-resolvable
- List<BundleCapability> capabilities = new ArrayList<BundleCapability>(sameBSN.size() - 1);
+ List<BundleCapability> capabilities = new ArrayList<>(sameBSN.size() - 1);
for (ModuleRevision collision : sameBSN) {
if (collision == singleton || !isSingleton(collision) || disabled.contains(collision))
continue; // Ignore the bundle we are checking and non-singletons and non-resolvable
capabilities.add(getIdentity(collision));
}
hook.filterSingletonCollisions(getIdentity(singleton), capabilities);
- Collection<ModuleRevision> collisionCandidates = new ArrayList<ModuleRevision>(capabilities.size());
+ Collection<ModuleRevision> collisionCandidates = new ArrayList<>(capabilities.size());
for (BundleCapability identity : capabilities) {
collisionCandidates.add((ModuleRevision) identity.getRevision());
}
if (DEBUG_HOOKS) {
- Collection<ModuleRevision> filteredSingletons = new ArrayList<ModuleRevision>(sameBSN);
+ Collection<ModuleRevision> filteredSingletons = new ArrayList<>(sameBSN);
filteredSingletons.removeAll(collisionCandidates);
filteredSingletons.remove(singleton);
if (!filteredSingletons.isEmpty()) {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleRevision.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleRevision.java
index b8e452fc4..be20ea351 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleRevision.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleRevision.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2014 IBM Corporation and others.
+ * Copyright (c) 2012, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -49,7 +49,7 @@ public final class ModuleRevision implements BundleRevision {
private List<ModuleCapability> createCapabilities(List<GenericInfo> capabilityInfos) {
if (capabilityInfos == null || capabilityInfos.isEmpty())
return Collections.emptyList();
- List<ModuleCapability> result = new ArrayList<ModuleCapability>(capabilityInfos.size());
+ List<ModuleCapability> result = new ArrayList<>(capabilityInfos.size());
for (GenericInfo info : capabilityInfos) {
result.add(new ModuleCapability(info.namespace, info.directives, info.attributes, this));
}
@@ -59,7 +59,7 @@ public final class ModuleRevision implements BundleRevision {
private List<ModuleRequirement> createRequirements(List<GenericInfo> requirementInfos) {
if (requirementInfos == null || requirementInfos.isEmpty())
return Collections.emptyList();
- List<ModuleRequirement> result = new ArrayList<ModuleRequirement>(requirementInfos.size());
+ List<ModuleRequirement> result = new ArrayList<>(requirementInfos.size());
for (GenericInfo info : requirementInfos) {
result.add(new ModuleRequirement(info.namespace, info.directives, info.attributes, this));
}
@@ -100,7 +100,7 @@ public final class ModuleRevision implements BundleRevision {
public List<ModuleCapability> getModuleCapabilities(String namespace) {
if (namespace == null)
return Collections.unmodifiableList(capabilities);
- List<ModuleCapability> result = new ArrayList<ModuleCapability>();
+ List<ModuleCapability> result = new ArrayList<>();
for (ModuleCapability capability : capabilities) {
if (namespace.equals(capability.getNamespace())) {
result.add(capability);
@@ -118,7 +118,7 @@ public final class ModuleRevision implements BundleRevision {
public List<ModuleRequirement> getModuleRequirements(String namespace) {
if (namespace == null)
return Collections.unmodifiableList(requirements);
- List<ModuleRequirement> result = new ArrayList<ModuleRequirement>();
+ List<ModuleRequirement> result = new ArrayList<>();
for (ModuleRequirement requirement : requirements) {
if (namespace.equals(requirement.getNamespace())) {
result.add(requirement);
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleRevisionBuilder.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleRevisionBuilder.java
index c3cd310ba..ebad63049 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleRevisionBuilder.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleRevisionBuilder.java
@@ -73,8 +73,8 @@ public final class ModuleRevisionBuilder {
private String symbolicName = null;
private Version version = Version.emptyVersion;
private int types = 0;
- private final List<GenericInfo> capabilityInfos = new ArrayList<GenericInfo>();
- private final List<GenericInfo> requirementInfos = new ArrayList<GenericInfo>();
+ private final List<GenericInfo> capabilityInfos = new ArrayList<>();
+ private final List<GenericInfo> requirementInfos = new ArrayList<>();
/**
* Constructs a new module builder
@@ -122,7 +122,7 @@ public final class ModuleRevisionBuilder {
* @return the capabilities
*/
public List<GenericInfo> getCapabilities() {
- return new ArrayList<GenericInfo>(capabilityInfos);
+ return new ArrayList<>(capabilityInfos);
}
/**
@@ -140,7 +140,7 @@ public final class ModuleRevisionBuilder {
* @return the requirements
*/
public List<GenericInfo> getRequirements() {
- return new ArrayList<GenericInfo>(requirementInfos);
+ return new ArrayList<>(requirementInfos);
}
/**
@@ -232,7 +232,7 @@ public final class ModuleRevisionBuilder {
private static void addGenericInfo(List<GenericInfo> infos, String namespace, Map<String, String> directives, Map<String, Object> attributes) {
if (infos == null) {
- infos = new ArrayList<GenericInfo>();
+ infos = new ArrayList<>();
}
infos.add(new GenericInfo(namespace, copyUnmodifiableMap(directives), copyUnmodifiableMap(attributes)));
}
@@ -246,7 +246,7 @@ public final class ModuleRevisionBuilder {
Map.Entry<K, V> entry = map.entrySet().iterator().next();
return Collections.singletonMap(entry.getKey(), entry.getValue());
}
- return Collections.unmodifiableMap(new HashMap<K, V>(map));
+ return Collections.unmodifiableMap(new HashMap<>(map));
}
void basicAddCapability(String namespace, Map<String, String> directives, Map<String, Object> attributes) {
@@ -259,7 +259,7 @@ public final class ModuleRevisionBuilder {
private static void basicAddGenericInfo(List<GenericInfo> infos, String namespace, Map<String, String> directives, Map<String, Object> attributes) {
if (infos == null) {
- infos = new ArrayList<GenericInfo>();
+ infos = new ArrayList<>();
}
infos.add(new GenericInfo(namespace, unmodifiableMap(directives), unmodifiableMap(attributes)));
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleRevisions.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleRevisions.java
index a7cfa37b3..907a05dbe 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleRevisions.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleRevisions.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 IBM Corporation and others.
+ * Copyright (c) 2012, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -30,7 +30,7 @@ public final class ModuleRevisions implements BundleRevisions {
private final Module module;
private final ModuleContainer container;
/* @GuardedBy("monitor") */
- private final List<ModuleRevision> revisions = new ArrayList<ModuleRevision>(1);
+ private final List<ModuleRevision> revisions = new ArrayList<>(1);
/* @GuardedBy("monitor") */
private boolean uninstalled = false;
/* @GuardedBy("monitor") */
@@ -68,7 +68,7 @@ public final class ModuleRevisions implements BundleRevisions {
*/
public List<ModuleRevision> getModuleRevisions() {
synchronized (monitor) {
- return new ArrayList<ModuleRevision>(revisions);
+ return new ArrayList<>(revisions);
}
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleWiring.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleWiring.java
index 8a26639be..18d17b902 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleWiring.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleWiring.java
@@ -45,12 +45,12 @@ public final class ModuleWiring implements BundleWiring {
private volatile List<ModuleCapability> capabilities;
private volatile List<ModuleRequirement> requirements;
private final Collection<String> substitutedPkgNames;
- private final AtomicLazyInitializer<ModuleLoader> loader = new AtomicLazyInitializer<ModuleLoader>();
+ private final AtomicLazyInitializer<ModuleLoader> loader = new AtomicLazyInitializer<>();
private final LoaderInitializer loaderInitializer = new LoaderInitializer();
private volatile List<ModuleWire> providedWires;
private volatile List<ModuleWire> requiredWires;
volatile boolean isValid = true;
- private final AtomicReference<Set<String>> dynamicMissRef = new AtomicReference<Set<String>>();
+ private final AtomicReference<Set<String>> dynamicMissRef = new AtomicReference<>();
ModuleWiring(ModuleRevision revision, List<ModuleCapability> capabilities, List<ModuleRequirement> requirements, List<ModuleWire> providedWires, List<ModuleWire> requiredWires, Collection<String> substitutedPkgNames) {
super();
@@ -102,8 +102,8 @@ public final class ModuleWiring implements BundleWiring {
if (!isValid)
return null;
if (namespace == null)
- return new ArrayList<ModuleCapability>(allCapabilities);
- List<ModuleCapability> result = new ArrayList<ModuleCapability>();
+ return new ArrayList<>(allCapabilities);
+ List<ModuleCapability> result = new ArrayList<>();
for (ModuleCapability capability : allCapabilities) {
if (namespace.equals(capability.getNamespace())) {
result.add(capability);
@@ -143,8 +143,8 @@ public final class ModuleWiring implements BundleWiring {
if (!isValid)
return null;
if (namespace == null)
- return new ArrayList<ModuleRequirement>(allRequirements);
- List<ModuleRequirement> result = new ArrayList<ModuleRequirement>();
+ return new ArrayList<>(allRequirements);
+ List<ModuleRequirement> result = new ArrayList<>();
for (ModuleRequirement requirement : allRequirements) {
if (namespace.equals(requirement.getNamespace())) {
result.add(requirement);
@@ -224,8 +224,8 @@ public final class ModuleWiring implements BundleWiring {
if (!isValid)
return null;
if (namespace == null)
- return new ArrayList<ModuleWire>(allWires);
- List<ModuleWire> result = new ArrayList<ModuleWire>();
+ return new ArrayList<>(allWires);
+ List<ModuleWire> result = new ArrayList<>();
for (ModuleWire moduleWire : allWires) {
if (namespace.equals(moduleWire.getCapability().getNamespace())) {
result.add(moduleWire);
@@ -410,13 +410,13 @@ public final class ModuleWiring implements BundleWiring {
*/
public void addDynamicImports(ModuleRevisionBuilder builder) {
List<GenericInfo> newImports = builder.getRequirements();
- List<ModuleRequirement> newRequirements = new ArrayList<ModuleRequirement>();
+ List<ModuleRequirement> newRequirements = new ArrayList<>();
for (GenericInfo info : newImports) {
if (!PackageNamespace.PACKAGE_NAMESPACE.equals(info.getNamespace())) {
throw new IllegalArgumentException("Invalid namespace for package imports: " + info.getNamespace()); //$NON-NLS-1$
}
- Map<String, Object> attributes = new HashMap<String, Object>(info.getAttributes());
- Map<String, String> directives = new HashMap<String, String>(info.getDirectives());
+ Map<String, Object> attributes = new HashMap<>(info.getAttributes());
+ Map<String, String> directives = new HashMap<>(info.getDirectives());
directives.put(DYNAMICALLY_ADDED_IMPORT_DIRECTIVE, "true"); //$NON-NLS-1$
directives.put(PackageNamespace.REQUIREMENT_RESOLUTION_DIRECTIVE, PackageNamespace.RESOLUTION_DYNAMIC);
newRequirements.add(new ModuleRequirement(info.getNamespace(), directives, attributes, revision));
@@ -424,7 +424,7 @@ public final class ModuleWiring implements BundleWiring {
ModuleDatabase moduleDatabase = revision.getRevisions().getContainer().moduleDatabase;
moduleDatabase.writeLock();
try {
- List<ModuleRequirement> updatedRequirements = new ArrayList<ModuleRequirement>(requirements);
+ List<ModuleRequirement> updatedRequirements = new ArrayList<>(requirements);
updatedRequirements.addAll(newRequirements);
requirements = updatedRequirements;
} finally {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/SystemModule.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/SystemModule.java
index 0f4b65e2b..27a0e8b95 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/SystemModule.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/SystemModule.java
@@ -30,7 +30,7 @@ import org.osgi.service.resolver.ResolutionException;
* @since 3.10
*/
public abstract class SystemModule extends Module {
- private volatile AtomicReference<ContainerEvent> forStop = new AtomicReference<ContainerEvent>();
+ private volatile AtomicReference<ContainerEvent> forStop = new AtomicReference<>();
public SystemModule(ModuleContainer container) {
super(new Long(0), Constants.SYSTEM_BUNDLE_LOCATION, container, EnumSet.of(Settings.AUTO_START, Settings.USE_ACTIVATION_POLICY), Integer.valueOf(0));
@@ -87,7 +87,7 @@ public abstract class SystemModule extends Module {
AtomicReference<ContainerEvent> existingForStop = forStop;
if (existingForStop.get() != null) {
// There was a previous launch, reset the reference forStop
- forStop = new AtomicReference<ContainerEvent>();
+ forStop = new AtomicReference<>();
}
publishEvent(ModuleEvent.STARTING);
try {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java
index 8a08c2dd9..4b8256e2e 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java
@@ -78,7 +78,7 @@ public final class OSGiManifestBuilderFactory {
Object symbolicName = getSymbolicNameAndVersion(builder, manifest, symbolicNameAlias, manifestVersion);
- Collection<Map<String, Object>> exportedPackages = new ArrayList<Map<String, Object>>();
+ Collection<Map<String, Object>> exportedPackages = new ArrayList<>();
getPackageExports(builder, ManifestElement.parseHeader(Constants.EXPORT_PACKAGE, manifest.get(Constants.EXPORT_PACKAGE)), symbolicName, exportedPackages);
getPackageExports(builder, ManifestElement.parseHeader(HEADER_OLD_PROVIDE_PACKAGE, manifest.get(HEADER_OLD_PROVIDE_PACKAGE)), symbolicName, exportedPackages);
if (extraExports != null && !extraExports.isEmpty()) {
@@ -131,7 +131,7 @@ public final class OSGiManifestBuilderFactory {
if (elements == null)
return;
int length = elements.length;
- Set<String> packages = new HashSet<String>(length);
+ Set<String> packages = new HashSet<>(length);
for (int i = 0; i < length; i++) {
// check for duplicate imports
String[] packageNames = elements[i].getValueComponents();
@@ -259,7 +259,7 @@ public final class OSGiManifestBuilderFactory {
ManifestElement bsnElement = symbolicNameElements[0];
builder.setSymbolicName(bsnElement.getValue());
if (symbolicNameAlias != null) {
- List<String> result = new ArrayList<String>();
+ List<String> result = new ArrayList<>();
result.add(builder.getSymbolicName());
result.add(symbolicNameAlias);
symbolicName = result;
@@ -279,7 +279,7 @@ public final class OSGiManifestBuilderFactory {
}
if (!isFragment) {
// create the bundle namespace
- Map<String, Object> bundleAttributes = new HashMap<String, Object>(attributes);
+ Map<String, Object> bundleAttributes = new HashMap<>(attributes);
bundleAttributes.put(BundleNamespace.BUNDLE_NAMESPACE, symbolicName);
bundleAttributes.put(BundleNamespace.CAPABILITY_BUNDLE_VERSION_ATTRIBUTE, builder.getVersion());
builder.addCapability(BundleNamespace.BUNDLE_NAMESPACE, directives, bundleAttributes);
@@ -287,7 +287,7 @@ public final class OSGiManifestBuilderFactory {
// create the host namespace
// only if the directive is not never
if (!HostNamespace.FRAGMENT_ATTACHMENT_NEVER.equals(directives.get(HostNamespace.CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE))) {
- Map<String, Object> hostAttributes = new HashMap<String, Object>(attributes);
+ Map<String, Object> hostAttributes = new HashMap<>(attributes);
hostAttributes.put(HostNamespace.HOST_NAMESPACE, symbolicName);
hostAttributes.put(HostNamespace.CAPABILITY_BUNDLE_VERSION_ATTRIBUTE, builder.getVersion());
builder.addCapability(HostNamespace.HOST_NAMESPACE, directives, hostAttributes);
@@ -295,7 +295,7 @@ public final class OSGiManifestBuilderFactory {
}
// every bundle that has a symbolic name gets an identity;
// never use the symbolic name alias for the identity namespace
- Map<String, Object> identityAttributes = new HashMap<String, Object>(attributes);
+ Map<String, Object> identityAttributes = new HashMap<>(attributes);
identityAttributes.put(IdentityNamespace.IDENTITY_NAMESPACE, builder.getSymbolicName());
identityAttributes.put(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE, builder.getVersion());
identityAttributes.put(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE, isFragment ? IdentityNamespace.TYPE_FRAGMENT : IdentityNamespace.TYPE_BUNDLE);
@@ -324,7 +324,7 @@ public final class OSGiManifestBuilderFactory {
}
attributes.put(PackageNamespace.CAPABILITY_BUNDLE_VERSION_ATTRIBUTE, builder.getVersion());
for (String packageName : packageNames) {
- Map<String, Object> packageAttrs = new HashMap<String, Object>(attributes);
+ Map<String, Object> packageAttrs = new HashMap<>(attributes);
packageAttrs.put(PackageNamespace.PACKAGE_NAMESPACE, packageName);
builder.addCapability(PackageNamespace.PACKAGE_NAMESPACE, directives, packageAttrs);
exportedPackages.add(packageAttrs);
@@ -333,7 +333,7 @@ public final class OSGiManifestBuilderFactory {
}
private static void getPackageImports(ModuleRevisionBuilder builder, Map<String, String> manifest, Collection<Map<String, Object>> exportedPackages, int manifestVersion) throws BundleException {
- Collection<String> importPackageNames = new ArrayList<String>();
+ Collection<String> importPackageNames = new ArrayList<>();
ManifestElement[] importElements = ManifestElement.parseHeader(Constants.IMPORT_PACKAGE, manifest.get(Constants.IMPORT_PACKAGE));
ManifestElement[] dynamicImportElements = ManifestElement.parseHeader(Constants.DYNAMICIMPORT_PACKAGE, manifest.get(Constants.DYNAMICIMPORT_PACKAGE));
addPackageImports(builder, importElements, importPackageNames, false);
@@ -368,7 +368,7 @@ public final class OSGiManifestBuilderFactory {
importPackageNames.add(packageName);
}
// fill in the filter directive based on the attributes
- Map<String, String> packageDirectives = new HashMap<String, String>(directives);
+ Map<String, String> packageDirectives = new HashMap<>(directives);
StringBuilder filter = new StringBuilder();
filter.append('(').append(PackageNamespace.PACKAGE_NAMESPACE).append('=').append(packageName).append(')');
int size = filter.length();
@@ -406,14 +406,14 @@ public final class OSGiManifestBuilderFactory {
StringBuilder filter = new StringBuilder();
filter.append("(&(").append(PackageNamespace.PACKAGE_NAMESPACE).append('=').append(packageName).append(')'); //$NON-NLS-1$
filter.append('(').append(PackageNamespace.CAPABILITY_VERSION_ATTRIBUTE).append(">=").append(packageVersion).append("))"); //$NON-NLS-1$//$NON-NLS-2$
- Map<String, String> directives = new HashMap<String, String>(1);
+ Map<String, String> directives = new HashMap<>(1);
directives.put(PackageNamespace.REQUIREMENT_FILTER_DIRECTIVE, filter.toString());
builder.addRequirement(PackageNamespace.PACKAGE_NAMESPACE, directives, new HashMap<String, Object>(0));
}
}
private static Map<String, String> getDirectives(ManifestElement element) {
- Map<String, String> directives = new HashMap<String, String>();
+ Map<String, String> directives = new HashMap<>();
Enumeration<String> keys = element.getDirectiveKeys();
if (keys == null)
return directives;
@@ -445,7 +445,7 @@ public final class OSGiManifestBuilderFactory {
continue;
}
// fill in the filter directive based on the attributes
- Map<String, String> bundleDirectives = new HashMap<String, String>(directives);
+ Map<String, String> bundleDirectives = new HashMap<>(directives);
StringBuilder filter = new StringBuilder();
filter.append('(').append(BundleNamespace.BUNDLE_NAMESPACE).append('=').append(bundleName).append(')');
int size = filter.length();
@@ -537,14 +537,14 @@ public final class OSGiManifestBuilderFactory {
return;
}
// only support one
- HashMap<String, String> directives = new HashMap<String, String>();
+ HashMap<String, String> directives = new HashMap<>();
directives.put(EclipsePlatformNamespace.REQUIREMENT_FILTER_DIRECTIVE, platformFilter);
builder.addRequirement(EclipsePlatformNamespace.ECLIPSE_PLATFORM_NAMESPACE, directives, Collections.<String, Object> emptyMap());
}
@SuppressWarnings("deprecation")
private static void getEquinoxDataCapability(ModuleRevisionBuilder builder, Map<String, String> manifest) throws BundleException {
- Map<String, Object> attributes = new HashMap<String, Object>();
+ Map<String, Object> attributes = new HashMap<>();
// Get the activation policy attributes
ManifestElement[] policyElements = ManifestElement.parseHeader(Constants.BUNDLE_ACTIVATIONPOLICY, manifest.get(Constants.BUNDLE_ACTIVATIONPOLICY));
@@ -600,7 +600,7 @@ public final class OSGiManifestBuilderFactory {
// Get the class path
ManifestElement[] classpathElements = ManifestElement.parseHeader(Constants.BUNDLE_CLASSPATH, manifest.get(Constants.BUNDLE_CLASSPATH));
if (classpathElements != null) {
- List<String> classpath = new ArrayList<String>();
+ List<String> classpath = new ArrayList<>();
for (ManifestElement element : classpathElements) {
String[] components = element.getValueComponents();
for (String component : components) {
@@ -613,7 +613,7 @@ public final class OSGiManifestBuilderFactory {
// Get the buddy policy list
ManifestElement[] buddyPolicies = ManifestElement.parseHeader(EquinoxModuleDataNamespace.BUDDY_POLICY_HEADER, manifest.get(EquinoxModuleDataNamespace.BUDDY_POLICY_HEADER));
if (buddyPolicies != null) {
- List<String> policies = new ArrayList<String>();
+ List<String> policies = new ArrayList<>();
for (ManifestElement element : buddyPolicies) {
for (String component : element.getValueComponents()) {
policies.add(component);
@@ -625,7 +625,7 @@ public final class OSGiManifestBuilderFactory {
// Get the registered buddy list
ManifestElement[] registeredBuddies = ManifestElement.parseHeader(EquinoxModuleDataNamespace.REGISTERED_BUDDY_HEADER, manifest.get(EquinoxModuleDataNamespace.REGISTERED_BUDDY_HEADER));
if (registeredBuddies != null) {
- List<String> buddies = new ArrayList<String>();
+ List<String> buddies = new ArrayList<>();
for (ManifestElement element : registeredBuddies) {
for (String component : element.getValueComponents()) {
buddies.add(component);
@@ -643,7 +643,7 @@ public final class OSGiManifestBuilderFactory {
private static Map<String, Object> getAttributes(ManifestElement element) throws BundleException {
Enumeration<String> keys = element.getKeys();
- Map<String, Object> attributes = new HashMap<String, Object>();
+ Map<String, Object> attributes = new HashMap<>();
if (keys == null)
return attributes;
while (keys.hasMoreElements()) {
@@ -697,7 +697,7 @@ public final class OSGiManifestBuilderFactory {
throw new BundleException("Invalid type, missing ending '>' : " + type, BundleException.MANIFEST_ERROR); //$NON-NLS-1$
}
List<String> tokens = new Tokenizer(value).getEscapedTokens(","); //$NON-NLS-1$
- List<Object> components = new ArrayList<Object>();
+ List<Object> components = new ArrayList<>();
for (String component : tokens) {
components.add(convertValue(componentType, component));
}
@@ -709,7 +709,7 @@ public final class OSGiManifestBuilderFactory {
String[] brees = ManifestElement.getArrayFromList(manifest.get(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT));
if (brees == null || brees.length == 0)
return;
- List<String> breeFilters = new ArrayList<String>();
+ List<String> breeFilters = new ArrayList<>();
for (String bree : brees)
breeFilters.add(createOSGiEERequirementFilter(bree));
String filterSpec;
@@ -723,7 +723,7 @@ public final class OSGiManifestBuilderFactory {
filterSpec = filterBuf.append(")").toString(); //$NON-NLS-1$
}
- Map<String, String> directives = new HashMap<String, String>(1);
+ Map<String, String> directives = new HashMap<>(1);
directives.put(ExecutionEnvironmentNamespace.REQUIREMENT_FILTER_DIRECTIVE, filterSpec);
builder.addRequirement(ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE, directives, new HashMap<String, Object>(0));
}
@@ -847,7 +847,7 @@ public final class OSGiManifestBuilderFactory {
NativeClause(int manifestIndex, ManifestElement clause) throws BundleException {
this.manifestIndex = manifestIndex;
- this.nativePaths = new ArrayList<String>(Arrays.asList(clause.getValueComponents()));
+ this.nativePaths = new ArrayList<>(Arrays.asList(clause.getValueComponents()));
StringBuilder sb = new StringBuilder();
sb.append("(&"); //$NON-NLS-1$
addToNativeCodeFilter(sb, clause, Constants.BUNDLE_NATIVECODE_OSNAME);
@@ -943,7 +943,7 @@ public final class OSGiManifestBuilderFactory {
boolean optional = false;
- List<NativeClause> nativeClauses = new ArrayList<NativeClause>();
+ List<NativeClause> nativeClauses = new ArrayList<>();
for (int i = 0; i < elements.length; i++) {
if (i == elements.length - 1) {
optional = elements[i].getValue().equals("*"); //$NON-NLS-1$
@@ -963,7 +963,7 @@ public final class OSGiManifestBuilderFactory {
if (numNativePaths > 1) {
allNativeFilters.append("(|"); //$NON-NLS-1$
}
- Map<String, Object> attributes = new HashMap<String, Object>(2);
+ Map<String, Object> attributes = new HashMap<>(2);
for (int i = 0; i < numNativePaths; i++) {
NativeClause nativeClause = nativeClauses.get(i);
if (numNativePaths == 1) {
@@ -977,7 +977,7 @@ public final class OSGiManifestBuilderFactory {
allNativeFilters.append(')');
}
- Map<String, String> directives = new HashMap<String, String>(2);
+ Map<String, String> directives = new HashMap<>(2);
directives.put(NativeNamespace.REQUIREMENT_FILTER_DIRECTIVE, allNativeFilters.toString());
if (optional) {
directives.put(NativeNamespace.REQUIREMENT_RESOLUTION_DIRECTIVE, NativeNamespace.RESOLUTION_OPTIONAL);
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/ArrayMap.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/ArrayMap.java
index 6fb04c520..e6f1865a5 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/ArrayMap.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/ArrayMap.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 IBM Corporation and others.
+ * Copyright (c) 2010, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -24,8 +24,8 @@ public class ArrayMap<K, V> implements Collection<K> {
final List<V> values;
public ArrayMap(int initialCapacity) {
- keys = new ArrayList<K>(initialCapacity);
- values = new ArrayList<V>(initialCapacity);
+ keys = new ArrayList<>(initialCapacity);
+ values = new ArrayList<>(initialCapacity);
}
/**
@@ -73,11 +73,11 @@ public class ArrayMap<K, V> implements Collection<K> {
}
public List<K> getKeys() {
- return new ArrayList<K>(keys);
+ return new ArrayList<>(keys);
}
public List<V> getValues() {
- return new ArrayList<V>(values);
+ return new ArrayList<>(values);
}
public int size() {
@@ -159,9 +159,9 @@ public class ArrayMap<K, V> implements Collection<K> {
}
public void sort(Comparator<K> comparator) {
- List<K> sortedKeys = new ArrayList<K>(keys);
+ List<K> sortedKeys = new ArrayList<>(keys);
Collections.sort(sortedKeys, comparator);
- List<V> sortedValues = new ArrayList<V>(sortedKeys.size());
+ List<V> sortedValues = new ArrayList<>(sortedKeys.size());
for (K key : sortedKeys) {
sortedValues.add(getByIdentity(key));
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/Headers.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/Headers.java
index 755331f6e..4bc302fa1 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/Headers.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/Headers.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2013 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -72,14 +72,14 @@ public class Headers<K, V> extends Dictionary<K, V> implements Map<K, V> {
* Case-preserved keys.
*/
public synchronized Enumeration<K> keys() {
- return new ArrayEnumeration<K>(headers, size);
+ return new ArrayEnumeration<>(headers, size);
}
/**
* Values.
*/
public synchronized Enumeration<V> elements() {
- return new ArrayEnumeration<V>(values, size);
+ return new ArrayEnumeration<>(values, size);
}
private int getIndex(Object key) {
@@ -275,7 +275,7 @@ public class Headers<K, V> extends Dictionary<K, V> implements Map<K, V> {
}
public static Headers<String, String> parseManifest(InputStream in) throws BundleException {
- Headers<String, String> headers = new Headers<String, String>(10);
+ Headers<String, String> headers = new Headers<>(10);
try {
ManifestElement.parseBundleManifest(in, headers);
} catch (IOException e) {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/ObjectPool.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/ObjectPool.java
index 548ba1615..9e394475e 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/ObjectPool.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/ObjectPool.java
@@ -21,7 +21,7 @@ public class ObjectPool {
// TODO need to set these
private static final boolean DEBUG_OBJECTPOOL_ADDS = false;
private static final boolean DEBUG_OBJECTPOOL_DUPS = false;
- private static Map<Object, WeakReference<Object>> objectCache = new WeakHashMap<Object, WeakReference<Object>>();
+ private static Map<Object, WeakReference<Object>> objectCache = new WeakHashMap<>();
@SuppressWarnings("unchecked")
public static <T> T intern(T obj) {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/AtomicLazyInitializer.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/AtomicLazyInitializer.java
index bb72070d5..c0de1429f 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/AtomicLazyInitializer.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/AtomicLazyInitializer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 IBM Corporation and others.
+ * Copyright (c) 2014, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,7 +19,7 @@ import java.util.concurrent.atomic.AtomicReference;
* @param <V> the type of object to lazy initialize
*/
public class AtomicLazyInitializer<V> {
- private final AtomicReference<V> holder = new AtomicReference<V>();
+ private final AtomicReference<V> holder = new AtomicReference<>();
/**
* Gets the current value. If the value has not been initialized then
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/Capabilities.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/Capabilities.java
index 424d3624a..9732b87c3 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/Capabilities.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/Capabilities.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 IBM Corporation and others.
+ * Copyright (c) 2012, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,9 +25,9 @@ import org.osgi.resource.*;
public class Capabilities {
static class NamespaceSet {
private final String name;
- private final Map<String, Set<ModuleCapability>> indexes = new HashMap<String, Set<ModuleCapability>>();
- private final Set<ModuleCapability> all = new HashSet<ModuleCapability>();
- private final Set<ModuleCapability> nonStringIndexes = new HashSet<ModuleCapability>(0);
+ private final Map<String, Set<ModuleCapability>> indexes = new HashMap<>();
+ private final Set<ModuleCapability> all = new HashSet<>();
+ private final Set<ModuleCapability> nonStringIndexes = new HashSet<>(0);
private final boolean matchMandatory;
NamespaceSet(String name) {
@@ -66,7 +66,7 @@ public class Capabilities {
} else {
Set<ModuleCapability> capabilities = indexes.get(indexKey);
if (capabilities == null) {
- capabilities = new HashSet<ModuleCapability>(1);
+ capabilities = new HashSet<>(1);
indexes.put((String) indexKey, capabilities);
}
capabilities.add(capability);
@@ -135,7 +135,7 @@ public class Capabilities {
} else {
Set<ModuleCapability> indexed = indexes.get(indexKey);
if (indexed == null) {
- result = new ArrayList<ModuleCapability>(0);
+ result = new ArrayList<>(0);
} else {
result = match(f, indexed, synthetic);
}
@@ -153,7 +153,7 @@ public class Capabilities {
}
private List<ModuleCapability> match(Filter f, Set<ModuleCapability> candidates, boolean synthetic) {
- List<ModuleCapability> result = new ArrayList<ModuleCapability>(1);
+ List<ModuleCapability> result = new ArrayList<>(1);
for (ModuleCapability candidate : candidates) {
if (matches(f, candidate, !synthetic && matchMandatory)) {
result.add(candidate);
@@ -200,7 +200,7 @@ public class Capabilities {
return true;
}
- Map<String, NamespaceSet> namespaceSets = new HashMap<String, NamespaceSet>();
+ Map<String, NamespaceSet> namespaceSets = new HashMap<>();
/**
* Adds the {@link ModuleRevision#getModuleCapabilities(String) capabilities}
@@ -225,7 +225,7 @@ public class Capabilities {
Object packageName = capability.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE);
if (packageName instanceof String) {
if (packageNames == null) {
- packageNames = new ArrayList<String>();
+ packageNames = new ArrayList<>();
}
packageNames.add((String) packageName);
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/ComputeNodeOrder.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/ComputeNodeOrder.java
index 12ec3dd41..e4e02a560 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/ComputeNodeOrder.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/ComputeNodeOrder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2012 IBM Corporation and others.
+ * Copyright (c) 2004, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -93,7 +93,7 @@ public class ComputeNodeOrder {
*
* Element type: <code>Vertex</code>
*/
- public List<Vertex> adjacent = new ArrayList<Vertex>(3);
+ public List<Vertex> adjacent = new ArrayList<>(3);
/**
* Creates a new vertex with the given id.
@@ -110,14 +110,14 @@ public class ComputeNodeOrder {
*
* Element type: <code>Vertex</code>
*/
- private List<Vertex> vertexList = new ArrayList<Vertex>(100);
+ private List<Vertex> vertexList = new ArrayList<>(100);
/**
* Map from id to vertex.
*
* Key type: <code>Object</code>; value type: <code>Vertex</code>
*/
- private Map<Object, Vertex> vertexMap = new HashMap<Object, Vertex>(100);
+ private Map<Object, Vertex> vertexMap = new HashMap<>(100);
/**
* DFS visit time. Non-negative.
@@ -270,7 +270,7 @@ public class ComputeNodeOrder {
}
// find the roots of each component
// Map<Vertex,List<Object>> components
- Map<Vertex, List<Object>> components = new HashMap<Vertex, List<Object>>();
+ Map<Vertex, List<Object>> components = new HashMap<>();
for (Iterator<Vertex> it = vertexList.iterator(); it.hasNext();) {
Vertex vertex = it.next();
if (vertex.predecessor == null) {
@@ -284,14 +284,14 @@ public class ComputeNodeOrder {
}
List<Object> component = components.get(root);
if (component == null) {
- component = new ArrayList<Object>(2);
+ component = new ArrayList<>(2);
component.add(root.id);
components.put(root, component);
}
component.add(vertex.id);
}
}
- List<Object[]> result = new ArrayList<Object[]>(components.size());
+ List<Object[]> result = new ArrayList<>(components.size());
for (Iterator<List<Object>> it = components.values().iterator(); it.hasNext();) {
List<Object> component = it.next();
if (component.size() > 1) {
@@ -369,7 +369,7 @@ public class ComputeNodeOrder {
// all vertex.predecessor initially null;
time = 0;
// for a stack, append to the end of an array-based list
- List<Object> stack = new ArrayList<Object>(Math.max(1, vertexList.size()));
+ List<Object> stack = new ArrayList<>(Math.max(1, vertexList.size()));
Iterator<Vertex> allAdjacent = null;
Vertex vertex = null;
Iterator<Vertex> allV = vertexList.iterator();
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/LockSet.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/LockSet.java
index 1e9925f95..fe6a64b1e 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/LockSet.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/LockSet.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2015 IBM Corporation and others.
+ * Copyright (c) 2012, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -50,7 +50,7 @@ public class LockSet<T> {
}
}
- private final Map<T, LockHolder> locks = new HashMap<T, LockHolder>();
+ private final Map<T, LockHolder> locks = new HashMap<>();
public boolean tryLock(T t, long time, TimeUnit unit) throws InterruptedException {
final boolean previousInterruption = Thread.interrupted();
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/debug/FrameworkDebugOptions.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/debug/FrameworkDebugOptions.java
index 73b3147d9..e1f347be1 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/debug/FrameworkDebugOptions.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/debug/FrameworkDebugOptions.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2014 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -44,7 +44,7 @@ public class FrameworkDebugOptions implements DebugOptions, ServiceTrackerCustom
/** A map of all the disabled options with values set at the time debug was disabled */
private Properties disabledOptions = null;
/** A cache of all of the bundles <code>DebugTrace</code> in the format <key,value> --> <bundle name, DebugTrace> */
- protected final Map<String, DebugTrace> debugTraceCache = new HashMap<String, DebugTrace>();
+ protected final Map<String, DebugTrace> debugTraceCache = new HashMap<>();
/** The File object to store messages. This value may be null. */
protected File outFile = null;
/** Is verbose debugging enabled? Changing this value causes a new tracing session to start. */
@@ -104,7 +104,7 @@ public class FrameworkDebugOptions implements DebugOptions, ServiceTrackerCustom
public void start(BundleContext bc) {
this.context = bc;
- listenerTracker = new ServiceTracker<DebugOptionsListener, DebugOptionsListener>(bc, DebugOptionsListener.class.getName(), this);
+ listenerTracker = new ServiceTracker<>(bc, DebugOptionsListener.class.getName(), this);
listenerTracker.open();
}
@@ -185,7 +185,7 @@ public class FrameworkDebugOptions implements DebugOptions, ServiceTrackerCustom
@SuppressWarnings({"unchecked", "rawtypes"})
public Map<String, String> getOptions() {
- Map<String, String> snapShot = new HashMap<String, String>();
+ Map<String, String> snapShot = new HashMap<>();
synchronized (lock) {
if (options != null)
snapShot.putAll((Map) options);
@@ -301,7 +301,7 @@ public class FrameworkDebugOptions implements DebugOptions, ServiceTrackerCustom
// no events to fire
return;
}
- fireChangesTo = new HashSet<String>();
+ fireChangesTo = new HashSet<>();
// first check for removals
for (Iterator<Object> keys = options.keySet().iterator(); keys.hasNext();) {
String key = (String) keys.next();
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/AliasMapper.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/AliasMapper.java
index e1b3d1a94..67be8107b 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/AliasMapper.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/AliasMapper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2013 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -20,10 +20,10 @@ import org.eclipse.osgi.internal.util.Tokenizer;
* This class maps aliases.
*/
public class AliasMapper {
- private static final Map<String, Collection<String>> processorAliasTable = new HashMap<String, Collection<String>>();
- private static final Map<String, String> processorCanonicalTable = new HashMap<String, String>();
- private static final Map<String, Collection<String>> osnameAliasTable = new HashMap<String, Collection<String>>();
- private static final Map<String, String> osnameCanonicalTable = new HashMap<String, String>();
+ private static final Map<String, Collection<String>> processorAliasTable = new HashMap<>();
+ private static final Map<String, String> processorCanonicalTable = new HashMap<>();
+ private static final Map<String, Collection<String>> osnameAliasTable = new HashMap<>();
+ private static final Map<String, String> osnameCanonicalTable = new HashMap<>();
static {
getTables("osname.aliases", osnameAliasTable, osnameCanonicalTable); //$NON-NLS-1$
getTables("processor.aliases", processorAliasTable, processorCanonicalTable); //$NON-NLS-1$
@@ -99,10 +99,10 @@ public class AliasMapper {
} catch (UnsupportedEncodingException e) {
br = new BufferedReader(new InputStreamReader(in));
}
- Map<String, Set<String>> multiMaster = new HashMap<String, Set<String>>();
+ Map<String, Set<String>> multiMaster = new HashMap<>();
while (true) {
String line = br.readLine();
- if (line == null) /* EOF */{
+ if (line == null) /* EOF */ {
break; /* done */
}
Tokenizer tokenizer = new Tokenizer(line);
@@ -110,7 +110,7 @@ public class AliasMapper {
if (master != null) {
String masterLower = master.toLowerCase();
canonicalTable.put(masterLower, master);
- Collection<String> aliasLine = new ArrayList<String>(1);
+ Collection<String> aliasLine = new ArrayList<>(1);
aliasLine.add(master);
parseloop: while (true) {
String alias = tokenizer.getString("# \t"); //$NON-NLS-1$
@@ -126,7 +126,7 @@ public class AliasMapper {
String existingMaster = canonicalTable.put(aliasLower, alias);
Set<String> masters = multiMaster.get(aliasLower);
if (masters == null) {
- masters = new HashSet<String>();
+ masters = new HashSet<>();
multiMaster.put(aliasLower, masters);
masters.add(existingMaster.toLowerCase());
}
@@ -136,9 +136,9 @@ public class AliasMapper {
aliasTable.put(masterLower, aliasLine);
}
}
- Map<String, Set<String>> multiMasterAliases = new HashMap<String, Set<String>>(multiMaster.size());
+ Map<String, Set<String>> multiMasterAliases = new HashMap<>(multiMaster.size());
for (Entry<String, Set<String>> entry : multiMaster.entrySet()) {
- Set<String> aliases = new HashSet<String>();
+ Set<String> aliases = new HashSet<>();
for (String master : entry.getValue()) {
aliases.addAll(aliasTable.get(master));
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/BundleContextImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/BundleContextImpl.java
index 673d01883..a65bbe426 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/BundleContextImpl.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/BundleContextImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2013 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -164,7 +164,7 @@ public class BundleContextImpl implements BundleContext, EventDispatcher<Object,
return null;
}
- List<Bundle> bundles = new ArrayList<Bundle>(1);
+ List<Bundle> bundles = new ArrayList<>(1);
bundles.add(m.getBundle());
notifyFindHooks(this, bundles);
if (bundles.isEmpty()) {
@@ -189,7 +189,7 @@ public class BundleContextImpl implements BundleContext, EventDispatcher<Object,
*/
public Bundle[] getBundles() {
List<Module> modules = container.getStorage().getModuleContainer().getModules();
- List<Bundle> bundles = new ArrayList<Bundle>(modules.size());
+ List<Bundle> bundles = new ArrayList<>(modules.size());
for (Module module : modules) {
bundles.add(module.getBundle());
}
@@ -202,9 +202,9 @@ public class BundleContextImpl implements BundleContext, EventDispatcher<Object,
if (context.getBundleImpl().getBundleId() == 0) {
// Make a copy for the purposes of calling the hooks;
// The the removals from the hooks are ignored
- allBundles = new ArrayList<Bundle>(allBundles);
+ allBundles = new ArrayList<>(allBundles);
}
- final Collection<Bundle> shrinkable = new ShrinkableCollection<Bundle>(allBundles);
+ final Collection<Bundle> shrinkable = new ShrinkableCollection<>(allBundles);
if (System.getSecurityManager() == null) {
notifyFindHooksPriviledged(context, shrinkable);
} else {
@@ -873,7 +873,7 @@ public class BundleContextImpl implements BundleContext, EventDispatcher<Object,
synchronized (contextLock) {
if (servicesInUse == null)
// Cannot predict how many services a bundle will use, start with a small table.
- servicesInUse = new HashMap<ServiceRegistrationImpl<?>, ServiceUse<?>>(10);
+ servicesInUse = new HashMap<>(10);
}
}
@@ -1019,7 +1019,7 @@ public class BundleContextImpl implements BundleContext, EventDispatcher<Object,
Collection<ServiceReference<S>> empty = Collections.<ServiceReference<S>> emptyList();
return empty;
}
- List<ServiceReference<S>> result = new ArrayList<ServiceReference<S>>(refs.length);
+ List<ServiceReference<S>> result = new ArrayList<>(refs.length);
for (ServiceReference<S> b : refs) {
result.add(b);
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/ContextFinder.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/ContextFinder.java
index 07dbd791f..3be84911e 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/ContextFinder.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/ContextFinder.java
@@ -27,7 +27,7 @@ public class ContextFinder extends ClassLoader implements PrivilegedAction<List<
//This is used to detect cycle that could be caused while delegating the loading to other classloaders
//It keeps track on a thread basis of the set of requested classes and resources
- private static ThreadLocal<Set<String>> cycleDetector = new ThreadLocal<Set<String>>();
+ private static ThreadLocal<Set<String>> cycleDetector = new ThreadLocal<>();
static ClassLoader finderClassLoader;
static Finder contextFinder;
static {
@@ -55,7 +55,7 @@ public class ContextFinder extends ClassLoader implements PrivilegedAction<List<
// We assume that the bootclassloader never uses the context classloader to find classes in itself.
List<ClassLoader> basicFindClassLoaders() {
Class<?>[] stack = contextFinder.getClassContext();
- List<ClassLoader> result = new ArrayList<ClassLoader>(1);
+ List<ClassLoader> result = new ArrayList<>(1);
ClassLoader previousLoader = null;
for (int i = 1; i < stack.length; i++) {
ClassLoader tmp = stack[i].getClassLoader();
@@ -104,7 +104,7 @@ public class ContextFinder extends ClassLoader implements PrivilegedAction<List<
return false;
if (classesAndResources == null) {
- classesAndResources = new HashSet<String>(3);
+ classesAndResources = new HashSet<>(3);
cycleDetector.set(classesAndResources);
}
classesAndResources.add(name);
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/DTOBuilder.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/DTOBuilder.java
index a6a3f920d..ddf4a7409 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/DTOBuilder.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/DTOBuilder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2014 IBM Corporation and others.
+ * Copyright (c) 2012, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -29,8 +29,8 @@ public class DTOBuilder {
private final Map<BundleWiring, BundleWiringDTO.NodeDTO> wiringnodes;
private DTOBuilder() {
- resources = new IdentityHashMap<BundleRevision, BundleRevisionDTO>();
- wiringnodes = new IdentityHashMap<BundleWiring, BundleWiringDTO.NodeDTO>();
+ resources = new IdentityHashMap<>();
+ wiringnodes = new IdentityHashMap<>();
}
public static BundleDTO newBundleDTO(Bundle bundle) {
@@ -209,8 +209,8 @@ public class DTOBuilder {
BundleWiringDTO dto = new BundleWiringDTO();
dto.bundle = wiring.getBundle().getBundleId();
dto.root = getWiringId(wiring);
- dto.nodes = new HashSet<BundleWiringDTO.NodeDTO>(wiringnodes.values());
- dto.resources = new HashSet<BundleRevisionDTO>(resources.values());
+ dto.nodes = new HashSet<>(wiringnodes.values());
+ dto.resources = new HashSet<>(resources.values());
return dto;
}
@@ -274,7 +274,7 @@ public class DTOBuilder {
}
List<BundleRevision> revs = revisions.getRevisions();
final int size = revs.size();
- List<BundleWiringDTO> dtos = new ArrayList<BundleWiringDTO>(size);
+ List<BundleWiringDTO> dtos = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
BundleWiring wiring = revs.get(i).getWiring();
if (wiring != null) {
@@ -367,7 +367,7 @@ public class DTOBuilder {
return null;
}
final int length = references.length;
- List<ServiceReferenceDTO> refDTOs = new ArrayList<ServiceReferenceDTO>(length);
+ List<ServiceReferenceDTO> refDTOs = new ArrayList<>(length);
for (int i = 0; i < length; i++) {
ServiceReferenceDTO dto = getServiceReferenceDTO(references[i]);
if (dto != null) {
@@ -378,12 +378,7 @@ public class DTOBuilder {
}
private static Object mapValue(Object v) {
- if ((v == null)
- || v instanceof Number
- || v instanceof Boolean
- || v instanceof Character
- || v instanceof String
- || v instanceof DTO) {
+ if ((v == null) || v instanceof Number || v instanceof Boolean || v instanceof Character || v instanceof String || v instanceof DTO) {
return v;
}
if (v instanceof Map) {
@@ -423,14 +418,7 @@ public class DTOBuilder {
}
private static Class<?> mapComponentType(Class<?> componentType) {
- if (componentType.isPrimitive()
- || componentType.isArray()
- || Object.class.equals(componentType)
- || Number.class.isAssignableFrom(componentType)
- || Boolean.class.isAssignableFrom(componentType)
- || Character.class.isAssignableFrom(componentType)
- || String.class.isAssignableFrom(componentType)
- || DTO.class.isAssignableFrom(componentType)) {
+ if (componentType.isPrimitive() || componentType.isArray() || Object.class.equals(componentType) || Number.class.isAssignableFrom(componentType) || Boolean.class.isAssignableFrom(componentType) || Character.class.isAssignableFrom(componentType) || String.class.isAssignableFrom(componentType) || DTO.class.isAssignableFrom(componentType)) {
return componentType;
}
if (Map.class.isAssignableFrom(componentType)) {
@@ -446,22 +434,22 @@ public class DTOBuilder {
}
private static <E> List<E> newList(int size) {
- return new ArrayList<E>(size);
+ return new ArrayList<>(size);
}
private static <E> Set<E> newSet(int size) {
- return new HashSet<E>(size);
+ return new HashSet<>(size);
}
private static <K, V> Map<K, V> newMap(int size) {
- return new HashMap<K, V>(size);
+ return new HashMap<>(size);
}
/**
* Assumes the input map is always <String,String>.
*/
private static Map<String, String> newDirectivesMapDTO(Map<String, String> map) {
- Map<String, String> dto = new HashMap<String, String>(map);
+ Map<String, String> dto = new HashMap<>(map);
return dto;
}
@@ -471,7 +459,7 @@ public class DTOBuilder {
* and Version objects are converted to String objects.
*/
private static Map<String, Object> newAttributesMapDTO(Map<String, Object> map) {
- Map<String, Object> dto = new HashMap<String, Object>(map);
+ Map<String, Object> dto = new HashMap<>(map);
/* Lists are copied and Version objects are converted to String objects. */
for (Map.Entry<String, Object> entry : dto.entrySet()) {
Object value = entry.getValue();
@@ -480,7 +468,7 @@ public class DTOBuilder {
continue;
}
if (value instanceof List) {
- List<Object> newList = new ArrayList<Object>((List<?>) value);
+ List<Object> newList = new ArrayList<>((List<?>) value);
for (ListIterator<Object> iter = newList.listIterator(); iter.hasNext();) {
Object element = iter.next();
if (element instanceof Version) {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java
index 7aa5a6c57..75dc1a3d6 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java
@@ -113,7 +113,7 @@ public class EquinoxBundle implements Bundle, BundleReference {
}
- final List<FrameworkListener> initListeners = new ArrayList<FrameworkListener>(0);
+ final List<FrameworkListener> initListeners = new ArrayList<>(0);
class EquinoxSystemModule extends SystemModule {
public EquinoxSystemModule(ModuleContainer container) {
@@ -387,7 +387,7 @@ public class EquinoxBundle implements Bundle, BundleReference {
if (options == 0) {
return new StartOptions[0];
}
- Collection<StartOptions> result = new ArrayList<Module.StartOptions>(2);
+ Collection<StartOptions> result = new ArrayList<>(2);
if ((options & Bundle.START_TRANSIENT) != 0) {
result.add(StartOptions.TRANSIENT);
}
@@ -706,14 +706,14 @@ public class EquinoxBundle implements Bundle, BundleReference {
}
if (infos.length == 0)
return Collections.emptyMap();
- Map<X509Certificate, List<X509Certificate>> results = new HashMap<X509Certificate, List<X509Certificate>>(infos.length);
+ Map<X509Certificate, List<X509Certificate>> results = new HashMap<>(infos.length);
for (int i = 0; i < infos.length; i++) {
if (signersType == SIGNERS_TRUSTED && !infos[i].isTrusted())
continue;
Certificate[] certs = infos[i].getCertificateChain();
if (certs == null || certs.length == 0)
continue;
- List<X509Certificate> certChain = new ArrayList<X509Certificate>();
+ List<X509Certificate> certChain = new ArrayList<>();
for (int j = 0; j < certs.length; j++)
certChain.add((X509Certificate) certs[j]);
results.put((X509Certificate) certs[0], certChain);
@@ -961,7 +961,7 @@ public class EquinoxBundle implements Bundle, BundleReference {
}
List<Generation> getGenerations() {
- List<Generation> result = new ArrayList<Generation>();
+ List<Generation> result = new ArrayList<>();
ModuleRevision current = getModule().getCurrentRevision();
result.add((Generation) current.getRevisionInfo());
ModuleWiring wiring = current.getWiring();
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java
index 619a1c0e6..bf22b309e 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxConfiguration.java
@@ -228,7 +228,7 @@ public class EquinoxConfiguration implements EnvironmentInfo {
private final Properties localConfig;
public ConfigValues(Map<String, ?> initialConfiguration) {
- this.initialConfig = initialConfiguration == null ? new HashMap<String, Object>(0) : new HashMap<String, Object>(initialConfiguration);
+ this.initialConfig = initialConfiguration == null ? new HashMap<String, Object>(0) : new HashMap<>(initialConfiguration);
Object useSystemPropsValue = initialConfig.get(PROP_USE_SYSTEM_PROPERTIES);
this.useSystemProperties = useSystemPropsValue == null ? false : Boolean.parseBoolean(useSystemPropsValue.toString());
Properties tempConfiguration = useSystemProperties ? EquinoxContainer.secureAction.getProperties() : new Properties();
@@ -470,7 +470,7 @@ public class EquinoxConfiguration implements EnvironmentInfo {
Properties props = useSystemProperties ? EquinoxContainer.secureAction.getProperties() : localConfig;
// must sync on props to avoid concurrent modification exception
synchronized (props) {
- Map<String, String> result = new HashMap<String, String>(props.size());
+ Map<String, String> result = new HashMap<>(props.size());
for (Object key : props.keySet()) {
if (key instanceof String) {
String skey = (String) key;
@@ -603,7 +603,7 @@ public class EquinoxConfiguration implements EnvironmentInfo {
}
private static List<String> buildEclipseLibraryVariants(String ws, String os, String arch, String nl) {
- List<String> result = new ArrayList<String>();
+ List<String> result = new ArrayList<>();
result.add("ws/" + ws + "/"); //$NON-NLS-1$ //$NON-NLS-2$
result.add("os/" + os + "/" + arch + "/"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
result.add("os/" + os + "/"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -618,7 +618,7 @@ public class EquinoxConfiguration implements EnvironmentInfo {
}
private static List<String> buildNLJarVariants(String nl) {
- List<String> result = new ArrayList<String>();
+ List<String> result = new ArrayList<>();
nl = nl.replace('_', '/');
while (nl.length() > 0) {
result.add("nl/" + nl + "/"); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java
index 87011f38b..5f42a20bc 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java
@@ -78,8 +78,8 @@ public class EquinoxContainer implements ThreadFactory, Runnable {
// TODO ideally this should be in equinox configuration or perhaps in storage
String bootDelegationProp = equinoxConfig.getConfiguration(Constants.FRAMEWORK_BOOTDELEGATION);
String[] bootPackages = ManifestElement.getArrayFromList(bootDelegationProp, ","); //$NON-NLS-1$
- HashSet<String> exactMatch = new HashSet<String>(bootPackages.length);
- List<String> stemMatch = new ArrayList<String>(bootPackages.length);
+ HashSet<String> exactMatch = new HashSet<>(bootPackages.length);
+ List<String> stemMatch = new ArrayList<>(bootPackages.length);
boolean delegateAllValue = false;
for (int i = 0; i < bootPackages.length; i++) {
if (bootPackages[i].equals("*")) { //$NON-NLS-1$
@@ -243,7 +243,7 @@ public class EquinoxContainer implements ThreadFactory, Runnable {
void systemStart(BundleContext bc) {
synchronized (this.monitor) {
- signedContentFactory = new ServiceTracker<SignedContentFactory, SignedContentFactory>(bc, SignedContentFactory.class, null);
+ signedContentFactory = new ServiceTracker<>(bc, SignedContentFactory.class, null);
}
signedContentFactory.open();
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainerAdaptor.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainerAdaptor.java
index 84c8cbd42..560392b4b 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainerAdaptor.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainerAdaptor.java
@@ -38,7 +38,7 @@ public class EquinoxContainerAdaptor extends ModuleContainerAdaptor {
private final ClassLoader moduleClassLoaderParent;
private final AtomicLong lastSecurityAdminFlush;
- final AtomicLazyInitializer<Executor> executor = new AtomicLazyInitializer<Executor>();
+ final AtomicLazyInitializer<Executor> executor = new AtomicLazyInitializer<>();
final Callable<Executor> lazyExecutorCreator;
public EquinoxContainerAdaptor(EquinoxContainer container, Storage storage, Map<Long, Generation> initial) {
@@ -77,7 +77,7 @@ public class EquinoxContainerAdaptor extends ModuleContainerAdaptor {
// idle timeout; make it short to get rid of threads quickly after resolve
int idleTimeout = 10;
// use sync queue to force thread creation
- BlockingQueue<Runnable> queue = new SynchronousQueue<Runnable>();
+ BlockingQueue<Runnable> queue = new SynchronousQueue<>();
// try to name the threads with useful name
ThreadFactory threadFactory = new ThreadFactory() {
@Override
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxEventPublisher.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxEventPublisher.java
index 203197461..232c8de0c 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxEventPublisher.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxEventPublisher.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 IBM Corporation and others.
+ * Copyright (c) 2012, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -45,13 +45,13 @@ public class EquinoxEventPublisher {
* installed in the Framework.
*/
// Map of BundleContexts for bundle's BundleListeners.
- private final Map<BundleContextImpl, CopyOnWriteIdentityMap<BundleListener, BundleListener>> allBundleListeners = new HashMap<BundleContextImpl, CopyOnWriteIdentityMap<BundleListener, BundleListener>>();
+ private final Map<BundleContextImpl, CopyOnWriteIdentityMap<BundleListener, BundleListener>> allBundleListeners = new HashMap<>();
// Map of BundleContexts for bundle's SynchronousBundleListeners.
- private final Map<BundleContextImpl, CopyOnWriteIdentityMap<SynchronousBundleListener, SynchronousBundleListener>> allSyncBundleListeners = new HashMap<BundleContextImpl, CopyOnWriteIdentityMap<SynchronousBundleListener, SynchronousBundleListener>>();
+ private final Map<BundleContextImpl, CopyOnWriteIdentityMap<SynchronousBundleListener, SynchronousBundleListener>> allSyncBundleListeners = new HashMap<>();
// Map of BundleContexts for bundle's FrameworkListeners.
- private final Map<BundleContextImpl, CopyOnWriteIdentityMap<FrameworkListener, FrameworkListener>> allFrameworkListeners = new HashMap<BundleContextImpl, CopyOnWriteIdentityMap<FrameworkListener, FrameworkListener>>();
+ private final Map<BundleContextImpl, CopyOnWriteIdentityMap<FrameworkListener, FrameworkListener>> allFrameworkListeners = new HashMap<>();
public EquinoxEventPublisher(EquinoxContainer container) {
this.container = container;
@@ -86,7 +86,7 @@ public class EquinoxEventPublisher {
public <K, V, E> ListenerQueue<K, V, E> newListenerQueue() {
synchronized (this.monitor) {
- return new ListenerQueue<K, V, E>(eventManager);
+ return new ListenerQueue<>(eventManager);
}
}
@@ -142,7 +142,7 @@ public class EquinoxEventPublisher {
BundleContextImpl systemContext = null;
Set<Map.Entry<SynchronousBundleListener, SynchronousBundleListener>> systemBundleListenersSync = null;
synchronized (allSyncBundleListeners) {
- listenersSync = new HashMap<BundleContextImpl, Set<Map.Entry<SynchronousBundleListener, SynchronousBundleListener>>>(allSyncBundleListeners.size());
+ listenersSync = new HashMap<>(allSyncBundleListeners.size());
for (Map.Entry<BundleContextImpl, CopyOnWriteIdentityMap<SynchronousBundleListener, SynchronousBundleListener>> entry : allSyncBundleListeners.entrySet()) {
CopyOnWriteIdentityMap<SynchronousBundleListener, SynchronousBundleListener> listeners = entry.getValue();
if (!listeners.isEmpty()) {
@@ -162,7 +162,7 @@ public class EquinoxEventPublisher {
Set<Map.Entry<BundleListener, BundleListener>> systemBundleListenersAsync = null;
if ((event.getType() & (BundleEvent.STARTING | BundleEvent.STOPPING | BundleEvent.LAZY_ACTIVATION)) == 0) {
synchronized (allBundleListeners) {
- listenersAsync = new HashMap<BundleContextImpl, Set<Map.Entry<BundleListener, BundleListener>>>(allBundleListeners.size());
+ listenersAsync = new HashMap<>(allBundleListeners.size());
for (Map.Entry<BundleContextImpl, CopyOnWriteIdentityMap<BundleListener, BundleListener>> entry : allBundleListeners.entrySet()) {
CopyOnWriteIdentityMap<BundleListener, BundleListener> listeners = entry.getValue();
if (!listeners.isEmpty()) {
@@ -188,7 +188,7 @@ public class EquinoxEventPublisher {
if (listenersAsync == null) {
shrinkable = asBundleContexts(listenersSync.keySet());
} else {
- shrinkable = new ShrinkableCollection<BundleContext>(asBundleContexts(listenersSync.keySet()), asBundleContexts(listenersAsync.keySet()));
+ shrinkable = new ShrinkableCollection<>(asBundleContexts(listenersSync.keySet()), asBundleContexts(listenersAsync.keySet()));
}
notifyEventHooksPrivileged(event, shrinkable);
@@ -288,7 +288,7 @@ public class EquinoxEventPublisher {
// Build the listener snapshot
Map<BundleContextImpl, Set<Map.Entry<FrameworkListener, FrameworkListener>>> listenerSnapshot;
synchronized (allFrameworkListeners) {
- listenerSnapshot = new HashMap<BundleContextImpl, Set<Map.Entry<FrameworkListener, FrameworkListener>>>(allFrameworkListeners.size());
+ listenerSnapshot = new HashMap<>(allFrameworkListeners.size());
for (Map.Entry<BundleContextImpl, CopyOnWriteIdentityMap<FrameworkListener, FrameworkListener>> entry : allFrameworkListeners.entrySet()) {
CopyOnWriteIdentityMap<FrameworkListener, FrameworkListener> listeners = entry.getValue();
if (!listeners.isEmpty()) {
@@ -303,7 +303,7 @@ public class EquinoxEventPublisher {
// add the listeners specified by the caller first
if (callerListeners != null && callerListeners.length > 0) {
- Map<FrameworkListener, FrameworkListener> listeners = new HashMap<FrameworkListener, FrameworkListener>();
+ Map<FrameworkListener, FrameworkListener> listeners = new HashMap<>();
for (FrameworkListener listener : callerListeners) {
if (listener != null)
listeners.put(listener, listener);
@@ -348,7 +348,7 @@ public class EquinoxEventPublisher {
synchronized (allSyncBundleListeners) {
CopyOnWriteIdentityMap<SynchronousBundleListener, SynchronousBundleListener> listeners = allSyncBundleListeners.get(context);
if (listeners == null) {
- listeners = new CopyOnWriteIdentityMap<SynchronousBundleListener, SynchronousBundleListener>();
+ listeners = new CopyOnWriteIdentityMap<>();
allSyncBundleListeners.put(context, listeners);
}
listeners.put((SynchronousBundleListener) listener, (SynchronousBundleListener) listener);
@@ -357,7 +357,7 @@ public class EquinoxEventPublisher {
synchronized (allBundleListeners) {
CopyOnWriteIdentityMap<BundleListener, BundleListener> listeners = allBundleListeners.get(context);
if (listeners == null) {
- listeners = new CopyOnWriteIdentityMap<BundleListener, BundleListener>();
+ listeners = new CopyOnWriteIdentityMap<>();
allBundleListeners.put(context, listeners);
}
listeners.put(listener, listener);
@@ -386,7 +386,7 @@ public class EquinoxEventPublisher {
synchronized (allFrameworkListeners) {
CopyOnWriteIdentityMap<FrameworkListener, FrameworkListener> listeners = allFrameworkListeners.get(context);
if (listeners == null) {
- listeners = new CopyOnWriteIdentityMap<FrameworkListener, FrameworkListener>();
+ listeners = new CopyOnWriteIdentityMap<>();
allFrameworkListeners.put(context, listeners);
}
listeners.put(listener, listener);
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/FilterImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/FilterImpl.java
index 35846321c..7a2f5a1e0 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/FilterImpl.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/FilterImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2014 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -180,7 +180,7 @@ public class FilterImpl implements Filter /* since Framework 1.1 */ {
*/
public boolean match(Dictionary<String, ?> dictionary) {
if (dictionary != null) {
- dictionary = new Headers<String, Object>(dictionary);
+ dictionary = new Headers<>(dictionary);
}
return matchCase(dictionary);
@@ -1406,7 +1406,7 @@ public class FilterImpl implements Filter /* since Framework 1.1 */ {
public List<FilterImpl> getChildren() {
if (value instanceof FilterImpl[]) {
- return new ArrayList<FilterImpl>(Arrays.asList((FilterImpl[]) value));
+ return new ArrayList<>(Arrays.asList((FilterImpl[]) value));
}
return Collections.emptyList();
}
@@ -1416,7 +1416,7 @@ public class FilterImpl implements Filter /* since Framework 1.1 */ {
* @return all the attributes contained within this filter
*/
public String[] getAttributes() {
- List<String> results = new ArrayList<String>();
+ List<String> results = new ArrayList<>();
getAttributesInternal(results);
return results.toArray(new String[results.size()]);
}
@@ -1525,7 +1525,7 @@ public class FilterImpl implements Filter /* since Framework 1.1 */ {
return parse_item();
}
- List<FilterImpl> operands = new ArrayList<FilterImpl>(10);
+ List<FilterImpl> operands = new ArrayList<>(10);
while (filterChars[pos] == '(') {
FilterImpl child = parse_filter();
@@ -1544,7 +1544,7 @@ public class FilterImpl implements Filter /* since Framework 1.1 */ {
return parse_item();
}
- List<FilterImpl> operands = new ArrayList<FilterImpl>(10);
+ List<FilterImpl> operands = new ArrayList<>(10);
while (filterChars[pos] == '(') {
FilterImpl child = parse_filter();
@@ -1685,7 +1685,7 @@ public class FilterImpl implements Filter /* since Framework 1.1 */ {
private Object parse_substring() throws InvalidSyntaxException {
StringBuffer sb = new StringBuffer(filterChars.length - pos);
- List<String> operands = new ArrayList<String>(10);
+ List<String> operands = new ArrayList<>(10);
parseloop: while (true) {
char c = filterChars[pos];
@@ -1818,7 +1818,7 @@ public class FilterImpl implements Filter /* since Framework 1.1 */ {
private Version leftVersion;
private Version rightVersion;
private char rightRule = 0;
- private Collection<Version> excludes = new ArrayList<Version>(0);
+ private Collection<Version> excludes = new ArrayList<>(0);
public String toString() {
if (rightVersion == null) {
@@ -1853,8 +1853,8 @@ public class FilterImpl implements Filter /* since Framework 1.1 */ {
public Map<String, String> getStandardOSGiAttributes(String... versions) {
if (op != AND && op != EQUAL && op != SUBSTRING && op != PRESENT)
throw new IllegalArgumentException("Invalid filter for Starndard OSGi Attributes: " + op); //$NON-NLS-1$
- Map<String, String> result = new HashMap<String, String>();
- Map<String, Range> versionAttrs = new HashMap<String, Range>();
+ Map<String, String> result = new HashMap<>();
+ Map<String, Range> versionAttrs = new HashMap<>();
if (versions != null) {
for (String versionAttr : versions) {
versionAttrs.put(versionAttr, null);
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/OSGiFrameworkHooks.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/OSGiFrameworkHooks.java
index ad5439650..464e9dc20 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/OSGiFrameworkHooks.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/OSGiFrameworkHooks.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 IBM Corporation and others.
+ * Copyright (c) 2012, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -67,7 +67,7 @@ class OSGiFrameworkHooks {
}
case EquinoxConfiguration.BSN_VERSION_MANAGED : {
Bundle targetBundle = target.getBundle();
- ArrayMap<Bundle, Module> candidateBundles = new ArrayMap<Bundle, Module>(collisionCandidates.size());
+ ArrayMap<Bundle, Module> candidateBundles = new ArrayMap<>(collisionCandidates.size());
for (Module module : collisionCandidates) {
candidateBundles.put(module.getBundle(), module);
}
@@ -82,7 +82,7 @@ class OSGiFrameworkHooks {
private void notifyCollisionHooks(final int operationType, final Bundle target, Collection<Bundle> collisionCandidates) {
// Note that collision hook results are honored for the system bundle.
- final Collection<Bundle> shrinkable = new ShrinkableCollection<Bundle>(collisionCandidates);
+ final Collection<Bundle> shrinkable = new ShrinkableCollection<>(collisionCandidates);
if (System.getSecurityManager() == null) {
notifyCollisionHooksPriviledged(operationType, target, shrinkable);
} else {
@@ -250,7 +250,7 @@ class OSGiFrameworkHooks {
}
if (hooks.isEmpty())
return;
- candidates = new ShrinkableCollection<BundleRevision>(candidates);
+ candidates = new ShrinkableCollection<>(candidates);
for (Iterator<HookReference> iHooks = hooks.iterator(); iHooks.hasNext();) {
HookReference hookRef = iHooks.next();
if (hookRef.reference.getBundle() == null) {
@@ -275,7 +275,7 @@ class OSGiFrameworkHooks {
}
if (hooks.isEmpty())
return;
- collisionCandidates = new ShrinkableCollection<BundleCapability>(collisionCandidates);
+ collisionCandidates = new ShrinkableCollection<>(collisionCandidates);
for (Iterator<HookReference> iHooks = hooks.iterator(); iHooks.hasNext();) {
HookReference hookRef = iHooks.next();
if (hookRef.reference.getBundle() == null) {
@@ -296,7 +296,7 @@ class OSGiFrameworkHooks {
}
if (hooks.isEmpty())
return;
- candidates = new ShrinkableCollection<BundleCapability>(candidates);
+ candidates = new ShrinkableCollection<>(candidates);
for (Iterator<HookReference> iHooks = hooks.iterator(); iHooks.hasNext();) {
HookReference hookRef = iHooks.next();
if (hookRef.reference.getBundle() == null) {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/SystemBundleActivator.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/SystemBundleActivator.java
index 1c61c3188..c868f7dd8 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/SystemBundleActivator.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/SystemBundleActivator.java
@@ -42,7 +42,7 @@ import org.osgi.service.startlevel.StartLevel;
public class SystemBundleActivator implements BundleActivator {
private EquinoxFactoryManager urlFactoryManager;
- private List<ServiceRegistration<?>> registrations = new ArrayList<ServiceRegistration<?>>(10);
+ private List<ServiceRegistration<?>> registrations = new ArrayList<>(10);
private SecurityManager setSecurityManagner;
@SuppressWarnings("deprecation")
@@ -73,7 +73,7 @@ public class SystemBundleActivator implements BundleActivator {
register(bc, PermissionAdmin.class, sa, null);
register(bc, ConditionalPermissionAdmin.class, sa, null);
- Hashtable<String, Object> props = new Hashtable<String, Object>(7);
+ Hashtable<String, Object> props = new Hashtable<>(7);
props.clear();
props.put(Constants.SERVICE_RANKING, Integer.MIN_VALUE);
register(bc, Resolver.class, new ResolverImpl(new Logger(0), null), false, props);
@@ -152,7 +152,7 @@ public class SystemBundleActivator implements BundleActivator {
}
private void registerLocations(BundleContext bc, EquinoxLocations equinoxLocations) {
- Dictionary<String, Object> locationProperties = new Hashtable<String, Object>(1);
+ Dictionary<String, Object> locationProperties = new Hashtable<>(1);
Location location = equinoxLocations.getUserLocation();
if (location != null) {
locationProperties.put("type", EquinoxLocations.PROP_USER_AREA); //$NON-NLS-1$
@@ -216,7 +216,7 @@ public class SystemBundleActivator implements BundleActivator {
private void register(BundleContext context, String serviceClass, Object service, boolean setRanking, Dictionary<String, Object> properties) {
if (properties == null)
- properties = new Hashtable<String, Object>(7);
+ properties = new Hashtable<>(7);
Dictionary<String, String> headers = context.getBundle().getHeaders();
properties.put(Constants.SERVICE_VENDOR, headers.get(Constants.BUNDLE_VENDOR));
if (setRanking) {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/legacy/PackageAdminImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/legacy/PackageAdminImpl.java
index 04d573372..03808ba23 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/legacy/PackageAdminImpl.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/legacy/PackageAdminImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2014 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -69,7 +69,7 @@ public class PackageAdminImpl implements PackageAdmin {
Module module = StartLevelImpl.getModule(bundle);
Collection<ModuleRevision> revisions = module == null ? Collections.<ModuleRevision> emptyList() : module.getRevisions().getModuleRevisions();
- Collection<ExportedPackage> allExports = new ArrayList<ExportedPackage>();
+ Collection<ExportedPackage> allExports = new ArrayList<>();
for (ModuleRevision revision : revisions) {
ModuleWiring wiring = revision.getWiring();
if (wiring != null) {
@@ -111,7 +111,7 @@ public class PackageAdminImpl implements PackageAdmin {
Requirement packageReq = ModuleContainer.createRequirement(PackageNamespace.PACKAGE_NAMESPACE, directives, attributes);
Collection<BundleCapability> packageCaps = container.getFrameworkWiring().findProviders(packageReq);
InternalUtils.filterCapabilityPermissions(packageCaps);
- List<ExportedPackage> result = new ArrayList<ExportedPackage>();
+ List<ExportedPackage> result = new ArrayList<>();
for (BundleCapability capability : packageCaps) {
ModuleWiring wiring = (ModuleWiring) capability.getRevision().getWiring();
if (wiring != null) {
@@ -120,7 +120,7 @@ public class PackageAdminImpl implements PackageAdmin {
// This is a fragment, just get all the host wirings
List<ModuleWire> hostWires = wiring.getRequiredModuleWires(HostNamespace.HOST_NAMESPACE);
if (hostWires != null && !hostWires.isEmpty()) {
- wirings = new ArrayList<ModuleWiring>(hostWires.size());
+ wirings = new ArrayList<>(hostWires.size());
for (ModuleWire hostWire : hostWires) {
ModuleWiring hostWiring = hostWire.getProviderWiring();
if (hostWiring != null) {
@@ -157,7 +157,7 @@ public class PackageAdminImpl implements PackageAdmin {
Requirement bundleReq = ModuleContainer.createRequirement(BundleNamespace.BUNDLE_NAMESPACE, directives, attributes);
Collection<BundleCapability> bundleCaps = container.getFrameworkWiring().findProviders(bundleReq);
InternalUtils.filterCapabilityPermissions(bundleCaps);
- Collection<RequiredBundle> result = new ArrayList<RequiredBundle>();
+ Collection<RequiredBundle> result = new ArrayList<>();
for (BundleCapability capability : bundleCaps) {
BundleWiring wiring = capability.getRevision().getWiring();
if (wiring != null) {
@@ -183,7 +183,7 @@ public class PackageAdminImpl implements PackageAdmin {
if (identityCaps.isEmpty()) {
return null;
}
- List<Bundle> sorted = new ArrayList<Bundle>(identityCaps.size());
+ List<Bundle> sorted = new ArrayList<>(identityCaps.size());
for (BundleCapability capability : identityCaps) {
Bundle b = capability.getRevision().getBundle();
// a sanity check incase this is an old revision
@@ -215,7 +215,7 @@ public class PackageAdminImpl implements PackageAdmin {
// we don't hold locks while checking the graph, just return if no longer valid
return null;
}
- Collection<Bundle> fragments = new ArrayList<Bundle>(hostWires.size());
+ Collection<Bundle> fragments = new ArrayList<>(hostWires.size());
for (ModuleWire wire : hostWires) {
Bundle fragment = wire.getRequirer().getBundle();
if (fragment != null) {
@@ -235,7 +235,7 @@ public class PackageAdminImpl implements PackageAdmin {
// we don't hold locks while checking the graph, just return if no longer valid
return null;
}
- Collection<Bundle> hosts = new ArrayList<Bundle>(hostWires.size());
+ Collection<Bundle> hosts = new ArrayList<>(hostWires.size());
for (ModuleWire wire : hostWires) {
Bundle host = wire.getProvider().getBundle();
if (host != null) {
@@ -320,7 +320,7 @@ public class PackageAdminImpl implements PackageAdmin {
if (!providerWiring.isInUse()) {
return null;
}
- Set<Bundle> importing = new HashSet<Bundle>();
+ Set<Bundle> importing = new HashSet<>();
String packageName = getName();
addRequirers(importing, providerWiring, packageName);
@@ -424,7 +424,7 @@ public class PackageAdminImpl implements PackageAdmin {
if (!providerWiring.isInUse()) {
return null;
}
- Set<Bundle> requiring = new HashSet<Bundle>();
+ Set<Bundle> requiring = new HashSet<>();
addRequirers(requiring, providerWiring);
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hookregistry/HookRegistry.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hookregistry/HookRegistry.java
index 19354f7a1..f9d881dd4 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hookregistry/HookRegistry.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hookregistry/HookRegistry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2013 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -69,13 +69,13 @@ public final class HookRegistry {
private final EquinoxContainer container;
private volatile boolean initialized = false;
- private final List<ClassLoaderHook> classLoaderHooks = new ArrayList<ClassLoaderHook>();
+ private final List<ClassLoaderHook> classLoaderHooks = new ArrayList<>();
private final List<ClassLoaderHook> classLoaderHooksRO = Collections.unmodifiableList(classLoaderHooks);
- private final List<StorageHookFactory<?, ?, ?>> storageHookFactories = new ArrayList<StorageHookFactory<?, ?, ?>>();
+ private final List<StorageHookFactory<?, ?, ?>> storageHookFactories = new ArrayList<>();
private final List<StorageHookFactory<?, ?, ?>> storageHookFactoriesRO = Collections.unmodifiableList(storageHookFactories);
- private final List<BundleFileWrapperFactoryHook> bundleFileWrapperFactoryHooks = new ArrayList<BundleFileWrapperFactoryHook>();
+ private final List<BundleFileWrapperFactoryHook> bundleFileWrapperFactoryHooks = new ArrayList<>();
private final List<BundleFileWrapperFactoryHook> bundleFileWrapperFactoryHooksRO = Collections.unmodifiableList(bundleFileWrapperFactoryHooks);
- private final List<ActivatorHookFactory> activatorHookFactories = new ArrayList<ActivatorHookFactory>();
+ private final List<ActivatorHookFactory> activatorHookFactories = new ArrayList<>();
private final List<ActivatorHookFactory> activatorHookFactoriesRO = Collections.unmodifiableList(activatorHookFactories);
public HookRegistry(EquinoxContainer container) {
@@ -94,8 +94,8 @@ public final class HookRegistry {
* 5. Set this HookRegistry object to read only to prevent any other hooks from being added. <p>
*/
public void initialize() {
- List<String> configurators = new ArrayList<String>(5);
- List<FrameworkLogEntry> errors = new ArrayList<FrameworkLogEntry>(0); // optimistic that no errors will occur
+ List<String> configurators = new ArrayList<>(5);
+ List<FrameworkLogEntry> errors = new ArrayList<>(0); // optimistic that no errors will occur
mergeFileHookConfigurators(configurators, errors);
mergePropertyHookConfigurators(configurators);
synchronized (this) {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hooks/EclipseLazyStarter.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hooks/EclipseLazyStarter.java
index db636e962..7312f8fc0 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hooks/EclipseLazyStarter.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hooks/EclipseLazyStarter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2014 IBM Corporation and others.
+ * Copyright (c) 2006, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,9 +31,9 @@ public class EclipseLazyStarter extends ClassLoaderHook {
private static final SecureAction secureAction = AccessController.doPrivileged(SecureAction.createSecureAction());
// holds the initiating class name
- private final ThreadLocal<String> initiatingClassName = new ThreadLocal<String>();
+ private final ThreadLocal<String> initiatingClassName = new ThreadLocal<>();
// holds the ClasspathManagers that need to be activated
- private final ThreadLocal<Deque<ClasspathManager>> activationStack = new ThreadLocal<Deque<ClasspathManager>>();
+ private final ThreadLocal<Deque<ClasspathManager>> activationStack = new ThreadLocal<>();
// used to store exceptions that occurred while activating a bundle
// keyed by ClasspathManager->Exception
// WeakHashMap is used to prevent pinning the ClasspathManager objects.
@@ -61,7 +61,7 @@ public class EclipseLazyStarter extends ClassLoaderHook {
return;
Deque<ClasspathManager> stack = activationStack.get();
if (stack == null) {
- stack = new ArrayDeque<ClasspathManager>(6);
+ stack = new ArrayDeque<>(6);
activationStack.set(stack);
}
// each element is a classpath manager that must be activated after
@@ -82,7 +82,7 @@ public class EclipseLazyStarter extends ClassLoaderHook {
return;
// if we have a stack we must clear it even if (clazz == null)
- List<ClasspathManager> managers = new ArrayList<ClasspathManager>(stack);
+ List<ClasspathManager> managers = new ArrayList<>(stack);
stack.clear();
if (clazz == null)
return;
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java
index d3baf0273..0652ba7a9 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java
@@ -95,7 +95,7 @@ public class BundleLoader extends ModuleLoader {
/* If not null, list of package names to import dynamically. */
private String[] dynamicImportPackages;
- private final AtomicReference<ModuleClassLoader> classloader = new AtomicReference<ModuleClassLoader>();
+ private final AtomicReference<ModuleClassLoader> classloader = new AtomicReference<>();
private final ClassLoader parent;
private final AtomicBoolean triggerClassLoaded = new AtomicBoolean(false);
@@ -208,7 +208,7 @@ public class BundleLoader extends ModuleLoader {
private static PackageSource createMultiSource(String packageName, PackageSource[] sources) {
if (sources.length == 1)
return sources[0];
- List<SingleSourcePackage> sourceList = new ArrayList<SingleSourcePackage>(sources.length);
+ List<SingleSourcePackage> sourceList = new ArrayList<>(sources.length);
for (int i = 0; i < sources.length; i++) {
SingleSourcePackage[] innerSources = sources[i].getSuppliers();
for (int j = 0; j < innerSources.length; j++)
@@ -732,7 +732,7 @@ public class BundleLoader extends ModuleLoader {
if ((path.length() > 1) && (path.charAt(0) == '/')) /* if name has a leading slash */
path = path.substring(1); /* remove leading slash before search */
boolean subPackages = (options & BundleWiring.LISTRESOURCES_RECURSE) != 0;
- List<String> packages = new ArrayList<String>();
+ List<String> packages = new ArrayList<>();
// search imported package names
KeyedHashSet importSources = getImportedSources(null);
KeyedElement[] imports;
@@ -746,7 +746,7 @@ public class BundleLoader extends ModuleLoader {
}
// now add package names from required bundles
- Collection<BundleLoader> visited = new ArrayList<BundleLoader>();
+ Collection<BundleLoader> visited = new ArrayList<>();
visited.add(this); // always add ourselves so we do not recurse back to ourselves
for (ModuleWire bundleWire : requiredBundleWires) {
BundleLoader loader = (BundleLoader) bundleWire.getProviderWiring().getModuleLoader();
@@ -758,8 +758,8 @@ public class BundleLoader extends ModuleLoader {
boolean localSearch = (options & BundleWiring.LISTRESOURCES_LOCAL) != 0;
// Use LinkedHashSet for optimized performance of contains() plus
// ordering guarantees.
- LinkedHashSet<String> result = new LinkedHashSet<String>();
- Set<String> importedPackages = new HashSet<String>(0);
+ LinkedHashSet<String> result = new LinkedHashSet<>();
+ Set<String> importedPackages = new HashSet<>(0);
for (String name : packages) {
// look for import source
PackageSource externalSource = findImportedSource(name, null);
@@ -801,7 +801,7 @@ public class BundleLoader extends ModuleLoader {
return list1 == null ? BundleLoader.<E> emptyEnumeration() : list1;
if (list1 == null || !list1.hasMoreElements())
return list2 == null ? BundleLoader.<E> emptyEnumeration() : list2;
- List<E> compoundResults = new ArrayList<E>();
+ List<E> compoundResults = new ArrayList<>();
while (list1.hasMoreElements())
compoundResults.add(list1.nextElement());
while (list2.hasMoreElements()) {
@@ -952,7 +952,7 @@ public class BundleLoader extends ModuleLoader {
if (packageImports == null || packageImports.isEmpty()) {
return;
}
- List<String> dynamicImports = new ArrayList<String>(packageImports.size());
+ List<String> dynamicImports = new ArrayList<>(packageImports.size());
for (ModuleRequirement packageImport : packageImports) {
if (PackageNamespace.RESOLUTION_DYNAMIC.equals(packageImport.getDirectives().get(PackageNamespace.REQUIREMENT_RESOLUTION_DIRECTIVE))) {
Matcher matcher = PACKAGENAME_FILTER.matcher(packageImport.getDirectives().get(PackageNamespace.REQUIREMENT_FILTER_DIRECTIVE));
@@ -983,9 +983,9 @@ public class BundleLoader extends ModuleLoader {
int size = packages.length;
List<String> stems;
if (dynamicImportPackageStems == null) {
- stems = new ArrayList<String>(size);
+ stems = new ArrayList<>(size);
} else {
- stems = new ArrayList<String>(size + dynamicImportPackageStems.length);
+ stems = new ArrayList<>(size + dynamicImportPackageStems.length);
for (int i = 0; i < dynamicImportPackageStems.length; i++) {
stems.add(dynamicImportPackageStems[i]);
}
@@ -993,9 +993,9 @@ public class BundleLoader extends ModuleLoader {
List<String> names;
if (dynamicImportPackages == null) {
- names = new ArrayList<String>(size);
+ names = new ArrayList<>(size);
} else {
- names = new ArrayList<String>(size + dynamicImportPackages.length);
+ names = new ArrayList<>(size + dynamicImportPackages.length);
for (int i = 0; i < dynamicImportPackages.length; i++) {
names.add(dynamicImportPackages[i]);
}
@@ -1036,7 +1036,7 @@ public class BundleLoader extends ModuleLoader {
public final void addDynamicImportPackage(ManifestElement[] packages) {
if (packages == null)
return;
- List<String> dynamicImports = new ArrayList<String>(packages.length);
+ List<String> dynamicImports = new ArrayList<>(packages.length);
StringBuilder importSpec = new StringBuilder();
for (ManifestElement dynamicImportElement : packages) {
String[] names = dynamicImportElement.getValueComponents();
@@ -1051,7 +1051,7 @@ public class BundleLoader extends ModuleLoader {
if (dynamicImports.size() > 0) {
addDynamicImportPackage(dynamicImports.toArray(new String[dynamicImports.size()]));
- Map<String, String> dynamicImportMap = new HashMap<String, String>();
+ Map<String, String> dynamicImportMap = new HashMap<>();
dynamicImportMap.put(Constants.DYNAMICIMPORT_PACKAGE, importSpec.toString());
try {
@@ -1132,10 +1132,10 @@ public class BundleLoader extends ModuleLoader {
return result.isNullSource() ? null : result;
}
if (visited == null)
- visited = new ArrayList<BundleLoader>();
+ visited = new ArrayList<>();
if (!visited.contains(this))
visited.add(this); // always add ourselves so we do not recurse back to ourselves
- List<PackageSource> result = new ArrayList<PackageSource>(3);
+ List<PackageSource> result = new ArrayList<>(3);
for (ModuleWire bundleWire : requiredBundleWires) {
BundleLoader loader = (BundleLoader) bundleWire.getProviderWiring().getModuleLoader();
if (loader != null) {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/ModuleClassLoader.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/ModuleClassLoader.java
index 1c81488f1..20a065bbe 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/ModuleClassLoader.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/ModuleClassLoader.java
@@ -91,7 +91,7 @@ public abstract class ModuleClassLoader extends ClassLoader implements BundleRef
}
}
- private final Map<String, Thread> classNameLocks = new HashMap<String, Thread>(5);
+ private final Map<String, Thread> classNameLocks = new HashMap<>(5);
private final Object pkgLock = new Object();
/**
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/buddy/DependentPolicy.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/buddy/DependentPolicy.java
index cd3d16020..0770945f1 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/buddy/DependentPolicy.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/buddy/DependentPolicy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2013 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -34,7 +34,7 @@ public class DependentPolicy implements IBuddyPolicy {
buddyRequester = requester;
//Initialize with the first level of dependent the list
- allDependents = new ArrayList<ModuleWiring>();
+ allDependents = new ArrayList<>();
basicAddImmediateDependents(requester.getWiring());
//If there is no dependent, reset to null
if (allDependents.size() == 0)
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/buddy/PolicyHandler.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/buddy/PolicyHandler.java
index c08e0ef97..d65e0e6d1 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/buddy/PolicyHandler.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/buddy/PolicyHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2013 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -42,14 +42,14 @@ public class PolicyHandler implements SynchronousBundleListener {
policedLoader = loader;
this.originalBuddyList = buddyList;
policies = buddyList.toArray();
- beingLoaded = new ThreadLocal<Set<String>>();
+ beingLoaded = new ThreadLocal<>();
this.packageAdmin = packageAdmin;
}
static Object[] getArrayFromList(String stringList) {
if (stringList == null || stringList.trim().equals("")) //$NON-NLS-1$
return null;
- List<Object> list = new ArrayList<Object>();
+ List<Object> list = new ArrayList<>();
StringTokenizer tokens = new StringTokenizer(stringList, ","); //$NON-NLS-1$
while (tokens.hasMoreTokens()) {
String token = tokens.nextToken().trim();
@@ -174,7 +174,7 @@ public class PolicyHandler implements SynchronousBundleListener {
Enumeration<URL> result = policy.loadResources(name);
if (result != null) {
if (results == null)
- results = new ArrayList<URL>(policyCount);
+ results = new ArrayList<>(policyCount);
while (result.hasMoreElements()) {
URL url = result.nextElement();
if (!results.contains(url)) //only add if not already added
@@ -192,7 +192,7 @@ public class PolicyHandler implements SynchronousBundleListener {
return false;
if (classesAndResources == null) {
- classesAndResources = new HashSet<String>(3);
+ classesAndResources = new HashSet<>(3);
beingLoaded.set(classesAndResources);
}
classesAndResources.add(name);
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/classpath/ClasspathEntry.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/classpath/ClasspathEntry.java
index 168b49154..fc6783104 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/classpath/ClasspathEntry.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/classpath/ClasspathEntry.java
@@ -89,7 +89,7 @@ public class ClasspathEntry {
if (name != null && name.endsWith("/")) { //$NON-NLS-1$
String packageName = name.substring(0, name.length() - 1).replace('/', '.');
if (result == null) {
- result = new HashMap<String, ManifestPackageAttributes>(4);
+ result = new HashMap<>(4);
}
result.put(packageName, manifestPackageAttributesFor(attributes, defaultAttributes));
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/classpath/ClasspathManager.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/classpath/ClasspathManager.java
index b41fcc1cd..8139ded11 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/classpath/ClasspathManager.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/classpath/ClasspathManager.java
@@ -63,7 +63,7 @@ public class ClasspathManager {
// a Map<String,String> where "libname" is the key and libpath" is the value
private ArrayMap<String, String> loadedLibraries = null;
// used to detect recusive defineClass calls for the same class on the same class loader (bug 345500)
- private ThreadLocal<Collection<String>> currentlyDefining = new ThreadLocal<Collection<String>>();
+ private ThreadLocal<Collection<String>> currentlyDefining = new ThreadLocal<>();
/**
* Constructs a classpath manager for the given generation and module class loader
@@ -97,7 +97,7 @@ public class ClasspathManager {
// we don't hold locks while checking the graph, just return if no longer valid
return emptyFragments;
}
- List<FragmentClasspath> result = new ArrayList<FragmentClasspath>(fragmentWires.size());
+ List<FragmentClasspath> result = new ArrayList<>(fragmentWires.size());
for (ModuleWire fragmentWire : fragmentWires) {
ModuleRevision revision = fragmentWire.getRequirer();
Generation fragGeneration = (Generation) revision.getRevisionInfo();
@@ -146,7 +146,7 @@ public class ClasspathManager {
}
private ClasspathEntry[] buildClasspath(String[] cp, ClasspathManager hostloader, Generation source) {
- ArrayList<ClasspathEntry> result = new ArrayList<ClasspathEntry>(cp.length);
+ ArrayList<ClasspathEntry> result = new ArrayList<>(cp.length);
// add the regular classpath entries.
for (int i = 0; i < cp.length; i++)
findClassPathEntry(result, cp[i], hostloader, source);
@@ -299,7 +299,7 @@ public class ClasspathManager {
}
public synchronized void loadFragments(Collection<ModuleRevision> addedFragments) {
- List<FragmentClasspath> result = new ArrayList<FragmentClasspath>(Arrays.asList(fragments));
+ List<FragmentClasspath> result = new ArrayList<>(Arrays.asList(fragments));
for (ModuleRevision addedFragment : addedFragments) {
Generation fragGeneration = (Generation) addedFragment.getRevisionInfo();
@@ -388,7 +388,7 @@ public class ClasspathManager {
* @return an enumeration of the the requested resources
*/
public Enumeration<URL> findLocalResources(String resource) {
- List<URL> resources = new ArrayList<URL>(6);
+ List<URL> resources = new ArrayList<>(6);
int classPathIndex = 0;
for (int i = 0; i < entries.length; i++) {
if (entries[i] != null) {
@@ -465,7 +465,7 @@ public class ClasspathManager {
* @return an enumeration of the the requested entries or null if the entries do not exist
*/
public Enumeration<BundleEntry> findLocalEntries(String path) {
- List<BundleEntry> objects = new ArrayList<BundleEntry>(6);
+ List<BundleEntry> objects = new ArrayList<>(6);
for (int i = 0; i < entries.length; i++) {
if (entries[i] != null) {
BundleEntry result = findEntryImpl(path, entries[i].getBundleFile());
@@ -576,7 +576,7 @@ public class ClasspathManager {
Collection<String> current = currentlyDefining.get();
if (current == null) {
- current = new ArrayList<String>(5);
+ current = new ArrayList<>(5);
currentlyDefining.set(current);
}
if (current.contains(name))
@@ -697,7 +697,7 @@ public class ClasspathManager {
public String findLibrary(String libname) {
synchronized (this) {
if (loadedLibraries == null)
- loadedLibraries = new ArrayMap<String, String>(1);
+ loadedLibraries = new ArrayMap<>(1);
}
synchronized (loadedLibraries) {
// we assume that each classloader will load a small number of of libraries
@@ -755,7 +755,7 @@ public class ClasspathManager {
* @see ModuleClassLoader#findEntries(String, String, int)
*/
public List<URL> findEntries(String path, String filePattern, int options) {
- List<Generation> generations = new ArrayList<Generation>();
+ List<Generation> generations = new ArrayList<>();
// first get the host bundle file
generations.add(generation);
// next get the attached fragments bundle files
@@ -768,7 +768,7 @@ public class ClasspathManager {
Enumeration<URL> eURLs = Storage.findEntries(generations, path, filePattern, options);
if (eURLs == null)
return result;
- result = new ArrayList<URL>();
+ result = new ArrayList<>();
while (eURLs.hasMoreElements())
result.add(eURLs.nextElement());
return Collections.unmodifiableList(result);
@@ -778,7 +778,7 @@ public class ClasspathManager {
* @see ModuleClassLoader#listLocalResources(String, String, int)
*/
public Collection<String> listLocalResources(String path, String filePattern, int options) {
- List<BundleFile> bundleFiles = new ArrayList<BundleFile>();
+ List<BundleFile> bundleFiles = new ArrayList<>();
ClasspathEntry[] cpEntries = getHostClasspathEntries();
for (ClasspathEntry cpEntry : cpEntries)
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/sources/MultiSourcePackage.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/sources/MultiSourcePackage.java
index a323f063e..b9546865e 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/sources/MultiSourcePackage.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/sources/MultiSourcePackage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2014 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -55,7 +55,7 @@ public class MultiSourcePackage extends PackageSource {
@Override
public Collection<String> listResources(String path, String filePattern) {
- List<String> result = new ArrayList<String>();
+ List<String> result = new ArrayList<>();
for (SingleSourcePackage source : suppliers) {
Collection<String> sourceResources = source.listResources(path, filePattern);
for (String resource : sourceResources) {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/BasicReadWriteLock.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/BasicReadWriteLock.java
index 12c8d613d..b402f58bb 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/BasicReadWriteLock.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/BasicReadWriteLock.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 IBM Corporation and others
+ * Copyright (c) 2008, 2016 IBM Corporation and others
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
@@ -11,7 +11,7 @@ import java.util.ArrayList;
import java.util.List;
public class BasicReadWriteLock {
- private List<Thread> currentReaders = new ArrayList<Thread>(2);
+ private List<Thread> currentReaders = new ArrayList<>(2);
private int writersWaiting = 0;
private Thread writing = null;
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EquinoxLogServices.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EquinoxLogServices.java
index 122b4dbaf..c97cdde0d 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EquinoxLogServices.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EquinoxLogServices.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2015 IBM Corporation and others.
+ * Copyright (c) 2006, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -114,7 +114,7 @@ public class EquinoxLogServices {
private ServiceRegistration<?> registerPerformanceLog(BundleContext context) {
Object service = createPerformanceLog(context.getBundle());
String serviceName = FrameworkLog.class.getName();
- Dictionary<String, Object> serviceProperties = new Hashtable<String, Object>(7);
+ Dictionary<String, Object> serviceProperties = new Hashtable<>(7);
Dictionary<String, String> headers = context.getBundle().getHeaders();
serviceProperties.put(Constants.SERVICE_VENDOR, headers.get(Constants.BUNDLE_VENDOR));
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminAdapter.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminAdapter.java
index 3ad412ab4..b9e13447f 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminAdapter.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2013 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,7 +19,7 @@ public class EventAdminAdapter implements ServiceTrackerCustomizer<Object, Objec
public static final String EVENT_TOPIC = "event.topics"; //$NON-NLS-1$
private static final String[] LOG_TOPICS_ARRAY = {"*", "org/*", "org/osgi/*", "org/osgi/service/*", "org/osgi/service/log/*", "org/osgi/service/log/LogEntry/*", "org/osgi/service/log/LogEntry/LOG_ERROR", "org/osgi/service/log/LogEntry/LOG_WARNING", "org/osgi/service/log/LogEntry/LOG_INFO", "org/osgi/service/log/LogEntry/LOG_DEBUG", "org/osgi/service/log/LogEntry/LOG_OTHER"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$//$NON-NLS-10$ //$NON-NLS-11$
private static final Object LOG_TOPIC_TOKEN = new Object();
- private static Collection<String> logTopics = new HashSet<String>(Arrays.asList(LOG_TOPICS_ARRAY));
+ private static Collection<String> logTopics = new HashSet<>(Arrays.asList(LOG_TOPICS_ARRAY));
private static Collection<String> eventAdminObjectClass = Arrays.asList("org.osgi.service.event.EventAdmin"); //$NON-NLS-1$
private static Collection<String> eventHandlerObjectClass = Arrays.asList("org.osgi.service.event.EventHandler"); //$NON-NLS-1$
@@ -34,8 +34,8 @@ public class EventAdminAdapter implements ServiceTrackerCustomizer<Object, Objec
public EventAdminAdapter(BundleContext context, ExtendedLogReaderServiceFactory logReaderServiceFactory) {
this.context = context;
this.logReaderServiceFactory = logReaderServiceFactory;
- eventAdminTracker = new ServiceTracker<Object, Object>(context, "org.osgi.service.event.EventAdmin", this); //$NON-NLS-1$
- eventHandlerTracker = new ServiceTracker<Object, Object>(context, "org.osgi.service.event.EventHandler", this); //$NON-NLS-1$
+ eventAdminTracker = new ServiceTracker<>(context, "org.osgi.service.event.EventAdmin", this); //$NON-NLS-1$
+ eventHandlerTracker = new ServiceTracker<>(context, "org.osgi.service.event.EventHandler", this); //$NON-NLS-1$
}
public void start() {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminLogListener.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminLogListener.java
index e8ef9de41..6aba51942 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminLogListener.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminLogListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation
+ * Copyright (c) 2007, 2016 IBM Corporation
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -98,7 +98,7 @@ public class EventAdminLogListener implements SynchronousLogListener {
default : // other log levels are represented by LOG_OTHER
topic += TOPIC_SEPARATOR + LOG_OTHER;
}
- Hashtable<String, Object> properties = new Hashtable<String, Object>();
+ Hashtable<String, Object> properties = new Hashtable<>();
Bundle bundle = entry.getBundle();
if (bundle == null) {
throw new RuntimeException("LogEntry.getBundle() returns null"); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogEntryImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogEntryImpl.java
index acee8a384..eb30db5ee 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogEntryImpl.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogEntryImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Cognos Incorporated, IBM Corporation and others
+ * Copyright (c) 2006, 2016 Cognos Incorporated, IBM Corporation and others
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
@@ -35,7 +35,7 @@ public class ExtendedLogEntryImpl implements ExtendedLogEntry, LogEntry {
try {
Thread.class.getMethod("getId", (Class[]) null); //$NON-NLS-1$
} catch (NoSuchMethodException e) {
- return new WeakHashMap<Thread, Long>();
+ return new WeakHashMap<>();
}
return null;
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogReaderServiceFactory.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogReaderServiceFactory.java
index 5fbf296aa..2813efc2d 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogReaderServiceFactory.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogReaderServiceFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2014 Cognos Incorporated, IBM Corporation and others
+ * Copyright (c) 2006, 2016 Cognos Incorporated, IBM Corporation and others
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
@@ -50,9 +50,9 @@ public class ExtendedLogReaderServiceFactory implements ServiceFactory<ExtendedL
private static PrintStream errorStream;
private final BasicReadWriteLock listenersLock = new BasicReadWriteLock();
- private ArrayMap<LogListener, Object[]> listeners = new ArrayMap<LogListener, Object[]>(5);
+ private ArrayMap<LogListener, Object[]> listeners = new ArrayMap<>(5);
private LogFilter[] filters = null;
- private final ThreadLocal<int[]> nestedCallCount = new ThreadLocal<int[]>();
+ private final ThreadLocal<int[]> nestedCallCount = new ThreadLocal<>();
private final LinkedList<LogEntry> history;
private final int maxHistory;
@@ -101,7 +101,7 @@ public class ExtendedLogReaderServiceFactory implements ServiceFactory<ExtendedL
public ExtendedLogReaderServiceFactory(int maxHistory) {
this.maxHistory = maxHistory;
if (maxHistory > 0) {
- history = new LinkedList<LogEntry>();
+ history = new LinkedList<>();
} else {
history = null;
}
@@ -237,7 +237,7 @@ public class ExtendedLogReaderServiceFactory implements ServiceFactory<ExtendedL
void addLogListener(LogListener listener, LogFilter filter) {
listenersLock.writeLock();
try {
- ArrayMap<LogListener, Object[]> listenersCopy = new ArrayMap<LogListener, Object[]>(listeners.getKeys(), listeners.getValues());
+ ArrayMap<LogListener, Object[]> listenersCopy = new ArrayMap<>(listeners.getKeys(), listeners.getValues());
Object[] listenerObjects = listenersCopy.get(listener);
if (listenerObjects == null) {
// Only create a task queue for non-SynchronousLogListeners
@@ -256,7 +256,7 @@ public class ExtendedLogReaderServiceFactory implements ServiceFactory<ExtendedL
}
private void recalculateFilters(ArrayMap<LogListener, Object[]> listenersCopy) {
- List<LogFilter> filtersList = new ArrayList<LogFilter>();
+ List<LogFilter> filtersList = new ArrayList<>();
int size = listenersCopy.size();
for (int i = 0; i < size; i++) {
Object[] listenerObjects = listenersCopy.getValue(i);
@@ -277,7 +277,7 @@ public class ExtendedLogReaderServiceFactory implements ServiceFactory<ExtendedL
void removeLogListener(LogListener listener) {
listenersLock.writeLock();
try {
- ArrayMap<LogListener, Object[]> listenersCopy = new ArrayMap<LogListener, Object[]>(listeners.getKeys(), listeners.getValues());
+ ArrayMap<LogListener, Object[]> listenersCopy = new ArrayMap<>(listeners.getKeys(), listeners.getValues());
listenersCopy.remove(listener);
recalculateFilters(listenersCopy);
listeners = listenersCopy;
@@ -291,7 +291,7 @@ public class ExtendedLogReaderServiceFactory implements ServiceFactory<ExtendedL
return EMPTY_ENUMERATION;
}
synchronized (history) {
- return Collections.enumeration(new ArrayList<LogEntry>(history));
+ return Collections.enumeration(new ArrayList<>(history));
}
}
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogReaderServiceImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogReaderServiceImpl.java
index 868a31603..8ee48f5d9 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogReaderServiceImpl.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogReaderServiceImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 Cognos Incorporated, IBM Corporation and others
+ * Copyright (c) 2006, 2016 Cognos Incorporated, IBM Corporation and others
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
@@ -15,7 +15,7 @@ import org.osgi.service.log.LogListener;
public class ExtendedLogReaderServiceImpl implements ExtendedLogReaderService {
private final ExtendedLogReaderServiceFactory factory;
- private Set<LogListener> listeners = new HashSet<LogListener>();
+ private Set<LogListener> listeners = new HashSet<>();
ExtendedLogReaderServiceImpl(ExtendedLogReaderServiceFactory factory) {
this.factory = factory;
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogServiceFactory.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogServiceFactory.java
index 82b8bdf8b..ab8bcf025 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogServiceFactory.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogServiceFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Cognos Incorporated, IBM Corporation and others
+ * Copyright (c) 2006, 2016 Cognos Incorporated, IBM Corporation and others
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
@@ -18,7 +18,7 @@ public class ExtendedLogServiceFactory implements ServiceFactory<ExtendedLogServ
private final Permission logPermission = new LogPermission("*", LogPermission.LOG); //$NON-NLS-1$
private final ExtendedLogReaderServiceFactory logReaderServiceFactory;
- private final Map<Bundle, ExtendedLogService> logServices = new HashMap<Bundle, ExtendedLogService>();
+ private final Map<Bundle, ExtendedLogService> logServices = new HashMap<>();
public ExtendedLogServiceFactory(ExtendedLogReaderServiceFactory logReaderServiceFactory) {
this.logReaderServiceFactory = logReaderServiceFactory;
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogServiceImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogServiceImpl.java
index d7bddb066..606a52b90 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogServiceImpl.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogServiceImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Cognos Incorporated, IBM Corporation and others
+ * Copyright (c) 2006, 2016 Cognos Incorporated, IBM Corporation and others
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
@@ -18,7 +18,7 @@ public class ExtendedLogServiceImpl implements ExtendedLogService, LogService {
private final ExtendedLogServiceFactory factory;
private volatile Bundle bundle;
- private final HashMap<String, Logger> loggerCache = new HashMap<String, Logger>();
+ private final HashMap<String, Logger> loggerCache = new HashMap<>();
public ExtendedLogServiceImpl(ExtendedLogServiceFactory factory, Bundle bundle) {
this.factory = factory;
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/LogServiceManager.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/LogServiceManager.java
index 788091b97..25a54c758 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/LogServiceManager.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/LogServiceManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2014 Cognos Incorporated, IBM Corporation and others
+ * Copyright (c) 2006, 2016 Cognos Incorporated, IBM Corporation and others
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
@@ -236,7 +236,7 @@ public class LogServiceManager implements BundleListener, FrameworkListener, Ser
}
public Dictionary<String, String> getHeaders() {
- return new Hashtable<String, String>();
+ return new Hashtable<>();
}
public long getBundleId() {
@@ -300,7 +300,7 @@ public class LogServiceManager implements BundleListener, FrameworkListener, Ser
}
public Map<X509Certificate, List<X509Certificate>> getSignerCertificates(int signersType) {
- return new HashMap<X509Certificate, List<X509Certificate>>();
+ return new HashMap<>();
}
public Version getVersion() {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/SerializedTaskQueue.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/SerializedTaskQueue.java
index 11d691816..4226421a9 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/SerializedTaskQueue.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/SerializedTaskQueue.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Cognos Incorporated, IBM Corporation and others
+ * Copyright (c) 2006, 2016 Cognos Incorporated, IBM Corporation and others
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
@@ -15,7 +15,7 @@ import java.util.LinkedList;
public class SerializedTaskQueue {
private static final int MAX_WAIT = 5000;
- private final LinkedList<Runnable> tasks = new LinkedList<Runnable>();
+ private final LinkedList<Runnable> tasks = new LinkedList<>();
private Thread thread;
private final String queueName;
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/EquinoxSecurityManager.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/EquinoxSecurityManager.java
index b764f34f8..8c4f3e684 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/EquinoxSecurityManager.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/EquinoxSecurityManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2013 IBM Corporation and others.
+ * Copyright (c) 2008, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -36,8 +36,8 @@ public class EquinoxSecurityManager extends SecurityManager {
static class CheckContext {
// A non zero depth indicates that we are doing a recursive permission check.
- List<List<Decision[]>> depthCondSets = new ArrayList<List<Decision[]>>(2);
- List<AccessControlContext> accs = new ArrayList<AccessControlContext>(2);
+ List<List<Decision[]>> depthCondSets = new ArrayList<>(2);
+ List<AccessControlContext> accs = new ArrayList<>(2);
List<Class<?>> CondClassSet;
public int getDepth() {
@@ -62,7 +62,7 @@ public class EquinoxSecurityManager extends SecurityManager {
}
}
- private final ThreadLocal<CheckContext> localCheckContext = new ThreadLocal<CheckContext>();
+ private final ThreadLocal<CheckContext> localCheckContext = new ThreadLocal<>();
boolean addConditionsForDomain(Decision[] results) {
CheckContext cc = localCheckContext.get();
@@ -73,7 +73,7 @@ public class EquinoxSecurityManager extends SecurityManager {
}
List<Decision[]> condSets = cc.depthCondSets.get(cc.getDepth());
if (condSets == null) {
- condSets = new ArrayList<Decision[]>(1);
+ condSets = new ArrayList<>(1);
cc.depthCondSets.set(cc.getDepth(), condSets);
}
condSets.add(results);
@@ -120,7 +120,7 @@ public class EquinoxSecurityManager extends SecurityManager {
if (conditionSets == null)
return;
// TODO the spec seems impossible to implement just doing the simple thing for now
- Map<Class<? extends Condition>, Dictionary<Object, Object>> conditionDictionaries = new HashMap<Class<? extends Condition>, Dictionary<Object, Object>>();
+ Map<Class<? extends Condition>, Dictionary<Object, Object>> conditionDictionaries = new HashMap<>();
for (Decision[] domainDecisions : conditionSets) {
boolean grant = false;
for (int i = 0; i < domainDecisions.length; i++) {
@@ -158,12 +158,12 @@ public class EquinoxSecurityManager extends SecurityManager {
for (int i = 0; i < postponed.length; i++) {
Dictionary<Object, Object> condContext = conditionDictionaries.get(postponed[i].getClass());
if (condContext == null) {
- condContext = new Hashtable<Object, Object>();
+ condContext = new Hashtable<>();
conditionDictionaries.put(postponed[i].getClass(), condContext);
}
// prevent recursion into Condition
if (cc.CondClassSet == null)
- cc.CondClassSet = new ArrayList<Class<?>>(2);
+ cc.CondClassSet = new ArrayList<>(2);
if (cc.CondClassSet.contains(postponed[i].getClass()))
return SecurityTable.ABSTAIN;
cc.CondClassSet.add(postponed[i].getClass());
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/PermissionAdminTable.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/PermissionAdminTable.java
index d660b8bc8..de95214c4 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/PermissionAdminTable.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/PermissionAdminTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 IBM Corporation and others.
+ * Copyright (c) 2008, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,7 +15,7 @@ import java.util.Map;
import org.osgi.service.permissionadmin.PermissionInfo;
public class PermissionAdminTable {
- private final Map<String, PermissionInfoCollection> locations = new HashMap<String, PermissionInfoCollection>();
+ private final Map<String, PermissionInfoCollection> locations = new HashMap<>();
String[] getLocations() {
return locations.keySet().toArray(new String[locations.size()]);
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/PermissionInfoCollection.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/PermissionInfoCollection.java
index e00277735..f7d982619 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/PermissionInfoCollection.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/PermissionInfoCollection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 IBM Corporation and others.
+ * Copyright (c) 2008, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,7 +26,7 @@ public final class PermissionInfoCollection extends PermissionCollection {
static private final Class<?>[][] permClassArrayArgs = new Class[][] {noArgClassArray, oneStringClassArray, twoStringClassArray};
/* @GuardedBy(cachedPermisssionCollections) */
- private final Map<Class<? extends Permission>, PermissionCollection> cachedPermissionCollections = new HashMap<Class<? extends Permission>, PermissionCollection>();
+ private final Map<Class<? extends Permission>, PermissionCollection> cachedPermissionCollections = new HashMap<>();
private final boolean hasAllPermission;
private final PermissionInfo[] permInfos;
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/PermissionsHash.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/PermissionsHash.java
index 51e37623d..ae0a58bb4 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/PermissionsHash.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/PermissionsHash.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 IBM Corporation and others.
+ * Copyright (c) 2008, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -35,7 +35,7 @@ class PermissionsHash extends PermissionCollection {
/**
* A hashtable to store the elements of the collection.
*/
- Hashtable<Permission, Permission> perms = new Hashtable<Permission, Permission>(8);
+ Hashtable<Permission, Permission> perms = new Hashtable<>(8);
/**
* Constructs a new instance of this class.
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/SecurityAdmin.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/SecurityAdmin.java
index 09eeaaca1..3a05f2977 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/SecurityAdmin.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/SecurityAdmin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2014 IBM Corporation and others.
+ * Copyright (c) 2008, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -250,7 +250,7 @@ public final class SecurityAdmin implements PermissionAdmin, ConditionalPermissi
// could implement our own Enumeration, but we don't care about performance here. Just do something simple:
synchronized (lock) {
SecurityRow[] rows = condAdminTable.getRows();
- List<ConditionalPermissionInfo> vRows = new ArrayList<ConditionalPermissionInfo>(rows.length);
+ List<ConditionalPermissionInfo> vRows = new ArrayList<>(rows.length);
for (int i = 0; i < rows.length; i++)
vRows.add(rows[i]);
return Collections.enumeration(vRows);
@@ -313,7 +313,7 @@ public final class SecurityAdmin implements PermissionAdmin, ConditionalPermissi
if (updateStamp != timeStamp)
return false;
SecurityRow[] newRows = new SecurityRow[rows.size()];
- Collection<String> names = new ArrayList<String>();
+ Collection<String> names = new ArrayList<>();
for (int i = 0; i < newRows.length; i++) {
Object rowObj = rows.get(i);
if (!(rowObj instanceof ConditionalPermissionInfo))
@@ -426,7 +426,7 @@ public final class SecurityAdmin implements PermissionAdmin, ConditionalPermissi
DataInputStream in = null;
try {
in = new DataInputStream(resource.openStream());
- List<PermissionInfo> permissions = new ArrayList<PermissionInfo>();
+ List<PermissionInfo> permissions = new ArrayList<>();
BufferedReader reader;
try {
reader = new BufferedReader(new InputStreamReader(in, "UTF8")); //$NON-NLS-1$
@@ -466,10 +466,10 @@ public final class SecurityAdmin implements PermissionAdmin, ConditionalPermissi
}
private static Bundle createMockBundle(String[] signers) {
- Map<X509Certificate, List<X509Certificate>> signersMap = new HashMap<X509Certificate, List<X509Certificate>>();
+ Map<X509Certificate, List<X509Certificate>> signersMap = new HashMap<>();
for (int i = 0; i < signers.length; i++) {
List<String> chain = parseDNchain(signers[i]);
- List<X509Certificate> signersList = new ArrayList<X509Certificate>();
+ List<X509Certificate> signersList = new ArrayList<>();
Principal subject = null, issuer = null;
X509Certificate first = null;
for (Iterator<String> iChain = chain.iterator(); iChain.hasNext();) {
@@ -515,7 +515,7 @@ public final class SecurityAdmin implements PermissionAdmin, ConditionalPermissi
}
public Dictionary<String, String> getHeaders() {
- return new Hashtable<String, String>();
+ return new Hashtable<>();
}
public Dictionary<String, String> getHeaders(String locale) {
@@ -550,7 +550,7 @@ public final class SecurityAdmin implements PermissionAdmin, ConditionalPermissi
}
public Map<X509Certificate, List<X509Certificate>> getSignerCertificates(int signersType) {
- return new HashMap<X509Certificate, List<X509Certificate>>(signers);
+ return new HashMap<>(signers);
}
public int getState() {
@@ -826,7 +826,7 @@ public final class SecurityAdmin implements PermissionAdmin, ConditionalPermissi
if (dnChain == null) {
throw new IllegalArgumentException("The DN chain must not be null."); //$NON-NLS-1$
}
- List<String> parsed = new ArrayList<String>();
+ List<String> parsed = new ArrayList<>();
int startIndex = 0;
startIndex = skipSpaces(dnChain, startIndex);
while (startIndex < dnChain.length()) {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/SecurityRow.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/SecurityRow.java
index 106933a8a..49431e63e 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/SecurityRow.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/SecurityRow.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 IBM Corporation and others.
+ * Copyright (c) 2008, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -50,7 +50,7 @@ public final class SecurityRow implements ConditionalPermissionInfo {
if (conditionInfos == null || conditionInfos.length == 0)
bundleConditions = null;
else
- bundleConditions = new HashMap<BundlePermissions, Condition[]>();
+ bundleConditions = new HashMap<>();
}
static SecurityRowSnapShot createSecurityRowSnapShot(String encoded) {
@@ -103,8 +103,8 @@ public final class SecurityRow implements ConditionalPermissionInfo {
if (decision.length() == 0 || (!ConditionalPermissionInfo.DENY.equalsIgnoreCase(decision) && !ConditionalPermissionInfo.ALLOW.equalsIgnoreCase(decision)))
throw new IllegalArgumentException(encoded);
- List<ConditionInfo> condList = new ArrayList<ConditionInfo>();
- List<PermissionInfo> permList = new ArrayList<PermissionInfo>();
+ List<ConditionInfo> condList = new ArrayList<>();
+ List<PermissionInfo> permList = new ArrayList<>();
int pos = start + 1;
while (pos < end) {
while (pos < end && chars[pos] != '[' && chars[pos] != '(')
@@ -327,7 +327,7 @@ public final class SecurityRow implements ConditionalPermissionInfo {
return postponedPermCheck; // no need to postpone the condition if the row abstains
// this row will deny or allow the permission; must queue the postponed condition
if (postponedConditions == null)
- postponedConditions = new ArrayList<Condition>(1);
+ postponedConditions = new ArrayList<>(1);
postponedConditions.add(condition);
}
empty &= conditions[i] == null;
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/SecurityTableUpdate.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/SecurityTableUpdate.java
index f1ab80ae9..e0cff1823 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/SecurityTableUpdate.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/SecurityTableUpdate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 IBM Corporation and others.
+ * Copyright (c) 2008, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,7 +25,7 @@ public class SecurityTableUpdate implements ConditionalPermissionUpdate {
this.securityAdmin = securityAdmin;
this.timeStamp = timeStamp;
// must make a snap shot of the security rows.
- this.rows = new ArrayList<ConditionalPermissionInfo>(rows.length);
+ this.rows = new ArrayList<>(rows.length);
for (int i = 0; i < rows.length; i++)
// Use SecurityRowSnapShot to prevent modification before commit
// and to throw exceptions from delete
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/provisional/service/security/AuthorizationEngine.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/provisional/service/security/AuthorizationEngine.java
index d8ab8390b..6693625b5 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/provisional/service/security/AuthorizationEngine.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/provisional/service/security/AuthorizationEngine.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2012 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -30,7 +30,7 @@ public abstract class AuthorizationEngine {
private final ServiceTracker<AuthorizationListener, AuthorizationListener> listenerTracker;
public AuthorizationEngine(BundleContext context) {
- listenerTracker = new ServiceTracker<AuthorizationListener, AuthorizationListener>(context, AuthorizationListener.class.getName(), null);
+ listenerTracker = new ServiceTracker<>(context, AuthorizationListener.class.getName(), null);
listenerTracker.open();
}
@@ -52,11 +52,11 @@ public abstract class AuthorizationEngine {
Object[] services = listenerTracker.getServices();
if (services == null)
return;
- Map<AuthorizationListener, Object> listeners = new HashMap<AuthorizationListener, Object>();
+ Map<AuthorizationListener, Object> listeners = new HashMap<>();
for (Object service : services) {
listeners.put((AuthorizationListener) service, service);
}
- ListenerQueue<AuthorizationListener, Object, AuthorizationEvent> queue = new ListenerQueue<AuthorizationListener, Object, AuthorizationEvent>(manager);
+ ListenerQueue<AuthorizationListener, Object, AuthorizationEvent> queue = new ListenerQueue<>(manager);
queue.queueListeners(listeners.entrySet(), dispatcher);
queue.dispatchEventSynchronous(0, event);
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/service/security/KeyStoreTrustEngine.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/service/security/KeyStoreTrustEngine.java
index 26436f8d8..d60277919 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/service/security/KeyStoreTrustEngine.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/service/security/KeyStoreTrustEngine.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2013 IBM Corporation and others.
+ * Copyright (c) 2007, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,8 +12,9 @@ package org.eclipse.osgi.internal.service.security;
import java.io.*;
import java.security.*;
-import java.security.cert.*;
import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
import java.util.*;
import org.eclipse.osgi.framework.log.FrameworkLogEntry;
import org.eclipse.osgi.internal.signedcontent.SignedBundleHook;
@@ -262,7 +263,7 @@ public class KeyStoreTrustEngine extends TrustEngine {
public String[] getAliases() throws IOException, GeneralSecurityException {
- List<String> returnList = new ArrayList<String>();
+ List<String> returnList = new ArrayList<>();
try {
KeyStore store = getKeyStore();
synchronized (store) {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl.java
index 18c3c181d..f39463924 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2014 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -93,7 +93,7 @@ public class ServiceRegistrationImpl<S> implements ServiceRegistration<S>, Compa
this.clazzes = clazzes; /* must be set before calling createProperties. */
this.service = service; /* must be set before calling createProperties. */
this.serviceid = registry.getNextServiceId(); /* must be set before calling createProperties. */
- this.contextsUsing = new ArrayList<BundleContextImpl>(10);
+ this.contextsUsing = new ArrayList<>(10);
synchronized (registrationLock) {
this.state = REGISTERED;
@@ -102,7 +102,7 @@ public class ServiceRegistrationImpl<S> implements ServiceRegistration<S>, Compa
* stores the value in a final field without
* otherwise using it.
*/
- this.reference = new ServiceReferenceImpl<S>(this);
+ this.reference = new ServiceReferenceImpl<>(this);
}
}
@@ -524,7 +524,7 @@ public class ServiceRegistrationImpl<S> implements ServiceRegistration<S>, Compa
Debug.println("getServiceObjects[" + user.getBundleImpl() + "](" + this + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- return new ServiceObjectsImpl<S>(user, this);
+ return new ServiceObjectsImpl<>(user, this);
}
/**
@@ -536,11 +536,11 @@ public class ServiceRegistrationImpl<S> implements ServiceRegistration<S>, Compa
private ServiceUse<S> newServiceUse(BundleContextImpl user) {
if (service instanceof ServiceFactory) {
if (service instanceof PrototypeServiceFactory) {
- return new PrototypeServiceFactoryUse<S>(user, this);
+ return new PrototypeServiceFactoryUse<>(user, this);
}
- return new ServiceFactoryUse<S>(user, this);
+ return new ServiceFactoryUse<>(user, this);
}
- return new ServiceUse<S>(user, this);
+ return new ServiceUse<>(user, this);
}
/**
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java
index c16852de3..cc24fe06c 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2014 IBM Corporation and others.
+ * Copyright (c) 2004, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -91,10 +91,10 @@ public class ServiceRegistry {
this.container = container;
this.debug = container.getConfiguration().getDebug();
serviceid = 1;
- publishedServicesByClass = new HashMap<String, List<ServiceRegistrationImpl<?>>>(initialCapacity);
- publishedServicesByContext = new HashMap<BundleContextImpl, List<ServiceRegistrationImpl<?>>>(initialCapacity);
- allPublishedServices = new ArrayList<ServiceRegistrationImpl<?>>(initialCapacity);
- serviceEventListeners = new HashMap<BundleContextImpl, CopyOnWriteIdentityMap<ServiceListener, FilteredServiceListener>>(initialCapacity);
+ publishedServicesByClass = new HashMap<>(initialCapacity);
+ publishedServicesByContext = new HashMap<>(initialCapacity);
+ allPublishedServices = new ArrayList<>(initialCapacity);
+ serviceEventListeners = new HashMap<>(initialCapacity);
Module systemModule = container.getStorage().getModuleContainer().getModule(0);
systemBundleContext = (BundleContextImpl) systemModule.getBundle().getBundleContext();
systemBundleContext.provisionServicesInUseMap();
@@ -197,7 +197,7 @@ public class ServiceRegistry {
}
/* copy the array so that changes to the original will not affect us. */
- List<String> copy = new ArrayList<String>(size);
+ List<String> copy = new ArrayList<>(size);
// intern the strings and remove duplicates
for (int i = 0; i < size; i++) {
String clazz = clazzes[i].intern();
@@ -221,7 +221,7 @@ public class ServiceRegistry {
}
}
- ServiceRegistrationImpl<?> registration = new ServiceRegistrationImpl<Object>(this, context, clazzes, service);
+ ServiceRegistrationImpl<?> registration = new ServiceRegistrationImpl<>(this, context, clazzes, service);
registration.register(properties);
if (copy.contains(listenerHookName)) {
notifyNewListenerHook(registration);
@@ -307,7 +307,7 @@ public class ServiceRegistry {
}
Filter filter = (filterstring == null) ? null : context.createFilter(filterstring);
List<ServiceRegistrationImpl<?>> registrations = lookupServiceRegistrations(clazz, filter);
- List<ServiceReferenceImpl<?>> references = new ArrayList<ServiceReferenceImpl<?>>(registrations.size());
+ List<ServiceReferenceImpl<?>> references = new ArrayList<>(registrations.size());
for (ServiceRegistrationImpl<?> registration : registrations) {
ServiceReferenceImpl<?> reference;
try {
@@ -331,7 +331,7 @@ public class ServiceRegistry {
if (context.getBundleImpl().getBundleId() == 0) {
// Make a copy for the purposes of calling the hooks;
// The the removals from the hooks are ignored for the system bundle
- copyReferences = new ArrayList<ServiceReferenceImpl<?>>(references);
+ copyReferences = new ArrayList<>(references);
}
Collection<ServiceReference<?>> shrinkable = new ShrinkableCollection<ServiceReference<?>>(copyReferences);
notifyFindHooks(context, clazz, filterstring, allservices, shrinkable);
@@ -567,7 +567,7 @@ public class ServiceRegistry {
*/
public ServiceReferenceImpl<?>[] getRegisteredServices(BundleContextImpl context) {
List<ServiceRegistrationImpl<?>> registrations = lookupServiceRegistrations(context);
- List<ServiceReferenceImpl<?>> references = new ArrayList<ServiceReferenceImpl<?>>(registrations.size());
+ List<ServiceReferenceImpl<?>> references = new ArrayList<>(registrations.size());
for (ServiceRegistrationImpl<?> registration : registrations) {
ServiceReferenceImpl<?> reference;
try {
@@ -627,9 +627,9 @@ public class ServiceRegistry {
if (servicesInUse.isEmpty()) {
return null;
}
- registrations = new ArrayList<ServiceRegistrationImpl<?>>(servicesInUse.keySet());
+ registrations = new ArrayList<>(servicesInUse.keySet());
}
- List<ServiceReferenceImpl<?>> references = new ArrayList<ServiceReferenceImpl<?>>(registrations.size());
+ List<ServiceReferenceImpl<?>> references = new ArrayList<>(registrations.size());
for (ServiceRegistrationImpl<?> registration : registrations) {
ServiceReferenceImpl<?> reference;
try {
@@ -686,7 +686,7 @@ public class ServiceRegistry {
if (servicesInUse.isEmpty()) {
return;
}
- registrations = new ArrayList<ServiceRegistrationImpl<?>>(servicesInUse.keySet());
+ registrations = new ArrayList<>(servicesInUse.keySet());
}
if (debug.DEBUG_SERVICES) {
Debug.println("Releasing services"); //$NON-NLS-1$
@@ -715,7 +715,7 @@ public class ServiceRegistry {
synchronized (serviceEventListeners) {
CopyOnWriteIdentityMap<ServiceListener, FilteredServiceListener> listeners = serviceEventListeners.get(context);
if (listeners == null) {
- listeners = new CopyOnWriteIdentityMap<ServiceListener, FilteredServiceListener>();
+ listeners = new CopyOnWriteIdentityMap<>();
serviceEventListeners.put(context, listeners);
}
oldFilteredListener = listeners.put(listener, filteredListener);
@@ -815,7 +815,7 @@ public class ServiceRegistry {
Set<Map.Entry<ServiceListener, FilteredServiceListener>> systemServiceListenersOrig = null;
BundleContextImpl systemContext = null;
synchronized (serviceEventListeners) {
- listenerSnapshot = new HashMap<BundleContextImpl, Set<Map.Entry<ServiceListener, FilteredServiceListener>>>(serviceEventListeners.size());
+ listenerSnapshot = new HashMap<>(serviceEventListeners.size());
for (Map.Entry<BundleContextImpl, CopyOnWriteIdentityMap<ServiceListener, FilteredServiceListener>> entry : serviceEventListeners.entrySet()) {
Map<ServiceListener, FilteredServiceListener> listeners = entry.getValue();
if (!listeners.isEmpty()) {
@@ -896,7 +896,7 @@ public class ServiceRegistry {
// Add the ServiceRegistrationImpl to the list of Services published by BundleContextImpl.
List<ServiceRegistrationImpl<?>> contextServices = publishedServicesByContext.get(context);
if (contextServices == null) {
- contextServices = new ArrayList<ServiceRegistrationImpl<?>>(initialSubCapacity);
+ contextServices = new ArrayList<>(initialSubCapacity);
publishedServicesByContext.put(context, contextServices);
}
// The list is NOT sorted, so we just add
@@ -908,7 +908,7 @@ public class ServiceRegistry {
List<ServiceRegistrationImpl<?>> services = publishedServicesByClass.get(clazz);
if (services == null) {
- services = new ArrayList<ServiceRegistrationImpl<?>>(initialSubCapacity);
+ services = new ArrayList<>(initialSubCapacity);
publishedServicesByClass.put(clazz, services);
}
@@ -1005,7 +1005,7 @@ public class ServiceRegistry {
return empty;
}
- result = new LinkedList<ServiceRegistrationImpl<?>>(result); /* make a new list since we don't want to change the real list */
+ result = new LinkedList<>(result); /* make a new list since we don't want to change the real list */
}
if (filter == null) {
@@ -1042,7 +1042,7 @@ public class ServiceRegistry {
return empty;
}
- return new ArrayList<ServiceRegistrationImpl<?>>(result); /* make a new list since we don't want to change the real list */
+ return new ArrayList<>(result); /* make a new list since we don't want to change the real list */
}
/**
@@ -1318,7 +1318,7 @@ public class ServiceRegistry {
}
// snapshot the listeners
- Collection<ListenerInfo> addedListeners = new ArrayList<ListenerInfo>(initialCapacity);
+ Collection<ListenerInfo> addedListeners = new ArrayList<>(initialCapacity);
synchronized (serviceEventListeners) {
for (CopyOnWriteIdentityMap<ServiceListener, FilteredServiceListener> listeners : serviceEventListeners.values()) {
if (!listeners.isEmpty()) {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableCollection.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableCollection.java
index 7a093f84d..f47e23fa1 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableCollection.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableCollection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2013 IBM Corporation and others.
+ * Copyright (c) 2008, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -43,14 +43,14 @@ public class ShrinkableCollection<E> implements Collection<E> {
}
public ShrinkableCollection(Collection<? extends E> c1, Collection<? extends E> c2) {
- list = new ArrayList<Collection<? extends E>>(2);
+ list = new ArrayList<>(2);
list.add(c1);
list.add(c2);
collection = initComposite(list);
}
public ShrinkableCollection(List<Collection<? extends E>> l) {
- list = new ArrayList<Collection<? extends E>>(l);
+ list = new ArrayList<>(l);
collection = initComposite(list);
}
@@ -60,7 +60,7 @@ public class ShrinkableCollection<E> implements Collection<E> {
assert verifyNoDuplicates(c);
size += c.size();
}
- Collection<E> result = new ArrayList<E>(size);
+ Collection<E> result = new ArrayList<>(size);
for (Collection<? extends E> c : collections) {
for (E e : c) {
if (!result.contains(e)) {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableEntrySetValueCollection.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableEntrySetValueCollection.java
index a255c086c..04e668e49 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableEntrySetValueCollection.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableEntrySetValueCollection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 IBM Corporation and others.
+ * Copyright (c) 2010, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -32,7 +32,7 @@ public class ShrinkableEntrySetValueCollection<E> extends AbstractCollection<E>
}
public Iterator<E> iterator() {
- return new ValueIterator<E>(entrySet.iterator());
+ return new ValueIterator<>(entrySet.iterator());
}
public int size() {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableValueCollectionMap.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableValueCollectionMap.java
index 59d6c034a..3be680213 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableValueCollectionMap.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ShrinkableValueCollectionMap.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 IBM Corporation and others.
+ * Copyright (c) 2010, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -61,9 +61,9 @@ public class ShrinkableValueCollectionMap<K, V> extends AbstractMap<K, Collectio
if (entrySet == null) {
return null;
}
- value = new ShrinkableEntrySetValueCollection<V>(entrySet);
+ value = new ShrinkableEntrySetValueCollection<>(entrySet);
if (values == null) {
- values = new HashMap<Object, Collection<V>>(map.size());
+ values = new HashMap<>(map.size());
}
values.put(key, value);
}
@@ -81,7 +81,7 @@ public class ShrinkableValueCollectionMap<K, V> extends AbstractMap<K, Collectio
value = values.remove(key);
}
if ((value == null) && (entrySet != null)) {
- value = new ShrinkableEntrySetValueCollection<V>(entrySet);
+ value = new ShrinkableEntrySetValueCollection<>(entrySet);
}
return value;
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/PKCS7Processor.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/PKCS7Processor.java
index 177aad357..6b59d9667 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/PKCS7Processor.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/PKCS7Processor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2014 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2006, 2016 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -229,7 +229,7 @@ public class PKCS7Processor implements SignedContentConstants {
}
private List<Certificate> constructCertPath(List<Certificate> certs, Certificate targetCert) {
- List<Certificate> certsList = new ArrayList<Certificate>();
+ List<Certificate> certsList = new ArrayList<>();
certsList.add(targetCert);
X509Certificate currentCert = (X509Certificate) targetCert;
@@ -360,7 +360,7 @@ public class PKCS7Processor implements SignedContentConstants {
if (bp.classOfTag == BERProcessor.CONTEXTSPECIFIC_TAGCLASS && bp.tag == 1) {
// there are some unsignedAttrs are found!!
- unsignedAttrs = new HashMap<int[], byte[]>();
+ unsignedAttrs = new HashMap<>();
// step into a set of unsigned attributes, I believe, when steps
// into here, the 'poiter' is pointing to the first element
@@ -389,7 +389,7 @@ public class PKCS7Processor implements SignedContentConstants {
if (bp.classOfTag == BERProcessor.CONTEXTSPECIFIC_TAGCLASS) {
// process the signed attributes
- signedAttrs = new HashMap<int[], byte[]>();
+ signedAttrs = new HashMap<>();
BERProcessor signedAttrsBERS = bp.stepInto();
do {
@@ -449,7 +449,7 @@ public class PKCS7Processor implements SignedContentConstants {
* @throws SignatureException
*/
private List<Certificate> processCertificates(BERProcessor bp) throws CertificateException, SignatureException {
- List<Certificate> rtvList = new ArrayList<Certificate>(3);
+ List<Certificate> rtvList = new ArrayList<>(3);
// Step into the first certificate-element
BERProcessor certsBERS = bp.stepInto();
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignatureBlockProcessor.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignatureBlockProcessor.java
index 03afd0e30..7b8536ef2 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignatureBlockProcessor.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignatureBlockProcessor.java
@@ -22,8 +22,8 @@ import org.eclipse.osgi.util.NLS;
public class SignatureBlockProcessor implements SignedContentConstants {
private final SignedBundleFile signedBundle;
- private List<SignerInfo> signerInfos = new ArrayList<SignerInfo>();
- private Map<String, Object> contentMDResults = new HashMap<String, Object>();
+ private List<SignerInfo> signerInfos = new ArrayList<>();
+ private Map<String, Object> contentMDResults = new HashMap<>();
// map of tsa singers keyed by SignerInfo -> {tsa_SignerInfo, signingTime}
private Map<SignerInfo, Object[]> tsaSignerInfos;
private final int supportFlags;
@@ -43,7 +43,7 @@ public class SignatureBlockProcessor implements SignedContentConstants {
// read all the signature block file names into a list
Enumeration<String> en = wrappedBundleFile.getEntryPaths(META_INF);
- List<String> signers = new ArrayList<String>(2);
+ List<String> signers = new ArrayList<>(2);
while (en.hasMoreElements()) {
String name = en.nextElement();
if ((name.endsWith(DOT_DSA) || name.endsWith(DOT_RSA)) && name.indexOf('/') == name.lastIndexOf('/'))
@@ -117,7 +117,7 @@ public class SignatureBlockProcessor implements SignedContentConstants {
if (tsaCerts != null && signingTime != null) {
SignerInfoImpl tsaSignerInfo = new SignerInfoImpl(tsaCerts, null, digAlg);
if (tsaSignerInfos == null)
- tsaSignerInfos = new HashMap<SignerInfo, Object[]>(2);
+ tsaSignerInfos = new HashMap<>(2);
tsaSignerInfos.put(signerInfo, new Object[] {tsaSignerInfo, signingTime});
}
}
@@ -225,8 +225,8 @@ public class SignatureBlockProcessor implements SignedContentConstants {
@SuppressWarnings("unchecked")
List<Object>[] arrayLists = new ArrayList[2];
mdResult = arrayLists;
- mdResult[0] = new ArrayList<Object>();
- mdResult[1] = new ArrayList<Object>();
+ mdResult[0] = new ArrayList<>();
+ mdResult[1] = new ArrayList<>();
contentMDResults.put(entryName, mdResult);
}
mdResult[0].add(signerInfo);
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java
index 0d4de3be6..b390741e0 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedBundleHook.java
@@ -94,7 +94,7 @@ public class SignedBundleHook implements ActivatorHookFactory, BundleFileWrapper
// initialize the trust engine listener only if trust is being established with a trust engine
trustEngineListener = new TrustEngineListener(context, this);
// always register the trust engine
- Dictionary<String, Object> trustEngineProps = new Hashtable<String, Object>(7);
+ Dictionary<String, Object> trustEngineProps = new Hashtable<>(7);
trustEngineProps.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MIN_VALUE));
trustEngineProps.put(SignedContentConstants.TRUST_ENGINE, SignedContentConstants.DEFAULT_TRUST_ENGINE);
KeyStoreTrustEngine systemTrustEngine = new KeyStoreTrustEngine(CACERTS_PATH, CACERTS_TYPE, null, "System", this); //$NON-NLS-1$
@@ -106,7 +106,7 @@ public class SignedBundleHook implements ActivatorHookFactory, BundleFileWrapper
if ("file".equals(url.getProtocol())) { //$NON-NLS-1$
trustEngineProps.put(SignedContentConstants.TRUST_ENGINE, OSGI_KEYSTORE);
String path = url.getPath();
- osgiTrustEngineReg = new ArrayList<ServiceRegistration<?>>(1);
+ osgiTrustEngineReg = new ArrayList<>(1);
osgiTrustEngineReg.add(context.registerService(TrustEngine.class.getName(), new KeyStoreTrustEngine(path, CACERTS_TYPE, null, OSGI_KEYSTORE, this), trustEngineProps));
}
} catch (MalformedURLException e) {
@@ -117,7 +117,7 @@ public class SignedBundleHook implements ActivatorHookFactory, BundleFileWrapper
if (osgiTrustRepoPaths != null) {
trustEngineProps.put(SignedContentConstants.TRUST_ENGINE, Constants.FRAMEWORK_TRUST_REPOSITORIES);
StringTokenizer st = new StringTokenizer(osgiTrustRepoPaths, File.pathSeparator);
- osgiTrustEngineReg = new ArrayList<ServiceRegistration<?>>(1);
+ osgiTrustEngineReg = new ArrayList<>(1);
while (st.hasMoreTokens()) {
String trustRepoPath = st.nextToken();
osgiTrustEngineReg.add(context.registerService(TrustEngine.class.getName(), new KeyStoreTrustEngine(trustRepoPath, CACERTS_TYPE, null, OSGI_KEYSTORE, this), trustEngineProps));
@@ -280,9 +280,9 @@ public class SignedBundleHook implements ActivatorHookFactory, BundleFileWrapper
log("Invalid trust engine filter", FrameworkLogEntry.WARNING, e); //$NON-NLS-1$
}
if (filter != null) {
- trustEngineTracker = new ServiceTracker<TrustEngine, TrustEngine>(context, filter, new TrustEngineCustomizer());
+ trustEngineTracker = new ServiceTracker<>(context, filter, new TrustEngineCustomizer());
} else
- trustEngineTracker = new ServiceTracker<TrustEngine, TrustEngine>(context, TrustEngine.class.getName(), new TrustEngineCustomizer());
+ trustEngineTracker = new ServiceTracker<>(context, TrustEngine.class.getName(), new TrustEngineCustomizer());
trustEngineTracker.open();
}
Object[] services = trustEngineTracker.getServices();
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedContentFile.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedContentFile.java
index e20a82aed..6e262e058 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedContentFile.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedContentFile.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 IBM Corporation and others.
+ * Copyright (c) 2008, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -88,7 +88,7 @@ public class SignedContentFile implements SignedContent {
synchronized Map<String, Throwable> getEntryExceptions(boolean create) {
if (create && entryExceptions == null)
- entryExceptions = new HashMap<String, Throwable>(5);
+ entryExceptions = new HashMap<>(5);
return entryExceptions;
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedContentImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedContentImpl.java
index ac403ccc8..fc18afd8e 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedContentImpl.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedContentImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2007, 2016 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -38,7 +38,7 @@ public class SignedContentImpl implements SignedContent {
public SignedContentEntry[] getSignedEntries() {
if (contentMDResults == null)
return new SignedContentEntry[0];
- List<SignedContentEntry> results = new ArrayList<SignedContentEntry>(contentMDResults.size());
+ List<SignedContentEntry> results = new ArrayList<>(contentMDResults.size());
for (Map.Entry<String, Object> entry : contentMDResults.entrySet()) {
String entryName = entry.getKey();
Object[] mdResult = (Object[]) entry.getValue();
@@ -105,7 +105,7 @@ public class SignedContentImpl implements SignedContent {
if (!containsInfo(baseInfo))
throw new IllegalArgumentException("The baseInfo is not found"); //$NON-NLS-1$
if (tsaSignerInfos == null)
- tsaSignerInfos = new HashMap<SignerInfo, Object[]>(signerInfos.length);
+ tsaSignerInfos = new HashMap<>(signerInfos.length);
tsaSignerInfos.put(baseInfo, new Object[] {tsaSignerInfo, signingTime});
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedStorageHook.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedStorageHook.java
index 4d369ad36..39af2ad6c 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedStorageHook.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/SignedStorageHook.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2006, 2016 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -26,12 +26,12 @@ public class SignedStorageHook extends StorageHookFactory<List<SignerInfo>, List
@Override
public List<SignerInfo> createSaveContext() {
- return new ArrayList<SignerInfo>();
+ return new ArrayList<>();
}
@Override
public List<SignerInfo> createLoadContext(int version) {
- return new ArrayList<SignerInfo>();
+ return new ArrayList<>();
}
@Override
@@ -64,7 +64,7 @@ public class SignedStorageHook extends StorageHookFactory<List<SignerInfo>, List
int resultsSize = is.readInt();
Map<String, Object> contentMDResults = null;
if (resultsSize > 0) {
- contentMDResults = new HashMap<String, Object>(resultsSize);
+ contentMDResults = new HashMap<>(resultsSize);
for (int i = 0; i < resultsSize; i++) {
String path = is.readUTF();
int numEntrySigners = is.readInt();
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/TrustEngineListener.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/TrustEngineListener.java
index 565454f5e..5f662858a 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/TrustEngineListener.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/signedcontent/TrustEngineListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2007, 2016 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -54,8 +54,8 @@ public class TrustEngineListener {
// find any signed content that has signerinfos with the supplied anchor
// re-evaluate trust and check authorization again.
Bundle[] bundles = context.getBundles();
- Set<Bundle> usingAnchor = new HashSet<Bundle>();
- Set<SignerInfo> untrustedSigners = new HashSet<SignerInfo>();
+ Set<Bundle> usingAnchor = new HashSet<>();
+ Set<SignerInfo> untrustedSigners = new HashSet<>();
for (int i = 0; i < bundles.length; i++) {
SignedContentImpl signedContent = getSignedContent(bundles[i]);
if (signedContent != null && signedContent.isSigned()) {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/ContentHandlerFactoryImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/ContentHandlerFactoryImpl.java
index ba234761d..f83b6008c 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/ContentHandlerFactoryImpl.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/ContentHandlerFactoryImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2012 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -46,10 +46,10 @@ public class ContentHandlerFactoryImpl extends MultiplexingFactory implements ja
public ContentHandlerFactoryImpl(BundleContext context, EquinoxContainer container) {
super(context, container);
- proxies = new Hashtable<String, ContentHandlerProxy>(5);
+ proxies = new Hashtable<>(5);
//We need to track content handler registrations
- contentHandlerTracker = new ServiceTracker<ContentHandler, ContentHandler>(context, contentHandlerClazz, null);
+ contentHandlerTracker = new ServiceTracker<>(context, contentHandlerClazz, null);
contentHandlerTracker.open();
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/ContentHandlerProxy.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/ContentHandlerProxy.java
index f3b000242..e63855d14 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/ContentHandlerProxy.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/ContentHandlerProxy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2015 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -48,7 +48,7 @@ public class ContentHandlerProxy extends ContentHandler implements ServiceTracke
// until a real ContentHandler for this mime-type is registered
setNewHandler(reference, getRank(reference));
- contentHandlerServiceTracker = new ServiceTracker<ContentHandler, ServiceReference<ContentHandler>>(context, ContentHandler.class.getName(), this);
+ contentHandlerServiceTracker = new ServiceTracker<>(context, ContentHandler.class.getName(), this);
URLStreamHandlerFactoryImpl.secureAction.open(contentHandlerServiceTracker);
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/MultiplexingFactory.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/MultiplexingFactory.java
index 3ec5d5afa..edccf78a3 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/MultiplexingFactory.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/MultiplexingFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Cognos Incorporated, IBM Corporation and others.
+ * Copyright (c) 2006, 2016 Cognos Incorporated, IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -151,19 +151,19 @@ public abstract class MultiplexingFactory {
if (factories == null)
return null;
- List<Object> released = new LinkedList<Object>(factories);
+ List<Object> released = new LinkedList<>(factories);
factories = null;
return released;
}
private synchronized void addFactory(Object factory) {
- List<Object> updated = (factories == null) ? new LinkedList<Object>() : new LinkedList<Object>(factories);
+ List<Object> updated = (factories == null) ? new LinkedList<>() : new LinkedList<>(factories);
updated.add(factory);
factories = updated;
}
private synchronized void removeFactory(Object factory) {
- List<Object> updated = new LinkedList<Object>(factories);
+ List<Object> updated = new LinkedList<>(factories);
updated.remove(factory);
factories = updated.isEmpty() ? null : updated;
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/URLStreamHandlerFactoryImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/URLStreamHandlerFactoryImpl.java
index 0c496a472..fcf6ce6ed 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/URLStreamHandlerFactoryImpl.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/URLStreamHandlerFactoryImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2013 IBM Corporation and others.
+ * Copyright (c) 2004, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -42,7 +42,7 @@ public class URLStreamHandlerFactoryImpl extends MultiplexingFactory implements
private static final List<Class<?>> ignoredClasses = Arrays.asList(new Class<?>[] {MultiplexingURLStreamHandler.class, URLStreamHandlerFactoryImpl.class, URL.class});
private Map<String, URLStreamHandler> proxies;
private URLStreamHandlerFactory parentFactory;
- private ThreadLocal<List<String>> creatingProtocols = new ThreadLocal<List<String>>();
+ private ThreadLocal<List<String>> creatingProtocols = new ThreadLocal<>();
/**
* Create the factory.
@@ -52,8 +52,8 @@ public class URLStreamHandlerFactoryImpl extends MultiplexingFactory implements
public URLStreamHandlerFactoryImpl(BundleContext context, EquinoxContainer container) {
super(context, container);
- proxies = new Hashtable<String, URLStreamHandler>(15);
- handlerTracker = new ServiceTracker<URLStreamHandlerService, URLStreamHandlerService>(context, URLSTREAMHANDLERCLASS, null);
+ proxies = new Hashtable<>(15);
+ handlerTracker = new ServiceTracker<>(context, URLSTREAMHANDLERCLASS, null);
handlerTracker.open();
}
@@ -119,7 +119,7 @@ public class URLStreamHandlerFactoryImpl extends MultiplexingFactory implements
private boolean isRecursive(String protocol) {
List<String> protocols = creatingProtocols.get();
if (protocols == null) {
- protocols = new ArrayList<String>(1);
+ protocols = new ArrayList<>(1);
creatingProtocols.set(protocols);
}
if (protocols.contains(protocol))
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/URLStreamHandlerProxy.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/URLStreamHandlerProxy.java
index c4295534c..85c904771 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/URLStreamHandlerProxy.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/url/URLStreamHandlerProxy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2015 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -55,7 +55,7 @@ public class URLStreamHandlerProxy extends URLStreamHandler implements ServiceTr
//set the handler and ranking
setNewHandler(reference, getRank(reference));
- urlStreamHandlerServiceTracker = new ServiceTracker<URLStreamHandlerService, ServiceReference<URLStreamHandlerService>>(context, URLStreamHandlerFactoryImpl.URLSTREAMHANDLERCLASS, this);
+ urlStreamHandlerServiceTracker = new ServiceTracker<>(context, URLStreamHandlerFactoryImpl.URLSTREAMHANDLERCLASS, this);
URLStreamHandlerFactoryImpl.secureAction.open(urlStreamHandlerServiceTracker);
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/weaving/DynamicImportList.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/weaving/DynamicImportList.java
index 7c6f4f070..2a22840c4 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/weaving/DynamicImportList.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/weaving/DynamicImportList.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2013 IBM Corporation and others.
+ * Copyright (c) 2010, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -22,7 +22,7 @@ import org.osgi.framework.PackagePermission;
*/
public class DynamicImportList extends AbstractList<String> implements RandomAccess {
// the collection of valid DynamicImport-Package statments.
- private final List<String> imports = new ArrayList<String>(0);
+ private final List<String> imports = new ArrayList<>(0);
private final WovenClassImpl wovenClass;
public DynamicImportList(WovenClassImpl wovenClass) {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/weaving/WeavingHookConfigurator.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/weaving/WeavingHookConfigurator.java
index 2030659b9..e37e2670b 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/weaving/WeavingHookConfigurator.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/weaving/WeavingHookConfigurator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 IBM Corporation and others.
+ * Copyright (c) 2010, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,7 +25,7 @@ public class WeavingHookConfigurator extends ClassLoaderHook {
// holds the map of black listed hooks. Use weak map to avoid pinning and simplify cleanup.
private final Map<ServiceRegistration<?>, Boolean> blackList = Collections.synchronizedMap(new WeakHashMap<ServiceRegistration<?>, Boolean>());
// holds the stack of WovenClass objects currently being used to define classes
- private final ThreadLocal<List<WovenClassImpl>> wovenClassStack = new ThreadLocal<List<WovenClassImpl>>();
+ private final ThreadLocal<List<WovenClassImpl>> wovenClassStack = new ThreadLocal<>();
private final EquinoxContainer container;
@@ -47,7 +47,7 @@ public class WeavingHookConfigurator extends ClassLoaderHook {
WovenClassImpl wovenClass = new WovenClassImpl(name, classbytes, entry, classpathEntry, loader, container, blackList);
List<WovenClassImpl> wovenClasses = wovenClassStack.get();
if (wovenClasses == null) {
- wovenClasses = new ArrayList<WovenClassImpl>(6);
+ wovenClasses = new ArrayList<>(6);
wovenClassStack.set(wovenClasses);
}
wovenClasses.add(wovenClass);
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/BundleInfo.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/BundleInfo.java
index cab25c713..9a569bfbf 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/BundleInfo.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/BundleInfo.java
@@ -103,7 +103,7 @@ public final class BundleInfo {
if (rawHeaders == null) {
BundleEntry manifest = getBundleFile().getEntry(OSGI_BUNDLE_MANIFEST);
if (manifest == null) {
- rawHeaders = new Headers<String, String>(0);
+ rawHeaders = new Headers<>(0);
rawHeaders.setReadOnly();
} else {
try {
@@ -393,7 +393,7 @@ public final class BundleInfo {
Generation createGeneration() throws BundleException {
synchronized (this.infoMonitor) {
if (generationLocks == null) {
- generationLocks = new LockSet<Long>();
+ generationLocks = new LockSet<>();
}
boolean lockedID;
try {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/FrameworkExtensionInstaller.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/FrameworkExtensionInstaller.java
index c7db7fe8f..794fa5c62 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/FrameworkExtensionInstaller.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/FrameworkExtensionInstaller.java
@@ -34,7 +34,7 @@ import org.osgi.resource.Capability;
public class FrameworkExtensionInstaller {
private static final ClassLoader CL = FrameworkExtensionInstaller.class.getClassLoader();
private static final Method ADD_FWK_URL_METHOD = findAddURLMethod(CL, "addURL"); //$NON-NLS-1$
- private final ArrayMap<BundleActivator, Bundle> hookActivators = new ArrayMap<BundleActivator, Bundle>(5);
+ private final ArrayMap<BundleActivator, Bundle> hookActivators = new ArrayMap<>(5);
private static Method findAddURLMethod(ClassLoader cl, String name) {
if (cl == null)
@@ -143,7 +143,7 @@ public class FrameworkExtensionInstaller {
@SuppressWarnings("unchecked")
List<String> paths = metaDatas.isEmpty() ? null : (List<String>) metaDatas.get(0).getAttributes().get(EquinoxModuleDataNamespace.CAPABILITY_CLASSPATH);
if (paths == null) {
- paths = new ArrayList<String>(1);
+ paths = new ArrayList<>(1);
paths.add("."); //$NON-NLS-1$
}
if (configuration.inDevelopmentMode()) {
@@ -152,7 +152,7 @@ public class FrameworkExtensionInstaller {
paths.add(devPath);
}
}
- List<File> results = new ArrayList<File>(paths.size());
+ List<File> results = new ArrayList<>(paths.size());
for (String path : paths) {
if (".".equals(path)) { //$NON-NLS-1$
results.add(((Generation) revision.getRevisionInfo()).getBundleFile().getBaseFile());
@@ -193,7 +193,7 @@ public class FrameworkExtensionInstaller {
public void stopExtensionActivators(BundleContext context) {
ArrayMap<BundleActivator, Bundle> current;
synchronized (hookActivators) {
- current = new ArrayMap<BundleActivator, Bundle>(hookActivators.getKeys(), hookActivators.getValues());
+ current = new ArrayMap<>(hookActivators.getKeys(), hookActivators.getValues());
hookActivators.clear();
}
for (BundleActivator activator : current) {
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/ManifestLocalization.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/ManifestLocalization.java
index 8f20d1756..a67ec5309 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/ManifestLocalization.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/ManifestLocalization.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2015 IBM Corporation and others.
+ * Copyright (c) 2004, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -29,7 +29,7 @@ public class ManifestLocalization {
private final Generation generation;
private final Dictionary<String, String> rawHeaders;
private volatile Dictionary<String, String> defaultLocaleHeaders = null;
- private final Hashtable<String, BundleResourceBundle> cache = new Hashtable<String, BundleResourceBundle>(5);
+ private final Hashtable<String, BundleResourceBundle> cache = new Hashtable<>(5);
public ManifestLocalization(Generation generation, Dictionary<String, String> rawHeaders, String defaultRoot) {
this.generation = generation;
@@ -62,7 +62,7 @@ public class ManifestLocalization {
}
ResourceBundle localeProperties = getResourceBundle(localeString, isDefaultLocale);
Enumeration<String> eKeys = this.rawHeaders.keys();
- Headers<String, String> localeHeaders = new Headers<String, String>(this.rawHeaders.size());
+ Headers<String, String> localeHeaders = new Headers<>(this.rawHeaders.size());
while (eKeys.hasMoreElements()) {
String key = eKeys.nextElement();
String value = this.rawHeaders.get(key);
@@ -84,7 +84,7 @@ public class ManifestLocalization {
}
private String[] buildNLVariants(String nl) {
- List<String> result = new ArrayList<String>();
+ List<String> result = new ArrayList<>();
while (nl.length() > 0) {
result.add(nl);
int i = nl.lastIndexOf('_');
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/NativeCodeFinder.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/NativeCodeFinder.java
index 13a495116..729f83cf7 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/NativeCodeFinder.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/NativeCodeFinder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2012 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -32,7 +32,7 @@ public class NativeCodeFinder {
private final Generation generation;
private final Debug debug;
// This is only used to keep track of when the same native library is loaded more than once
- private final Collection<String> loadedNativeCode = new ArrayList<String>(1);
+ private final Collection<String> loadedNativeCode = new ArrayList<>(1);
public NativeCodeFinder(Generation generation) {
this.generation = generation;
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/PermissionData.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/PermissionData.java
index a7f29d1dd..e74561447 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/PermissionData.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/PermissionData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2012 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,7 +23,7 @@ import java.util.*;
*/
public class PermissionData {
private static final int PERMDATA_VERSION = 1;
- private final Map<String, String[]> locations = new HashMap<String, String[]>();
+ private final Map<String, String[]> locations = new HashMap<>();
private String[] defaultInfos;
private String[] condPermInfos;
private boolean dirty;
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java
index b4e3051d5..0bcbfdd7f 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java
@@ -78,7 +78,7 @@ public class Storage {
private final ModuleContainer moduleContainer;
private final Object saveMonitor = new Object();
private long lastSavedTimestamp = -1;
- private final LockSet<Long> idLocks = new LockSet<Long>();
+ private final LockSet<Long> idLocks = new LockSet<>();
private final MRUBundleFileList mruList;
private final FrameworkExtensionInstaller extensionInstaller;
private final List<String> cachedHeaderKeys = Arrays.asList(Constants.BUNDLE_SYMBOLICNAME, Constants.BUNDLE_ACTIVATIONPOLICY, "Service-Component"); //$NON-NLS-1$
@@ -140,7 +140,7 @@ public class Storage {
generations = loadGenerations(data);
} catch (IllegalArgumentException e) {
equinoxContainer.getLogServices().log(EquinoxContainer.NAME, FrameworkLogEntry.WARNING, "The persistent format for the framework data has changed. The framework will be reinitialized: " + e.getMessage(), null); //$NON-NLS-1$
- generations = new HashMap<Long, Generation>(0);
+ generations = new HashMap<>(0);
data = null;
cleanOSGiStorage(osgiLocation, childRoot);
}
@@ -192,7 +192,7 @@ public class Storage {
if (systemWiring == null) {
return;
}
- Collection<ModuleRevision> fragments = new ArrayList<ModuleRevision>();
+ Collection<ModuleRevision> fragments = new ArrayList<>();
for (ModuleWire hostWire : systemWiring.getProvidedModuleWires(HostNamespace.HOST_NAMESPACE)) {
fragments.add(hostWire.getRequirer());
}
@@ -212,7 +212,7 @@ public class Storage {
}
private void discardBundlesOnLoad() throws BundleException {
- Collection<Module> discarded = new ArrayList<Module>(0);
+ Collection<Module> discarded = new ArrayList<>(0);
for (Module module : moduleContainer.getModules()) {
if (module.getId() == Constants.SYSTEM_BUNDLE_ID)
continue;
@@ -585,8 +585,8 @@ public class Storage {
if (generation.getBundleInfo().getBundleId() == 0) {
return; // ignore system bundle
}
- List<StorageHookFactory<?, ?, ?>> factories = new ArrayList<StorageHookFactory<?, ?, ?>>(getConfiguration().getHookRegistry().getStorageHookFactories());
- List<StorageHook<?, ?>> hooks = new ArrayList<StorageHook<?, ?>>(factories.size());
+ List<StorageHookFactory<?, ?, ?>> factories = new ArrayList<>(getConfiguration().getHookRegistry().getStorageHookFactories());
+ List<StorageHook<?, ?>> hooks = new ArrayList<>(factories.size());
for (Iterator<StorageHookFactory<?, ?, ?>> iFactories = factories.iterator(); iFactories.hasNext();) {
@SuppressWarnings("unchecked")
StorageHookFactory<Object, Object, StorageHook<Object, Object>> next = (StorageHookFactory<Object, Object, StorageHook<Object, Object>>) iFactories.next();
@@ -607,7 +607,7 @@ public class Storage {
Map<String, String> unchecked = (Map<String, String>) headers;
mapHeaders = unchecked;
} else {
- mapHeaders = new HashMap<String, String>();
+ mapHeaders = new HashMap<>();
for (Enumeration<String> eKeys = headers.keys(); eKeys.hasMoreElements();) {
String key = eKeys.nextElement();
mapHeaders.put(key, headers.get(key));
@@ -912,7 +912,7 @@ public class Storage {
if (commandProp == null)
return;
String[] temp = ManifestElement.getArrayFromList(commandProp, " "); //$NON-NLS-1$
- List<String> command = new ArrayList<String>(temp.length + 1);
+ List<String> command = new ArrayList<>(temp.length + 1);
boolean foundFullPath = false;
for (int i = 0; i < temp.length; i++) {
if ("[fullpath]".equals(temp[i]) || "${abspath}".equals(temp[i])) { //$NON-NLS-1$ //$NON-NLS-2$
@@ -1098,7 +1098,7 @@ public class Storage {
private void saveGenerations(DataOutputStream out) throws IOException {
List<Module> modules = moduleContainer.getModules();
- List<Generation> generations = new ArrayList<Generation>();
+ List<Generation> generations = new ArrayList<>();
for (Module module : modules) {
ModuleRevision revision = module.getCurrentRevision();
if (revision != null) {
@@ -1183,21 +1183,21 @@ public class Storage {
private Map<Long, Generation> loadGenerations(DataInputStream in) throws IOException {
if (in == null) {
- return new HashMap<Long, Generation>(0);
+ return new HashMap<>(0);
}
int version = in.readInt();
if (version != VERSION) {
throw new IllegalArgumentException("Found persistent version \"" + version + "\" expecting \"" + VERSION + "\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
int numCachedHeaders = in.readInt();
- List<String> storedCachedHeaderKeys = new ArrayList<String>(numCachedHeaders);
+ List<String> storedCachedHeaderKeys = new ArrayList<>(numCachedHeaders);
for (int i = 0; i < numCachedHeaders; i++) {
storedCachedHeaderKeys.add(ObjectPool.intern(in.readUTF()));
}
int numInfos = in.readInt();
- Map<Long, Generation> result = new HashMap<Long, Generation>(numInfos);
- List<Generation> generations = new ArrayList<BundleInfo.Generation>(numInfos);
+ Map<Long, Generation> result = new HashMap<>(numInfos);
+ List<Generation> generations = new ArrayList<>(numInfos);
for (int i = 0; i < numInfos; i++) {
long infoId = in.readLong();
String infoLocation = ObjectPool.intern(in.readUTF());
@@ -1209,7 +1209,7 @@ public class Storage {
String contentPath = in.readUTF();
long lastModified = in.readLong();
- Map<String, String> cachedHeaders = new HashMap<String, String>(storedCachedHeaderKeys.size());
+ Map<String, String> cachedHeaders = new HashMap<>(storedCachedHeaderKeys.size());
for (String headerKey : storedCachedHeaderKeys) {
String value = in.readUTF();
if (NUL.equals(value)) {
@@ -1250,8 +1250,8 @@ public class Storage {
}
private void loadStorageHookData(List<Generation> generations, DataInputStream in) throws IOException {
- List<StorageHookFactory<?, ?, ?>> factories = new ArrayList<StorageHookFactory<?, ?, ?>>(getConfiguration().getHookRegistry().getStorageHookFactories());
- Map<Generation, List<StorageHook<?, ?>>> hookMap = new HashMap<Generation, List<StorageHook<?, ?>>>();
+ List<StorageHookFactory<?, ?, ?>> factories = new ArrayList<>(getConfiguration().getHookRegistry().getStorageHookFactories());
+ Map<Generation, List<StorageHook<?, ?>>> hookMap = new HashMap<>();
int numFactories = in.readInt();
for (int i = 0; i < numFactories; i++) {
String factoryName = in.readUTF();
@@ -1327,7 +1327,7 @@ public class Storage {
private static List<StorageHook<?, ?>> getHooks(Map<Generation, List<StorageHook<?, ?>>> hookMap, Generation generation) {
List<StorageHook<?, ?>> result = hookMap.get(generation);
if (result == null) {
- result = new ArrayList<StorageHook<?, ?>>();
+ result = new ArrayList<>();
hookMap.put(generation, result);
}
return result;
@@ -1544,7 +1544,7 @@ public class Storage {
}
public static Enumeration<URL> findEntries(List<Generation> generations, String path, String filePattern, int options) {
- List<BundleFile> bundleFiles = new ArrayList<BundleFile>(generations.size());
+ List<BundleFile> bundleFiles = new ArrayList<>(generations.size());
for (Generation generation : generations)
bundleFiles.add(generation.getBundleFile());
// search all the bundle files
@@ -1611,7 +1611,7 @@ public class Storage {
public static List<String> listEntryPaths(List<BundleFile> bundleFiles, String path, String filePattern, int options) {
// Use LinkedHashSet for optimized performance of contains() plus
// ordering guarantees.
- LinkedHashSet<String> pathList = new LinkedHashSet<String>();
+ LinkedHashSet<String> pathList = new LinkedHashSet<>();
Filter patternFilter = null;
Hashtable<String, String> patternProps = null;
if (filePattern != null) {
@@ -1626,26 +1626,26 @@ public class Storage {
if (bundleFile.getEntry(path) != null && !pathList.contains(path))
pathList.add(path);
}
- return new ArrayList<String>(pathList);
+ return new ArrayList<>(pathList);
}
// For when the file pattern includes a wildcard.
try {
// create a file pattern filter with 'filename' as the key
patternFilter = FilterImpl.newInstance("(filename=" + sanitizeFilterInput(filePattern) + ")"); //$NON-NLS-1$ //$NON-NLS-2$
// create a single hashtable to be shared during the recursive search
- patternProps = new Hashtable<String, String>(2);
+ patternProps = new Hashtable<>(2);
} catch (InvalidSyntaxException e) {
// TODO something unexpected happened; log error and return nothing
// Bundle b = context == null ? null : context.getBundle();
// eventPublisher.publishFrameworkEvent(FrameworkEvent.ERROR, b, e);
- return new ArrayList<String>(pathList);
+ return new ArrayList<>(pathList);
}
}
// find the entry paths for the datas
for (BundleFile bundleFile : bundleFiles) {
listEntryPaths(bundleFile, path, patternFilter, patternProps, options, pathList);
}
- return new ArrayList<String>(pathList);
+ return new ArrayList<>(pathList);
}
public static String sanitizeFilterInput(String filePattern) throws InvalidSyntaxException {
@@ -1692,7 +1692,7 @@ public class Storage {
// guarantees.
private static LinkedHashSet<String> listEntryPaths(BundleFile bundleFile, String path, Filter patternFilter, Hashtable<String, String> patternProps, int options, LinkedHashSet<String> pathList) {
if (pathList == null)
- pathList = new LinkedHashSet<String>();
+ pathList = new LinkedHashSet<>();
Enumeration<String> entryPaths;
if ((options & BundleWiring.FINDENTRIES_RECURSE) != 0)
entryPaths = bundleFile.getEntryPaths(path, true);
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/StorageUtil.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/StorageUtil.java
index 8277e8fa5..d8b74b01b 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/StorageUtil.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/StorageUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2013 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -151,7 +151,7 @@ public class StorageUtil {
* @return the service registration object
*/
public static ServiceRegistration<?> register(String name, Object service, BundleContext context) {
- Dictionary<String, Object> properties = new Hashtable<String, Object>(7);
+ Dictionary<String, Object> properties = new Hashtable<>(7);
Dictionary<String, String> headers = context.getBundle().getHeaders();
properties.put(Constants.SERVICE_VENDOR, headers.get(Constants.BUNDLE_VENDOR));
properties.put(Constants.SERVICE_RANKING, Integer.valueOf(Integer.MAX_VALUE));
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/DirBundleFile.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/DirBundleFile.java
index d3243b517..dec2b4cd4 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/DirBundleFile.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/DirBundleFile.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2013 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -125,7 +125,7 @@ public class DirBundleFile extends BundleFile {
return null;
String dirPath = path.length() == 0 || path.charAt(path.length() - 1) == '/' ? path : path + '/';
- LinkedHashSet<String> entries = new LinkedHashSet<String>();
+ LinkedHashSet<String> entries = new LinkedHashSet<>();
for (String s : fileList) {
java.io.File childFile = new java.io.File(pathFile, s);
StringBuilder sb = new StringBuilder(dirPath).append(s);
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/MRUBundleFileList.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/MRUBundleFileList.java
index 06885d5e9..acdcf4fdc 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/MRUBundleFileList.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/MRUBundleFileList.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2013 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,7 +23,7 @@ import org.eclipse.osgi.framework.eventmgr.*;
*/
public class MRUBundleFileList implements EventDispatcher<Object, Object, BundleFile> {
private static final int MIN = 10;
- private static final ThreadLocal<BundleFile> closingBundleFile = new ThreadLocal<BundleFile>();
+ private static final ThreadLocal<BundleFile> closingBundleFile = new ThreadLocal<>();
// list of open bundle files
final private BundleFile[] bundleFileList;
@@ -46,7 +46,7 @@ public class MRUBundleFileList implements EventDispatcher<Object, Object, Bundle
if (fileLimit >= MIN) {
this.bundleFileList = new BundleFile[fileLimit];
this.useStampList = new long[fileLimit];
- this.bundleFileCloser = new CopyOnWriteIdentityMap<Object, Object>();
+ this.bundleFileCloser = new CopyOnWriteIdentityMap<>();
this.bundleFileCloser.put(this, this);
} else {
this.bundleFileList = null;
@@ -181,7 +181,7 @@ public class MRUBundleFileList implements EventDispatcher<Object, Object, Bundle
return;
try {
/* queue to hold set of listeners */
- ListenerQueue<Object, Object, BundleFile> queue = new ListenerQueue<Object, Object, BundleFile>(manager);
+ ListenerQueue<Object, Object, BundleFile> queue = new ListenerQueue<>(manager);
/* add bundle file closer to the queue */
queue.queueListeners(bundleFileCloser.entrySet(), this);
/* dispatch event to set of listeners */
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/ZipBundleFile.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/ZipBundleFile.java
index 2f7816065..dfbea86ff 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/ZipBundleFile.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/bundlefile/ZipBundleFile.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2014 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -268,7 +268,7 @@ public class ZipBundleFile extends BundleFile {
if (path.length() > 0 && path.charAt(path.length() - 1) != '/')
path = new StringBuilder(path).append("/").toString(); //$NON-NLS-1$
- LinkedHashSet<String> result = new LinkedHashSet<String>();
+ LinkedHashSet<String> result = new LinkedHashSet<>();
// Get all zip file entries and add the ones of interest.
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/CopyOnWriteIdentityMap.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/CopyOnWriteIdentityMap.java
index 9b575fc25..4564f32db 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/CopyOnWriteIdentityMap.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/CopyOnWriteIdentityMap.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -84,7 +84,7 @@ public class CopyOnWriteIdentityMap<K, V> implements Map<K, V> {
@SuppressWarnings("unchecked")
Entry<K, V>[] newEntries = new Entry[size];
System.arraycopy(entries, 0, newEntries, 0, size);
- newEntries[i] = new Entry<K, V>(key, value);
+ newEntries[i] = new Entry<>(key, value);
entries = newEntries;
return v;
}
@@ -95,7 +95,7 @@ public class CopyOnWriteIdentityMap<K, V> implements Map<K, V> {
if (size > 0) {
System.arraycopy(entries, 0, newEntries, 0, size);
}
- newEntries[size] = new Entry<K, V>(key, value);
+ newEntries[size] = new Entry<>(key, value);
entries = newEntries;
return null;
}
@@ -337,7 +337,7 @@ public class CopyOnWriteIdentityMap<K, V> implements Map<K, V> {
* The entries returned by the set cannot be modified.
*/
public Set<Map.Entry<K, V>> entrySet() {
- return new Snapshot<K, V>(entries()).entrySet();
+ return new Snapshot<>(entries()).entrySet();
}
/**
@@ -347,7 +347,7 @@ public class CopyOnWriteIdentityMap<K, V> implements Map<K, V> {
* @return A Set of the key objects in this map
*/
public Set<K> keySet() {
- return new Snapshot<K, V>(entries()).keySet();
+ return new Snapshot<>(entries()).keySet();
}
/**
@@ -357,7 +357,7 @@ public class CopyOnWriteIdentityMap<K, V> implements Map<K, V> {
* @return A Collection of the value objects in this map.
*/
public Collection<V> values() {
- return new Snapshot<K, V>(entries()).values();
+ return new Snapshot<>(entries()).values();
}
/**
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/EventListeners.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/EventListeners.java
index 431e4be94..e40ce2920 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/EventListeners.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/EventListeners.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,7 +26,7 @@ import java.util.Set;
* @noextend This class is not intended to be subclassed by clients.
*/
public class EventListeners<K, V> {
- private final CopyOnWriteIdentityMap<K, V> list = new CopyOnWriteIdentityMap<K, V>();
+ private final CopyOnWriteIdentityMap<K, V> list = new CopyOnWriteIdentityMap<>();
/**
* Creates an empty listener list.
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 9e371ee34..900eaf5aa 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -194,7 +194,7 @@ public class EventManager {
/* if there is no thread, then create a new one */
thread = AccessController.doPrivileged(new PrivilegedAction<EventThread<K, V, E>>() {
public EventThread<K, V, E> run() {
- EventThread<K, V, E> t = new EventThread<K, V, E>(threadGroup, threadName);
+ EventThread<K, V, E> t = new EventThread<>(threadGroup, threadName);
return t;
}
});
@@ -371,7 +371,7 @@ public class EventManager {
throw new IllegalStateException();
}
- Queued<K, V, E> item = new Queued<K, V, E>(l, d, a, o);
+ Queued<K, V, E> item = new Queued<>(l, d, a, o);
if (head == null) /* if the queue was empty */
{
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/ListenerQueue.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/ListenerQueue.java
index 40fbf99d3..7e78bac01 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/ListenerQueue.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/eventmgr/ListenerQueue.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -63,7 +63,7 @@ public class ListenerQueue<K, V, E> {
}
this.manager = manager;
- queue = new CopyOnWriteIdentityMap<Set<Map.Entry<K, V>>, EventDispatcher<K, V, E>>();
+ queue = new CopyOnWriteIdentityMap<>();
readOnly = false;
}
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFile.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFile.java
index f0b0ffb5c..6fd13b2e4 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFile.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/reliablefile/ReliableFile.java
@@ -125,7 +125,7 @@ public class ReliableFile {
private File referenceFile;
/** List of checksum file objects: File => specific ReliableFile generation */
- private static Hashtable<File, CacheInfo> cacheFiles = new Hashtable<File, CacheInfo>(20);
+ private static Hashtable<File, CacheInfo> cacheFiles = new Hashtable<>(20);
private File inputFile = null;
private File outputFile = null;
@@ -192,7 +192,7 @@ public class ReliableFile {
String[] files = parent.list();
if (files == null)
return null;
- List<Integer> list = new ArrayList<Integer>(defaultMaxGenerations);
+ List<Integer> list = new ArrayList<>(defaultMaxGenerations);
if (file.exists())
list.add(Integer.valueOf(0)); //base file exists
for (int i = 0; i < files.length; i++) {
@@ -637,7 +637,7 @@ public class ReliableFile {
if (!directory.isDirectory())
throw new IOException("Not a valid directory"); //$NON-NLS-1$
String files[] = directory.list();
- Set<String> list = new HashSet<String>(files.length / 2);
+ Set<String> list = new HashSet<>(files.length / 2);
for (int idx = 0; idx < files.length; idx++) {
String file = files[idx];
int pos = file.lastIndexOf('.');
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/util/Tokenizer.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/util/Tokenizer.java
index 893e72a44..62c48749d 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/util/Tokenizer.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/internal/util/Tokenizer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2013 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -91,7 +91,7 @@ public class Tokenizer {
}
public List<String> getEscapedTokens(String terminals) {
- List<String> result = new ArrayList<String>();
+ List<String> result = new ArrayList<>();
for (String token = getEscapedToken(terminals); token != null; token = getEscapedToken(terminals)) {
result.add(token);
getChar(); // consume terminal
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/ManifestElement.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/ManifestElement.java
index 10616c3a9..87095cf44 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/ManifestElement.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/ManifestElement.java
@@ -310,7 +310,7 @@ public class ManifestElement {
@SuppressWarnings("unchecked")
private Hashtable<String, Object> addTableValue(Hashtable<String, Object> table, String key, String value) {
if (table == null) {
- table = new Hashtable<String, Object>(7);
+ table = new Hashtable<>(7);
}
Object curValue = table.get(key);
if (curValue != null) {
@@ -319,7 +319,7 @@ public class ManifestElement {
if (curValue instanceof List) {
newList = (List<String>) curValue;
} else {
- newList = new ArrayList<String>(5);
+ newList = new ArrayList<>(5);
newList.add((String) curValue);
}
newList.add(value);
@@ -345,13 +345,13 @@ public class ManifestElement {
public static ManifestElement[] parseHeader(String header, String value) throws BundleException {
if (value == null)
return (null);
- List<ManifestElement> headerElements = new ArrayList<ManifestElement>(10);
+ List<ManifestElement> headerElements = new ArrayList<>(10);
Tokenizer tokenizer = new Tokenizer(value);
parseloop: while (true) {
String next = tokenizer.getString(";,"); //$NON-NLS-1$
if (next == null)
throw new BundleException(NLS.bind(Msg.MANIFEST_INVALID_HEADER_EXCEPTION, header, value), BundleException.MANIFEST_ERROR);
- List<String> headerValues = new ArrayList<String>();
+ List<String> headerValues = new ArrayList<>();
StringBuffer headerValue = new StringBuffer(next);
headerValues.add(next);
@@ -473,7 +473,7 @@ public class ManifestElement {
public static String[] getArrayFromList(String stringList, String separator) {
if (stringList == null || stringList.trim().length() == 0)
return new String[0];
- List<String> list = new ArrayList<String>();
+ List<String> list = new ArrayList<>();
StringTokenizer tokens = new StringTokenizer(stringList, separator);
while (tokens.hasMoreTokens()) {
String token = tokens.nextToken().trim();
@@ -500,7 +500,7 @@ public class ManifestElement {
*/
public static Map<String, String> parseBundleManifest(InputStream manifest, Map<String, String> headers) throws IOException, BundleException {
if (headers == null)
- headers = new HashMap<String, String>();
+ headers = new HashMap<>();
manifest = new BufferedInputStream(manifest);
try {
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 3a454094a..a95afd5e9 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2014 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -247,7 +247,7 @@ public abstract class NLS {
if (nlSuffixes == null) {
//build list of suffixes for loading resource bundles
String nl = Locale.getDefault().toString();
- List<String> result = new ArrayList<String>(4);
+ List<String> result = new ArrayList<>(4);
int lastSeparator;
while (true) {
result.add('_' + nl + EXTENSION);
@@ -309,7 +309,7 @@ public abstract class NLS {
//build a map of field names to Field objects
final int len = fieldArray.length;
- Map<Object, Object> fields = new HashMap<Object, Object>(len * 2);
+ Map<Object, Object> fields = new HashMap<>(len * 2);
for (int i = 0; i < len; i++)
fields.put(fieldArray[i].getName(), fieldArray[i]);

Back to the top