Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2016-09-29 13:27:28 +0000
committerThomas Watson2016-09-29 14:33:27 +0000
commit61d4d356b63091bb27ea0c7be0a6daaf06b74c28 (patch)
tree6fd39d3bb846a8fbfa5d4ea58e0a077f432e0591
parentd200e63587ccac6d7c2d0f506b8f30a2ebe47fe5 (diff)
downloadrt.equinox.framework-61d4d356b63091bb27ea0c7be0a6daaf06b74c28.tar.gz
rt.equinox.framework-61d4d356b63091bb27ea0c7be0a6daaf06b74c28.tar.xz
rt.equinox.framework-61d4d356b63091bb27ea0c7be0a6daaf06b74c28.zip
Bug 502425 - Refactor code for Java 7
Change-Id: I64d3a28a743a0292db27fd421294421dc51eb2e1 Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
-rw-r--r--bundles/org.eclipse.osgi.compatibility.plugins/src/org/eclipse/osgi/compatibility/plugins/PluginConverterImpl.java26
-rw-r--r--bundles/org.eclipse.osgi.compatibility.plugins/src/org/eclipse/osgi/compatibility/plugins/PluginParser.java18
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/PlatformAdminImpl.java4
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/PlatformBundleListener.java6
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/StateConverter.java20
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/module/GroupingChecker.java20
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/module/MappedList.java8
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/module/ResolverBundle.java36
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/module/ResolverImpl.java150
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/BaseDescriptionImpl.java4
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java38
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/BundleSpecificationImpl.java4
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/ExportPackageDescriptionImpl.java8
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/GenericDescriptionImpl.java8
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/GenericSpecificationImpl.java6
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/HostSpecificationImpl.java4
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/ImportPackageSpecificationImpl.java6
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateBuilder.java46
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateDeltaImpl.java6
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.java52
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateImpl.java50
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateObjectFactoryImpl.java14
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateReader.java23
-rw-r--r--bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateWriter.java8
-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
124 files changed, 879 insertions, 891 deletions
diff --git a/bundles/org.eclipse.osgi.compatibility.plugins/src/org/eclipse/osgi/compatibility/plugins/PluginConverterImpl.java b/bundles/org.eclipse.osgi.compatibility.plugins/src/org/eclipse/osgi/compatibility/plugins/PluginConverterImpl.java
index 26744fbd9..7bba1320d 100644
--- a/bundles/org.eclipse.osgi.compatibility.plugins/src/org/eclipse/osgi/compatibility/plugins/PluginConverterImpl.java
+++ b/bundles/org.eclipse.osgi.compatibility.plugins/src/org/eclipse/osgi/compatibility/plugins/PluginConverterImpl.java
@@ -127,7 +127,7 @@ public class PluginConverterImpl implements PluginConverter {
pluginInfo = null;
pluginManifestLocation = null;
pluginZip = null;
- generatedManifest = new Hashtable<String, String>(10);
+ generatedManifest = new Hashtable<>(10);
manifestType = MANIFEST_TYPE_UNKNOWN;
target = null;
devProperties = null;
@@ -165,7 +165,7 @@ public class PluginConverterImpl implements PluginConverter {
private Set<String> filterExport(Set<String> exportToFilter, Collection<String> filter) {
if (filter == null || filter.contains("*")) //$NON-NLS-1$
return exportToFilter;
- Set<String> filteredExport = new HashSet<String>(exportToFilter.size());
+ Set<String> filteredExport = new HashSet<>(exportToFilter.size());
for (String anExport : exportToFilter) {
for (String aFilter : filter) {
int dotStar = aFilter.indexOf(".*"); //$NON-NLS-1$
@@ -182,7 +182,7 @@ public class PluginConverterImpl implements PluginConverter {
private List<String> findOSJars(File pluginRoot, String path, boolean filter) {
path = path.substring(4);
- List<String> found = new ArrayList<String>(0);
+ List<String> found = new ArrayList<>(0);
for (int i = 0; i < OS_LIST.length; i++) {
//look for os/osname/path
String searchedPath = "os/" + OS_LIST[i] + "/" + path; //$NON-NLS-1$ //$NON-NLS-2$
@@ -246,7 +246,7 @@ public class PluginConverterImpl implements PluginConverter {
private List<String> findWSJars(File pluginRoot, String path, boolean filter) {
path = path.substring(4);
- List<String> found = new ArrayList<String>(0);
+ List<String> found = new ArrayList<>(0);
for (int i = 0; i < WS_LIST.length; i++) {
String searchedPath = "ws/" + WS_LIST[i] + path; //$NON-NLS-1$
if (new File(pluginRoot, searchedPath).exists()) {
@@ -275,7 +275,7 @@ public class PluginConverterImpl implements PluginConverter {
private <K, V> Map<K, V> convertDictionaryToMap(Dictionary<K, V> dictionary) {
if (dictionary == null)
return Collections.emptyMap();
- Map<K, V> result = new HashMap<K, V>(dictionary.size());
+ Map<K, V> result = new HashMap<>(dictionary.size());
Enumeration<K> keys = dictionary.keys();
while (keys.hasMoreElements()) {
K key = keys.nextElement();
@@ -295,7 +295,7 @@ public class PluginConverterImpl implements PluginConverter {
throw new PluginConversionException(message);
}
// replaces any eventual existing file
- manifestToWrite = new Hashtable<String, String>(convertDictionaryToMap(manifestToWrite));
+ manifestToWrite = new Hashtable<>(convertDictionaryToMap(manifestToWrite));
// MANIFEST.MF files must be written using UTF-8
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(generationLocation), UTF_8));
writeEntry(MANIFEST_VERSION, manifestToWrite.remove(MANIFEST_VERSION));
@@ -473,7 +473,7 @@ public class PluginConverterImpl implements PluginConverter {
if (devProperties != null || configuration.inDevelopmentMode()) {
String[] devClassPath = configuration.getDevClassPath(pluginInfo.getUniqueId(), devProperties);
// collect export clauses
- List<String> allExportClauses = new ArrayList<String>(libs.size());
+ List<String> allExportClauses = new ArrayList<>(libs.size());
Set<Map.Entry<String, List<String>>> libEntries = libs.entrySet();
for (Iterator<Map.Entry<String, List<String>>> iter = libEntries.iterator(); iter.hasNext();) {
Map.Entry<String, List<String>> element = iter.next();
@@ -491,7 +491,7 @@ public class PluginConverterImpl implements PluginConverter {
}
}
- Set<String> result = new TreeSet<String>();
+ Set<String> result = new TreeSet<>();
Set<Map.Entry<String, List<String>>> libEntries = libs.entrySet();
for (Iterator<Map.Entry<String, List<String>>> iter = libEntries.iterator(); iter.hasNext();) {
Map.Entry<String, List<String>> element = iter.next();
@@ -515,7 +515,7 @@ public class PluginConverterImpl implements PluginConverter {
exports = filterExport(getExportsFromDir(libraryLocation), filter);
} else {
List<String> expandedLibs = getLibrariesExpandingVariables(element.getKey(), false);
- exports = new HashSet<String>();
+ exports = new HashSet<>();
for (Iterator<String> iterator = expandedLibs.iterator(); iterator.hasNext();) {
String libName = iterator.next();
File libFile = new File(pluginManifestLocation, libName);
@@ -537,7 +537,7 @@ public class PluginConverterImpl implements PluginConverter {
private Set<String> getExportsFromDir(File location, String packageName) {
String prefix = (packageName.length() > 0) ? (packageName + '.') : ""; //$NON-NLS-1$
String[] files = location.list();
- Set<String> exportedPaths = new HashSet<String>();
+ Set<String> exportedPaths = new HashSet<>();
boolean containsFile = false;
if (files != null)
for (int i = 0; i < files.length; i++) {
@@ -560,7 +560,7 @@ public class PluginConverterImpl implements PluginConverter {
}
private Set<String> getExportsFromJAR(File jarFile) {
- Set<String> names = new HashSet<String>();
+ Set<String> names = new HashSet<>();
ZipFile file = null;
try {
file = new ZipFile(jarFile);
@@ -597,7 +597,7 @@ public class PluginConverterImpl implements PluginConverter {
private List<String> getLibrariesExpandingVariables(String libraryPath, boolean filter) {
String var = hasPrefix(libraryPath);
if (var == null) {
- List<String> returnValue = new ArrayList<String>(1);
+ List<String> returnValue = new ArrayList<>(1);
returnValue.add(libraryPath);
return returnValue;
}
@@ -607,7 +607,7 @@ public class PluginConverterImpl implements PluginConverter {
if (var.equals("os")) { //$NON-NLS-1$
return findOSJars(pluginManifestLocation, libraryPath, filter);
}
- return new ArrayList<String>(0);
+ return new ArrayList<>(0);
}
//return a String representing the string found between the $s
diff --git a/bundles/org.eclipse.osgi.compatibility.plugins/src/org/eclipse/osgi/compatibility/plugins/PluginParser.java b/bundles/org.eclipse.osgi.compatibility.plugins/src/org/eclipse/osgi/compatibility/plugins/PluginParser.java
index e6cb4d3a5..933114d3b 100644
--- a/bundles/org.eclipse.osgi.compatibility.plugins/src/org/eclipse/osgi/compatibility/plugins/PluginParser.java
+++ b/bundles/org.eclipse.osgi.compatibility.plugins/src/org/eclipse/osgi/compatibility/plugins/PluginParser.java
@@ -70,7 +70,7 @@ public class PluginParser extends DefaultHandler implements IModel {
public Map<String, List<String>> getLibraries() {
if (libraries == null)
- return new HashMap<String, List<String>>(0);
+ return new HashMap<>(0);
return libraries;
}
@@ -78,7 +78,7 @@ public class PluginParser extends DefaultHandler implements IModel {
if (!TARGET21.equals(target) && schemaVersion == null && !requiresExpanded) {
requiresExpanded = true;
if (requires == null) {
- requires = new ArrayList<Prerequisite>(1);
+ requires = new ArrayList<>(1);
requires.add(new Prerequisite(PluginConverterImpl.PI_RUNTIME, TARGET21_STRING, false, false, IModel.PLUGIN_REQUIRES_MATCH_GREATER_OR_EQUAL));
requires.add(new Prerequisite(PluginConverterImpl.PI_RUNTIME_COMPATIBILITY, null, false, false, null));
} else {
@@ -108,7 +108,7 @@ public class PluginParser extends DefaultHandler implements IModel {
}
}
if (requires == null)
- return requires = new ArrayList<Prerequisite>(0);
+ return requires = new ArrayList<>(0);
return requires;
}
@@ -187,10 +187,10 @@ public class PluginParser extends DefaultHandler implements IModel {
}
// Current State Information
- Stack<Integer> stateStack = new Stack<Integer>();
+ Stack<Integer> stateStack = new Stack<>();
// Current object stack (used to hold the current object we are populating in this plugin info
- Stack<Object> objectStack = new Stack<Object>();
+ Stack<Object> objectStack = new Stack<>();
Locator locator = null;
// Valid States
@@ -273,8 +273,8 @@ public class PluginParser extends DefaultHandler implements IModel {
@SuppressWarnings("unchecked")
List<String> exports = (List<String>) objectStack.pop();
if (manifestInfo.libraries == null) {
- manifestInfo.libraries = new HashMap<String, List<String>>(3);
- manifestInfo.libraryPaths = new ArrayList<String>(3);
+ manifestInfo.libraries = new HashMap<>(3);
+ manifestInfo.libraryPaths = new ArrayList<>(3);
}
manifestInfo.libraries.put(curLibrary, exports);
manifestInfo.libraryPaths.add(curLibrary.replace('\\', '/'));
@@ -477,7 +477,7 @@ public class PluginParser extends DefaultHandler implements IModel {
public static SAXParserFactory acquireXMLParsing(BundleContext context) {
if (xmlTracker == null) {
- xmlTracker = new ServiceTracker<SAXParserFactory, SAXParserFactory>(context, "javax.xml.parsers.SAXParserFactory", null); //$NON-NLS-1$
+ xmlTracker = new ServiceTracker<>(context, "javax.xml.parsers.SAXParserFactory", null); //$NON-NLS-1$
xmlTracker.open();
}
SAXParserFactory result = xmlTracker.getService();
@@ -595,7 +595,7 @@ public class PluginParser extends DefaultHandler implements IModel {
public void parsePluginRequiresImport(Attributes attributes) {
if (manifestInfo.requires == null) {
- manifestInfo.requires = new ArrayList<Prerequisite>();
+ manifestInfo.requires = new ArrayList<>();
// to avoid cycles
// if (!manifestInfo.pluginId.equals(PluginConverterImpl.PI_RUNTIME)) //$NON-NLS-1$
// manifestInfo.requires.add(new Prerequisite(PluginConverterImpl.PI_RUNTIME, null, false, false, null)); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/PlatformAdminImpl.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/PlatformAdminImpl.java
index 55ace736b..77113e4f9 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/PlatformAdminImpl.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/PlatformAdminImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 IBM Corporation and others. All rights reserved.
+ * 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 http://www.eclipse.org/legal/epl-v10.html
@@ -103,7 +103,7 @@ public class PlatformAdminImpl implements PlatformAdmin {
}
private Dictionary<String, Object> asDictionary(Map<String, ?> map) {
- return new Hashtable<String, Object>(map);
+ return new Hashtable<>(map);
}
@Override
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/PlatformBundleListener.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/PlatformBundleListener.java
index 361c30b5c..cc6d41936 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/PlatformBundleListener.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/PlatformBundleListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 IBM Corporation and others. All rights reserved.
+ * 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 http://www.eclipse.org/legal/epl-v10.html
@@ -82,7 +82,7 @@ class PlatformBundleListener implements SynchronousBundleListener, FrameworkList
if (lastResolveStamp != database.getRevisionsTimestamp()) {
Collection<ModuleRevision> containerRemovalPending = container.getRemovalPending();
BundleDescription[] stateRemovalPendingDescs = systemState.getRemovalPending();
- Collection<BundleDescription> stateRemovalPending = new ArrayList<BundleDescription>(stateRemovalPendingDescs.length);
+ Collection<BundleDescription> stateRemovalPending = new ArrayList<>(stateRemovalPendingDescs.length);
for (BundleDescription description : stateRemovalPendingDescs) {
if (!containerRemovalPending.contains(description.getUserObject())) {
stateRemovalPending.add(description);
@@ -150,7 +150,7 @@ class PlatformBundleListener implements SynchronousBundleListener, FrameworkList
candidates.clear();
return;
}
- Collection<ModuleWiring> wirings = new ArrayList<ModuleWiring>(1);
+ Collection<ModuleWiring> wirings = new ArrayList<>(1);
if ((reqRevision.getTypes() & BundleRevision.TYPE_FRAGMENT) != 0) {
if (ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE.equals(namespace) || HostNamespace.HOST_NAMESPACE.equals(namespace)) {
wirings.add(reqWiring);
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/StateConverter.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/StateConverter.java
index 56b59211c..afea17e11 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/StateConverter.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/compatibility/state/StateConverter.java
@@ -35,18 +35,18 @@ class StateConverter {
throw new IllegalArgumentException("Bogus osgi.identity: " + idList); //$NON-NLS-1$
} else if (idList.size() == 1) {
Capability id = idList.iterator().next();
- Map<String, Object> idAttrs = new HashMap<String, Object>(id.getAttributes());
+ Map<String, Object> idAttrs = new HashMap<>(id.getAttributes());
String symbolicName = (String) idAttrs.remove(IdentityNamespace.IDENTITY_NAMESPACE);
symbolicNameSpecification = symbolicName + toString(idAttrs, "=", true) + toString(id.getDirectives(), ":=", true); //$NON-NLS-1$ //$NON-NLS-2$
version = (Version) idAttrs.remove(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE);
}
- List<ExportPackageDescription> exportPackages = new ArrayList<ExportPackageDescription>();
- List<GenericDescription> provideCapabilities = new ArrayList<GenericDescription>();
- List<ImportPackageSpecification> importPackages = new ArrayList<ImportPackageSpecification>();
- List<GenericSpecification> requireCapabilities = new ArrayList<GenericSpecification>();
- List<HostSpecification> fragmentHost = new ArrayList<HostSpecification>(0);
- List<BundleSpecification> requireBundles = new ArrayList<BundleSpecification>();
+ List<ExportPackageDescription> exportPackages = new ArrayList<>();
+ List<GenericDescription> provideCapabilities = new ArrayList<>();
+ List<ImportPackageSpecification> importPackages = new ArrayList<>();
+ List<GenericSpecification> requireCapabilities = new ArrayList<>();
+ List<HostSpecification> fragmentHost = new ArrayList<>(0);
+ List<BundleSpecification> requireBundles = new ArrayList<>();
Collection<Capability> capabilities = resource.getCapabilities(null);
@@ -90,7 +90,7 @@ class StateConverter {
}
private List<ExportPackageDescription> creatExportPackage(Capability capability) {
- Map<String, Object> attributes = new HashMap<String, Object>(capability.getAttributes());
+ Map<String, Object> attributes = new HashMap<>(capability.getAttributes());
Map<String, String> directives = capability.getDirectives();
String packageName = (String) attributes.remove(PackageNamespace.PACKAGE_NAMESPACE);
// remove invalid attributes
@@ -144,7 +144,7 @@ class StateConverter {
}
private List<GenericSpecification> createRequireCapability(Requirement requirement) {
- Map<String, String> directives = new HashMap<String, String>(requirement.getDirectives());
+ Map<String, String> directives = new HashMap<>(requirement.getDirectives());
String filter = directives.get(Namespace.REQUIREMENT_FILTER_DIRECTIVE);
if (filter != null) {
directives.put(Namespace.REQUIREMENT_FILTER_DIRECTIVE, escapeFilterInput(filter));
@@ -185,7 +185,7 @@ class StateConverter {
}
private String createOSGiRequirement(Requirement requirement, String namespace, 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.compatibility.state/src/org/eclipse/osgi/internal/module/GroupingChecker.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/module/GroupingChecker.java
index 0acce4bd7..97136b1a2 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/module/GroupingChecker.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/module/GroupingChecker.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2012 IBM Corporation and others. All rights reserved.
+ * 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 http://www.eclipse.org/legal/epl-v10.html
@@ -20,7 +20,7 @@ public class GroupingChecker {
// a mapping of bundles to their package roots; keyed by
// ResolverBundle -> HashMap of packages; keyed by
// package name -> PackageRoots
- private Map<ResolverBundle, Map<String, PackageRoots>> bundles = new HashMap<ResolverBundle, Map<String, PackageRoots>>();
+ private Map<ResolverBundle, Map<String, PackageRoots>> bundles = new HashMap<>();
/*
* This method fully populates a bundles package roots for the purpose of resolving
@@ -108,7 +108,7 @@ public class GroupingChecker {
String[] uses = matchingCapability.getUsesDirective();
if (uses == null)
return null;
- ArrayList<PackageRoots[]> results = new ArrayList<PackageRoots[]>(0);
+ ArrayList<PackageRoots[]> results = new ArrayList<>(0);
for (String usedPackage : uses) {
PackageRoots providingRoots = getPackageRoots(matchingCapability.getResolverBundle(), usedPackage, null);
providingRoots.addConflicts(requiringBundle, usedPackage, null, results);
@@ -167,7 +167,7 @@ public class GroupingChecker {
PackageRoots getPackageRoots(ResolverBundle bundle, String packageName, List<ResolverBundle> visited) {
Map<String, PackageRoots> packages = bundles.get(bundle);
if (packages == null) {
- packages = new HashMap<String, PackageRoots>(5);
+ packages = new HashMap<>(5);
bundles.put(bundle, packages);
}
PackageRoots packageRoots = packages.get(packageName);
@@ -209,7 +209,7 @@ public class GroupingChecker {
}
// check if the bundle exports the package
ResolverExport[] exports = bundle.getExports(packageName);
- List<PackageRoots> roots = new ArrayList<PackageRoots>(0);
+ List<PackageRoots> roots = new ArrayList<>(0);
// check roots from required bundles
BundleConstraint[] requires = bundle.getRequires();
for (int i = 0; i < requires.length; i++) {
@@ -326,7 +326,7 @@ public class GroupingChecker {
if (roots == null)
return results;
if (visited == null)
- visited = new ArrayList<PackageRoots>(1);
+ visited = new ArrayList<>(1);
if (visited.contains(this))
return results;
visited.add(this);
@@ -346,7 +346,7 @@ public class GroupingChecker {
if (thisUsedRoots != nullPackageRoots && importingUsedRoots != nullPackageRoots)
if (!(subSet(thisUsedRoots.roots, importingUsedRoots.roots) || subSet(importingUsedRoots.roots, thisUsedRoots.roots))) {
if (results == null)
- results = new ArrayList<PackageRoots[]>(1);
+ results = new ArrayList<>(1);
results.add(new PackageRoots[] {this, importingUsedRoots});
}
// need to check the usedRoots consistency for transitive closure
@@ -366,7 +366,7 @@ public class GroupingChecker {
if (uses == null)
continue;
if (visited == null)
- visited = new ArrayList<PackageRoots>(1);
+ visited = new ArrayList<>(1);
if (visited.contains(this))
return results;
visited.add(this);
@@ -380,7 +380,7 @@ public class GroupingChecker {
if (thisUsedRoots != nullPackageRoots && exportingUsedRoots != nullPackageRoots)
if (!(subSet(thisUsedRoots.roots, exportingUsedRoots.roots) || subSet(exportingUsedRoots.roots, thisUsedRoots.roots))) {
if (results == null)
- results = new ArrayList<PackageRoots[]>(1);
+ results = new ArrayList<>(1);
results.add(new PackageRoots[] {this, exportingUsedRoots});
}
// need to check the usedRoots consistency for transitive closure
@@ -397,7 +397,7 @@ public class GroupingChecker {
if (this != nullPackageRoots && bundleUsedRoots != nullPackageRoots)
if (!(subSet(this.roots, bundleUsedRoots.roots) || subSet(bundleUsedRoots.roots, this.roots))) {
if (results == null)
- results = new ArrayList<PackageRoots[]>(1);
+ results = new ArrayList<>(1);
results.add(new PackageRoots[] {this, bundleUsedRoots});
}
// need to check the usedRoots consistency for transitive closure
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/module/MappedList.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/module/MappedList.java
index 6c9482788..92880fb2f 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/module/MappedList.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/module/MappedList.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,13 +19,13 @@ import java.util.*;
*/
public class MappedList<K, V> {
// the mapping with key -> Object[] mapping
- protected final HashMap<K, List<V>> internal = new HashMap<K, List<V>>();
+ protected final HashMap<K, List<V>> internal = new HashMap<>();
protected final List<V> empty = Collections.<V> emptyList();
public void put(K key, V value) {
List<V> existing = internal.get(key);
if (existing == null) {
- existing = new ArrayList<V>(1);
+ existing = new ArrayList<>(1);
existing.add(value);
internal.put(key, existing);
return;
@@ -66,7 +66,7 @@ public class MappedList<K, V> {
public List<V> getAllValues() {
if (getSize() == 0)
return empty;
- ArrayList<V> results = new ArrayList<V>(getSize());
+ ArrayList<V> results = new ArrayList<>(getSize());
Iterator<List<V>> iter = internal.values().iterator();
while (iter.hasNext())
results.addAll(iter.next());
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/module/ResolverBundle.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/module/ResolverBundle.java
index 8f16f561d..4502c1992 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/module/ResolverBundle.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/module/ResolverBundle.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
@@ -62,7 +62,7 @@ public class ResolverBundle extends VersionSupplier implements Comparable<Resolv
imports = new ResolverImport[0];
requires = new BundleConstraint[0];
GenericSpecification[] requirements = getBundleDescription().getGenericRequires();
- List<GenericConstraint> constraints = new ArrayList<GenericConstraint>();
+ List<GenericConstraint> constraints = new ArrayList<>();
for (GenericSpecification requirement : requirements) {
if (StateImpl.OSGI_EE_NAMESPACE.equals(requirement.getType()))
constraints.add(new GenericConstraint(this, requirement));
@@ -83,7 +83,7 @@ public class ResolverBundle extends VersionSupplier implements Comparable<Resolv
ImportPackageSpecification[] actualImports = getBundleDescription().getImportPackages();
// Reorder imports so that optionals are at the end so that we wire statics before optionals
- List<ResolverImport> importList = new ArrayList<ResolverImport>(actualImports.length);
+ List<ResolverImport> importList = new ArrayList<>(actualImports.length);
for (int i = actualImports.length - 1; i >= 0; i--)
if (ImportPackageSpecification.RESOLUTION_OPTIONAL.equals(actualImports[i].getDirective(Constants.RESOLUTION_DIRECTIVE)))
importList.add(new ResolverImport(this, actualImports[i]));
@@ -125,7 +125,7 @@ public class ResolverBundle extends VersionSupplier implements Comparable<Resolv
}
ResolverExport[] getExports(String name) {
- List<ResolverExport> results = new ArrayList<ResolverExport>(1); // rare to have more than one
+ List<ResolverExport> results = new ArrayList<>(1); // rare to have more than one
// it is faster to ask the VersionHashMap for this package name and then compare the exporter to this
List<ResolverExport> resolverExports = resolver.getResolverExports().get(name);
for (ResolverExport export : resolverExports)
@@ -172,7 +172,7 @@ public class ResolverBundle extends VersionSupplier implements Comparable<Resolv
}
private <T> List<T> getAll(T[] hostEntries, Map<Long, List<T>> fragmentMap) {
- List<T> result = new ArrayList<T>(hostEntries.length);
+ List<T> result = new ArrayList<>(hostEntries.length);
for (T entry : hostEntries)
result.add(entry);
for (ResolverBundle fragment : fragments) {
@@ -281,17 +281,17 @@ public class ResolverBundle extends VersionSupplier implements Comparable<Resolv
private void initFragments() {
if (fragments == null)
- fragments = new ArrayList<ResolverBundle>(1);
+ fragments = new ArrayList<>(1);
if (fragmentExports == null)
- fragmentExports = new HashMap<Long, List<ResolverExport>>(1);
+ fragmentExports = new HashMap<>(1);
if (fragmentImports == null)
- fragmentImports = new HashMap<Long, List<ResolverImport>>(1);
+ fragmentImports = new HashMap<>(1);
if (fragmentRequires == null)
- fragmentRequires = new HashMap<Long, List<BundleConstraint>>(1);
+ fragmentRequires = new HashMap<>(1);
if (fragmentGenericCapabilities == null)
- fragmentGenericCapabilities = new HashMap<Long, List<GenericCapability>>(1);
+ fragmentGenericCapabilities = new HashMap<>(1);
if (fragmentGenericRequires == null)
- fragmentGenericRequires = new HashMap<Long, List<GenericConstraint>>(1);
+ fragmentGenericRequires = new HashMap<>(1);
}
private boolean isImported(String packageName) {
@@ -342,7 +342,7 @@ public class ResolverBundle extends VersionSupplier implements Comparable<Resolv
fragment.getHost().addPossibleSupplier(this);
if (newImports.length > 0) {
- ArrayList<ResolverImport> hostImports = new ArrayList<ResolverImport>(newImports.length);
+ ArrayList<ResolverImport> hostImports = new ArrayList<>(newImports.length);
for (int i = 0; i < newImports.length; i++)
if (!isImported(newImports[i].getName()))
hostImports.add(new ResolverImport(this, newImports[i]));
@@ -350,7 +350,7 @@ public class ResolverBundle extends VersionSupplier implements Comparable<Resolv
}
if (newRequires.length > 0) {
- ArrayList<BundleConstraint> hostRequires = new ArrayList<BundleConstraint>(newRequires.length);
+ ArrayList<BundleConstraint> hostRequires = new ArrayList<>(newRequires.length);
for (int i = 0; i < newRequires.length; i++)
if (!isRequired(newRequires[i].getName()))
hostRequires.add(new BundleConstraint(this, newRequires[i]));
@@ -358,7 +358,7 @@ public class ResolverBundle extends VersionSupplier implements Comparable<Resolv
}
if (newGenericRequires.length > 0) {
- ArrayList<GenericConstraint> hostGenericRequires = new ArrayList<GenericConstraint>(newGenericRequires.length);
+ ArrayList<GenericConstraint> hostGenericRequires = new ArrayList<>(newGenericRequires.length);
for (int i = 0; i < newGenericRequires.length; i++) {
// only add namespaces that are not osgi.ee
if (!StateImpl.OSGI_EE_NAMESPACE.equals(newGenericRequires[i].getType()))
@@ -368,7 +368,7 @@ public class ResolverBundle extends VersionSupplier implements Comparable<Resolv
fragmentGenericRequires.put(fragment.bundleID, hostGenericRequires);
}
- ArrayList<ResolverExport> hostExports = new ArrayList<ResolverExport>(newExports.length);
+ ArrayList<ResolverExport> hostExports = new ArrayList<>(newExports.length);
if (newExports.length > 0 && dynamicAttach) {
for (int i = 0; i < newExports.length; i++) {
ResolverExport currentExports[] = getExports(newExports[i].getName());
@@ -385,7 +385,7 @@ public class ResolverBundle extends VersionSupplier implements Comparable<Resolv
fragmentExports.put(fragment.bundleID, hostExports);
}
- List<GenericCapability> hostCapabilities = new ArrayList<GenericCapability>(newGenericCapabilities.length);
+ List<GenericCapability> hostCapabilities = new ArrayList<>(newGenericCapabilities.length);
if (newGenericCapabilities.length > 0 && dynamicAttach) {
for (GenericDescription capability : newGenericCapabilities) {
if (!IdentityNamespace.IDENTITY_NAMESPACE.equals(capability.getType())) {
@@ -536,8 +536,8 @@ public class ResolverBundle extends VersionSupplier implements Comparable<Resolv
// bug 353103: must make a snapshot to avoid ConcurrentModificationException
ResolverBundle[] remainingFrags = fragments.toArray(new ResolverBundle[fragments.size()]);
for (ResolverBundle remainingFrag : remainingFrags) {
- List<ResolverImport> additionalImports = new ArrayList<ResolverImport>(0);
- List<BundleConstraint> additionalRequires = new ArrayList<BundleConstraint>(0);
+ List<ResolverImport> additionalImports = new ArrayList<>(0);
+ List<BundleConstraint> additionalRequires = new ArrayList<>(0);
if (hasUnresolvedConstraint(reason, fragment, remainingFrag, oldImports, oldRequires, additionalImports, additionalRequires))
continue;
// merge back the additional imports or requires which the detached fragment has in common with the remaining fragment
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/module/ResolverImpl.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/module/ResolverImpl.java
index 9118adb6e..f215c1b9b 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/module/ResolverImpl.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/module/ResolverImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2013 IBM Corporation and others. All rights reserved.
+ * 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 http://www.eclipse.org/legal/epl-v10.html
@@ -53,7 +53,7 @@ public class ResolverImpl implements Resolver {
// Used to check permissions for import/export, provide/require, host/fragment
private final PermissionChecker permissionChecker;
// Set of bundles that are pending removal
- private MappedList<Long, BundleDescription> removalPending = new MappedList<Long, BundleDescription>();
+ private MappedList<Long, BundleDescription> removalPending = new MappedList<>();
// Indicates whether this resolver has been initialized
private boolean initialized = false;
@@ -85,15 +85,15 @@ public class ResolverImpl implements Resolver {
// Initializes the resolver
private void initialize() {
- resolverExports = new VersionHashMap<ResolverExport>(this);
- resolverBundles = new VersionHashMap<ResolverBundle>(this);
- resolverGenerics = new HashMap<String, VersionHashMap<GenericCapability>>();
- unresolvedBundles = new HashSet<ResolverBundle>();
- bundleMapping = new HashMap<BundleDescription, ResolverBundle>();
+ resolverExports = new VersionHashMap<>(this);
+ resolverBundles = new VersionHashMap<>(this);
+ resolverGenerics = new HashMap<>();
+ unresolvedBundles = new HashSet<>();
+ bundleMapping = new HashMap<>();
BundleDescription[] bundles = state.getBundles();
groupingChecker = new GroupingChecker();
- ArrayList<ResolverBundle> fragmentBundles = new ArrayList<ResolverBundle>();
+ ArrayList<ResolverBundle> fragmentBundles = new ArrayList<>();
// Add each bundle to the resolver's internal state
for (int i = 0; i < bundles.length; i++)
initResolverBundle(bundles[i], fragmentBundles, false);
@@ -137,7 +137,7 @@ public class ResolverImpl implements Resolver {
// Re-wire previously resolved bundles
private void rewireBundles() {
- List<ResolverBundle> visited = new ArrayList<ResolverBundle>(bundleMapping.size());
+ List<ResolverBundle> visited = new ArrayList<>(bundleMapping.size());
for (ResolverBundle rb : bundleMapping.values()) {
if (!rb.getBundleDescription().isResolved())
continue;
@@ -350,8 +350,8 @@ public class ResolverImpl implements Resolver {
do {
timestamp = state.getTimeStamp();
List<ResolverBundle> hosts = resolverBundles.get(hostConstraint.getVersionConstraint().getName());
- candidates = new ArrayList<ResolverBundle>(hosts);
- List<BundleCapability> hostCapabilities = new ArrayList<BundleCapability>(hosts.size());
+ candidates = new ArrayList<>(hosts);
+ List<BundleCapability> hostCapabilities = new ArrayList<>(hosts.size());
// Must remove candidates that do not match before calling hooks.
for (Iterator<ResolverBundle> iCandidates = candidates.iterator(); iCandidates.hasNext();) {
ResolverBundle host = iCandidates.next();
@@ -365,7 +365,7 @@ public class ResolverImpl implements Resolver {
}
if (hook != null)
- hook.filterMatches(hostConstraint.getRequirement(), asCapabilities(new ArrayMap<BundleCapability, ResolverBundle>(hostCapabilities, candidates)));
+ hook.filterMatches(hostConstraint.getRequirement(), asCapabilities(new ArrayMap<>(hostCapabilities, candidates)));
} while (timestamp != state.getTimeStamp());
// we are left with only candidates that satisfy the host constraint
for (ResolverBundle host : candidates) {
@@ -443,24 +443,24 @@ public class ResolverImpl implements Resolver {
// attempt to resolve all unresolved bundles
Collection<ResolverBundle> hookDisabled = Collections.EMPTY_LIST;
if (hook != null) {
- List<ResolverBundle> resolvableBundles = new ArrayList<ResolverBundle>(unresolvedBundles);
- List<BundleRevision> resolvableRevisions = new ArrayList<BundleRevision>(resolvableBundles.size());
+ List<ResolverBundle> resolvableBundles = new ArrayList<>(unresolvedBundles);
+ List<BundleRevision> resolvableRevisions = new ArrayList<>(resolvableBundles.size());
for (ResolverBundle bundle : resolvableBundles)
resolvableRevisions.add(bundle.getBundleDescription());
- ArrayMap<BundleRevision, ResolverBundle> resolvable = new ArrayMap<BundleRevision, ResolverBundle>(resolvableRevisions, resolvableBundles);
+ ArrayMap<BundleRevision, ResolverBundle> resolvable = new ArrayMap<>(resolvableRevisions, resolvableBundles);
int size = resolvableBundles.size();
hook.filterResolvable(resolvable);
if (resolvable.size() < size) {
- hookDisabled = new ArrayList<ResolverBundle>(unresolvedBundles);
+ hookDisabled = new ArrayList<>(unresolvedBundles);
hookDisabled.removeAll(resolvableBundles);
}
}
usesCalculationTimeout = false;
- List<ResolverBundle> toResolve = new ArrayList<ResolverBundle>(unresolvedBundles);
+ List<ResolverBundle> toResolve = new ArrayList<>(unresolvedBundles);
// first resolve the system bundle to allow osgi.ee capabilities to be resolved
- List<ResolverBundle> unresolvedSystemBundles = new ArrayList<ResolverBundle>(1);
+ List<ResolverBundle> unresolvedSystemBundles = new ArrayList<>(1);
String systemBSN = getSystemBundle();
for (Iterator<ResolverBundle> iToResolve = toResolve.iterator(); iToResolve.hasNext();) {
ResolverBundle rb = iToResolve.next();
@@ -549,7 +549,7 @@ public class ResolverImpl implements Resolver {
return reRefresh; // we don't care about this unless we are in development mode
// when in develoment mode we need to reRefresh hosts of unresolved fragments that add new constraints
// and reRefresh and unresolved bundles that have dependents
- Set<BundleDescription> additionalRefresh = new HashSet<BundleDescription>();
+ Set<BundleDescription> additionalRefresh = new HashSet<>();
ResolverBundle[] unresolved = unresolvedBundles.toArray(new ResolverBundle[unresolvedBundles.size()]);
for (int i = 0; i < unresolved.length; i++) {
addUnresolvedWithDependents(unresolved[i], additionalRefresh);
@@ -588,7 +588,7 @@ public class ResolverImpl implements Resolver {
}
private Collection<ResolverBundle> resolveOptionalConstraints(ResolverBundle[] bundles) {
- Collection<ResolverBundle> result = new ArrayList<ResolverBundle>();
+ Collection<ResolverBundle> result = new ArrayList<>();
for (int i = 0; i < bundles.length; i++) {
if (bundles[i] != null && resolveOptionalConstraints(bundles[i])) {
result.add(bundles[i]);
@@ -600,7 +600,7 @@ public class ResolverImpl implements Resolver {
// TODO this does not do proper uses constraint verification.
private boolean resolveOptionalConstraints(ResolverBundle bundle) {
BundleConstraint[] requires = bundle.getRequires();
- List<ResolverBundle> cycle = new ArrayList<ResolverBundle>();
+ List<ResolverBundle> cycle = new ArrayList<>();
boolean resolvedOptional = false;
for (int i = 0; i < requires.length; i++)
if (requires[i].isOptional() && requires[i].getSelectedSupplier() == null) {
@@ -647,7 +647,7 @@ public class ResolverImpl implements Resolver {
private void selectSingletons(ResolverBundle[] bundles) {
if (developmentMode)
return; // want all singletons to resolve in devmode
- Map<String, Collection<ResolverBundle>> selectedSingletons = new HashMap<String, Collection<ResolverBundle>>(bundles.length);
+ Map<String, Collection<ResolverBundle>> selectedSingletons = new HashMap<>(bundles.length);
for (ResolverBundle bundle : bundles) {
if (!bundle.getBundleDescription().isSingleton() || !bundle.isResolvable())
continue;
@@ -655,7 +655,7 @@ public class ResolverImpl implements Resolver {
Collection<ResolverBundle> selected = selectedSingletons.get(bsn);
if (selected != null)
continue; // already processed the bsn
- selected = new ArrayList<ResolverBundle>(1);
+ selected = new ArrayList<>(1);
selectedSingletons.put(bsn, selected);
List<ResolverBundle> sameBSN = resolverBundles.get(bsn);
@@ -677,7 +677,7 @@ public class ResolverImpl implements Resolver {
Collection<ResolverBundle> collisions = collisionMap.get(singleton);
if (collisions == null || !singleton.isResolvable())
continue; // not a singleton or not resolvable
- Collection<ResolverBundle> pickOneToResolve = new ArrayList<ResolverBundle>();
+ Collection<ResolverBundle> pickOneToResolve = new ArrayList<>();
for (ResolverBundle collision : collisions) {
if (selected.contains(collision)) {
// Must fail since there is already a selected bundle which is a collision of the singleton bundle
@@ -729,12 +729,12 @@ public class ResolverImpl implements Resolver {
}
private Map<ResolverBundle, Collection<ResolverBundle>> getCollisionMap(List<ResolverBundle> sameBSN) {
- Map<ResolverBundle, Collection<ResolverBundle>> result = new HashMap<ResolverBundle, Collection<ResolverBundle>>();
+ Map<ResolverBundle, Collection<ResolverBundle>> result = new HashMap<>();
for (ResolverBundle singleton : sameBSN) {
if (!singleton.getBundleDescription().isSingleton() || !singleton.isResolvable())
continue; // ignore non-singleton and non-resolvable
- List<ResolverBundle> collisionCandidates = new ArrayList<ResolverBundle>(sameBSN.size() - 1);
- List<BundleCapability> capabilities = new ArrayList<BundleCapability>(sameBSN.size() - 1);
+ List<ResolverBundle> collisionCandidates = new ArrayList<>(sameBSN.size() - 1);
+ List<BundleCapability> capabilities = new ArrayList<>(sameBSN.size() - 1);
for (ResolverBundle collision : sameBSN) {
if (collision == singleton || !collision.getBundleDescription().isSingleton() || !collision.isResolvable())
continue; // Ignore the bundle we are checking and non-singletons and non-resolvable
@@ -742,7 +742,7 @@ public class ResolverImpl implements Resolver {
capabilities.add(getIdentity(collision));
}
if (hook != null)
- hook.filterSingletonCollisions(getIdentity(singleton), asCapabilities(new ArrayMap<BundleCapability, ResolverBundle>(capabilities, collisionCandidates)));
+ hook.filterSingletonCollisions(getIdentity(singleton), asCapabilities(new ArrayMap<>(capabilities, collisionCandidates)));
result.put(singleton, collisionCandidates);
}
return result;
@@ -758,12 +758,12 @@ public class ResolverImpl implements Resolver {
// need to sort bundles to keep consistent order for fragment attachment (bug 174930)
Arrays.sort(bundles);
// First attach all fragments to the matching hosts
- Collection<String> processedFragments = new HashSet<String>(bundles.length);
+ Collection<String> processedFragments = new HashSet<>(bundles.length);
for (int i = 0; i < bundles.length; i++)
attachFragment(bundles[i], processedFragments);
// Lists of cyclic dependencies recording during resolving
- List<ResolverBundle> cycle = new ArrayList<ResolverBundle>(1); // start small
+ List<ResolverBundle> cycle = new ArrayList<>(1); // start small
// Attempt to resolve all unresolved bundles
for (int i = 0; i < bundles.length; i++) {
if (DEBUG)
@@ -801,7 +801,7 @@ public class ResolverImpl implements Resolver {
// We pass false for keepFragmentsAttached because we need to redo the attachments (bug 272561)
setBundleUnresolved(bundles[i], false, false);
if (exclude == null)
- exclude = new HashSet<ResolverBundle>(1);
+ exclude = new HashSet<>(1);
exclude.add(bundles[i]);
}
}
@@ -819,7 +819,7 @@ public class ResolverImpl implements Resolver {
continue;
}
if (conflictedBundles == null)
- conflictedBundles = new HashSet<ResolverBundle>(conflictingConstraints.size());
+ conflictedBundles = new HashSet<>(conflictingConstraints.size());
ResolverBundle conflictedBundle;
if (conflict.isFromFragment())
conflictedBundle = bundleMapping.get(conflict.getVersionConstraint().getBundle());
@@ -842,7 +842,7 @@ public class ResolverImpl implements Resolver {
private void reResolveBundles(Set<ResolverBundle> exclude, ResolverBundle[] bundles, Dictionary<Object, Object>[] platformProperties) {
if (exclude == null || exclude.size() == 0)
return;
- List<ResolverBundle> remainingUnresolved = new ArrayList<ResolverBundle>();
+ List<ResolverBundle> remainingUnresolved = new ArrayList<>();
for (int i = 0; i < bundles.length; i++) {
if (!exclude.contains(bundles[i])) {
// We pass false for keepFragmentsAttached because we need to redo the attachments (bug 272561)
@@ -859,9 +859,9 @@ public class ResolverImpl implements Resolver {
usesMode = secureAction.getProperty("osgi.resolver.usesMode"); //$NON-NLS-1$
if ("ignore".equals(usesMode) || developmentMode) //$NON-NLS-1$
return null;
- Set<String> bundleConstraints = new HashSet<String>();
- Set<String> packageConstraints = new HashSet<String>();
- Collection<GenericConstraint> multiRequirementWithMultiSuppliers = new ArrayList<GenericConstraint>();
+ Set<String> bundleConstraints = new HashSet<>();
+ Set<String> packageConstraints = new HashSet<>();
+ Collection<GenericConstraint> multiRequirementWithMultiSuppliers = new ArrayList<>();
// first try out the initial selections
List<ResolverConstraint> initialConflicts = getConflicts(bundles, packageConstraints, bundleConstraints, multiRequirementWithMultiSuppliers);
if (initialConflicts == null || "tryFirst".equals(usesMode) || usesCalculationTimeout) { //$NON-NLS-1$
@@ -991,7 +991,7 @@ public class ResolverImpl implements Resolver {
private ResolverBundle[] getConflictedBundles(List<ResolverConstraint> bestConflicts) {
if (bestConflicts == null)
return new ResolverBundle[0];
- List<ResolverBundle> conflictedBundles = new ArrayList<ResolverBundle>(bestConflicts.size());
+ List<ResolverBundle> conflictedBundles = new ArrayList<>(bestConflicts.size());
for (ResolverConstraint constraint : bestConflicts)
if (!conflictedBundles.contains(constraint.getBundle()))
conflictedBundles.add(constraint.getBundle());
@@ -1044,7 +1044,7 @@ public class ResolverImpl implements Resolver {
printConflict(conflict, requires[i], bundle);
if (conflicts == null)
- conflicts = new ArrayList<ResolverConstraint>(1);
+ conflicts = new ArrayList<>(1);
conflicts.add(requires[i]);
}
}
@@ -1059,7 +1059,7 @@ public class ResolverImpl implements Resolver {
printConflict(conflict, imports[i], bundle);
if (conflicts == null)
- conflicts = new ArrayList<ResolverConstraint>(1);
+ conflicts = new ArrayList<>(1);
conflicts.add(imports[i]);
}
}
@@ -1081,7 +1081,7 @@ public class ResolverImpl implements Resolver {
PackageRoots[][] conflict = groupingChecker.isConsistent(bundle, (GenericCapability) supplier);
if (conflict != null) {
if (capabilityConflicts == null)
- capabilityConflicts = new ArrayList<PackageRoots[][]>(1);
+ capabilityConflicts = new ArrayList<>(1);
capabilityConflicts.add(conflict);
}
}
@@ -1092,7 +1092,7 @@ public class ResolverImpl implements Resolver {
if (capabilityConflicts.size() == suppliers.length) {
// every capability conflicted
if (conflicts == null)
- conflicts = new ArrayList<ResolverConstraint>(1);
+ conflicts = new ArrayList<>(1);
conflicts.add(capabilityRequirement);
}
}
@@ -1136,9 +1136,9 @@ public class ResolverImpl implements Resolver {
// get a list of resolver constraints that have multiple suppliers
// a 2 demensional array is used each entry is a list of identical constraints that have identical suppliers.
private ResolverConstraint[][] getMultipleSuppliers(ResolverBundle[] bundles, Set<String> packageConstraints, Set<String> bundleConstraints) {
- List<ResolverImport> multipleImportSupplierList = new ArrayList<ResolverImport>(1);
- List<BundleConstraint> multipleRequireSupplierList = new ArrayList<BundleConstraint>(1);
- List<GenericConstraint> multipleGenericSupplierList = new ArrayList<GenericConstraint>(1);
+ List<ResolverImport> multipleImportSupplierList = new ArrayList<>(1);
+ List<BundleConstraint> multipleRequireSupplierList = new ArrayList<>(1);
+ List<GenericConstraint> multipleGenericSupplierList = new ArrayList<>(1);
for (ResolverBundle bundle : bundles) {
BundleConstraint[] requires = bundle.getRequires();
for (BundleConstraint require : requires)
@@ -1176,17 +1176,17 @@ public class ResolverImpl implements Resolver {
if (genericRequire.getNumPossibleSuppliers() > 1 && !genericRequire.isMultiple())
multipleGenericSupplierList.add(genericRequire);
}
- List<ResolverConstraint[]> results = new ArrayList<ResolverConstraint[]>();
+ List<ResolverConstraint[]> results = new ArrayList<>();
if (multipleImportSupplierList.size() + multipleRequireSupplierList.size() + multipleGenericSupplierList.size() > usesMultipleSuppliersLimit) {
// we have hit a max on the multiple suppliers in the lists without merging.
// first merge the identical constraints that have identical suppliers
- Map<String, List<List<ResolverConstraint>>> multipleImportSupplierMaps = new HashMap<String, List<List<ResolverConstraint>>>();
+ Map<String, List<List<ResolverConstraint>>> multipleImportSupplierMaps = new HashMap<>();
for (ResolverImport importPkg : multipleImportSupplierList)
addMutipleSupplierConstraint(multipleImportSupplierMaps, importPkg, importPkg.getName());
- Map<String, List<List<ResolverConstraint>>> multipleRequireSupplierMaps = new HashMap<String, List<List<ResolverConstraint>>>();
+ Map<String, List<List<ResolverConstraint>>> multipleRequireSupplierMaps = new HashMap<>();
for (BundleConstraint requireBundle : multipleRequireSupplierList)
addMutipleSupplierConstraint(multipleRequireSupplierMaps, requireBundle, requireBundle.getName());
- Map<String, List<List<ResolverConstraint>>> multipleGenericSupplierMaps = new HashMap<String, List<List<ResolverConstraint>>>();
+ Map<String, List<List<ResolverConstraint>>> multipleGenericSupplierMaps = new HashMap<>();
for (GenericConstraint genericRequire : multipleGenericSupplierList)
addMutipleSupplierConstraint(multipleGenericSupplierMaps, genericRequire, genericRequire.getNameSpace());
addMergedSuppliers(results, multipleImportSupplierMaps);
@@ -1196,7 +1196,7 @@ public class ResolverImpl implements Resolver {
if (results.size() > usesMultipleSuppliersLimit && packageConstraints != null && bundleConstraints != null) {
// we still have too big of a list; filter out constraints that are not in conflict
List<ResolverConstraint[]> tooBig = results;
- results = new ArrayList<ResolverConstraint[]>();
+ results = new ArrayList<>();
for (ResolverConstraint[] constraints : tooBig) {
ResolverConstraint constraint = constraints.length > 0 ? constraints[0] : null;
if (constraint instanceof ResolverImport) {
@@ -1240,8 +1240,8 @@ public class ResolverImpl implements Resolver {
private void addMutipleSupplierConstraint(Map<String, List<List<ResolverConstraint>>> constraints, ResolverConstraint constraint, String key) {
List<List<ResolverConstraint>> mergedConstraintLists = constraints.get(key);
if (mergedConstraintLists == null) {
- mergedConstraintLists = new ArrayList<List<ResolverConstraint>>(0);
- List<ResolverConstraint> constraintList = new ArrayList<ResolverConstraint>(1);
+ mergedConstraintLists = new ArrayList<>(0);
+ List<ResolverConstraint> constraintList = new ArrayList<>(1);
constraintList.add(constraint);
mergedConstraintLists.add(constraintList);
constraints.put(key, mergedConstraintLists);
@@ -1259,7 +1259,7 @@ public class ResolverImpl implements Resolver {
constraintList.add(constraint);
return;
}
- List<ResolverConstraint> constraintList = new ArrayList<ResolverConstraint>(1);
+ List<ResolverConstraint> constraintList = new ArrayList<>(1);
constraintList.add(constraint);
mergedConstraintLists.add(constraintList);
}
@@ -1299,7 +1299,7 @@ public class ResolverImpl implements Resolver {
ResolverBundle cycleBundle = cycle.get(i);
cycleBundle.clearWires();
}
- List<ResolverBundle> innerCycle = new ArrayList<ResolverBundle>(cycle.size());
+ List<ResolverBundle> innerCycle = new ArrayList<>(cycle.size());
for (int i = 0; i < cycle.size(); i++)
resolveBundle(cycle.get(i), innerCycle);
checkCycle(innerCycle);
@@ -1494,8 +1494,8 @@ public class ResolverImpl implements Resolver {
capabilities = Collections.EMPTY_LIST;
else
capabilities = name == null || name.indexOf('*') >= 0 ? namespace.getAllValues() : namespace.get(name);
- candidates = new ArrayList<GenericCapability>(capabilities);
- List<BundleCapability> genCapabilities = new ArrayList<BundleCapability>(candidates.size());
+ candidates = new ArrayList<>(capabilities);
+ List<BundleCapability> genCapabilities = new ArrayList<>(candidates.size());
// Must remove candidates that do not match before calling hooks.
for (Iterator<GenericCapability> iCandidates = candidates.iterator(); iCandidates.hasNext();) {
GenericCapability capability = iCandidates.next();
@@ -1506,7 +1506,7 @@ public class ResolverImpl implements Resolver {
}
}
if (hook != null)
- hook.filterMatches(constraint.getRequirement(), asCapabilities(new ArrayMap<BundleCapability, GenericCapability>(genCapabilities, candidates)));
+ hook.filterMatches(constraint.getRequirement(), asCapabilities(new ArrayMap<>(genCapabilities, candidates)));
} while (timestamp != state.getTimeStamp());
boolean result = false;
// We are left with only capabilities that satisfy the constraint.
@@ -1576,8 +1576,8 @@ public class ResolverImpl implements Resolver {
do {
timestamp = state.getTimeStamp();
List<ResolverBundle> bundles = resolverBundles.get(req.getVersionConstraint().getName());
- candidates = new ArrayList<ResolverBundle>(bundles);
- List<BundleCapability> capabilities = new ArrayList<BundleCapability>(candidates.size());
+ candidates = new ArrayList<>(bundles);
+ List<BundleCapability> capabilities = new ArrayList<>(candidates.size());
// Must remove candidates that do not match before calling hooks.
for (Iterator<ResolverBundle> iCandidates = candidates.iterator(); iCandidates.hasNext();) {
ResolverBundle bundle = iCandidates.next();
@@ -1588,7 +1588,7 @@ public class ResolverImpl implements Resolver {
}
}
if (hook != null)
- hook.filterMatches(req.getRequirement(), asCapabilities(new ArrayMap<BundleCapability, ResolverBundle>(capabilities, candidates)));
+ hook.filterMatches(req.getRequirement(), asCapabilities(new ArrayMap<>(capabilities, candidates)));
} while (timestamp != state.getTimeStamp());
// We are left with only capabilities that satisfy the require bundle.
boolean result = false;
@@ -1648,8 +1648,8 @@ public class ResolverImpl implements Resolver {
do {
timestamp = state.getTimeStamp();
List<ResolverExport> exports = resolverExports.get(imp.getName());
- candidates = new ArrayList<ResolverExport>(exports);
- List<BundleCapability> capabilities = new ArrayList<BundleCapability>(candidates.size());
+ candidates = new ArrayList<>(exports);
+ List<BundleCapability> capabilities = new ArrayList<>(candidates.size());
// Must remove candidates that do not match before calling hooks.
for (Iterator<ResolverExport> iCandidates = candidates.iterator(); iCandidates.hasNext();) {
ResolverExport export = iCandidates.next();
@@ -1660,7 +1660,7 @@ public class ResolverImpl implements Resolver {
}
}
if (hook != null)
- hook.filterMatches(imp.getRequirement(), asCapabilities(new ArrayMap<BundleCapability, ResolverExport>(capabilities, candidates)));
+ hook.filterMatches(imp.getRequirement(), asCapabilities(new ArrayMap<>(capabilities, candidates)));
} while (timestamp != state.getTimeStamp());
// We are left with only capabilities that satisfy the import.
for (ResolverExport export : candidates) {
@@ -1827,11 +1827,11 @@ public class ResolverImpl implements Resolver {
stateResolveConstraints(rb);
// Build up the state wires
- Map<String, List<StateWire>> stateWires = new HashMap<String, List<StateWire>>();
+ Map<String, List<StateWire>> stateWires = new HashMap<>();
// Gather selected exports
ResolverExport[] exports = rb.getSelectedExports();
- List<ExportPackageDescription> selectedExports = new ArrayList<ExportPackageDescription>(exports.length);
+ List<ExportPackageDescription> selectedExports = new ArrayList<>(exports.length);
for (int i = 0; i < exports.length; i++) {
if (permissionChecker.checkPackagePermission(exports[i].getExportPackageDescription()))
selectedExports.add(exports[i].getExportPackageDescription());
@@ -1840,7 +1840,7 @@ public class ResolverImpl implements Resolver {
// Gather substitute exports
ResolverExport[] substituted = rb.getSubstitutedExports();
- List<ExportPackageDescription> substitutedExports = new ArrayList<ExportPackageDescription>(substituted.length);
+ List<ExportPackageDescription> substitutedExports = new ArrayList<>(substituted.length);
for (int i = 0; i < substituted.length; i++) {
substitutedExports.add(substituted[i].getExportPackageDescription());
}
@@ -1851,8 +1851,8 @@ public class ResolverImpl implements Resolver {
// Gather bundles that have been wired to
BundleConstraint[] requires = rb.getRequires();
- List<BundleDescription> bundlesWiredTo = new ArrayList<BundleDescription>(requires.length);
- List<StateWire> requireWires = new ArrayList<StateWire>(requires.length);
+ List<BundleDescription> bundlesWiredTo = new ArrayList<>(requires.length);
+ List<StateWire> requireWires = new ArrayList<>(requires.length);
for (int i = 0; i < requires.length; i++)
if (requires[i].getSelectedSupplier() != null) {
BundleDescription supplier = (BundleDescription) requires[i].getSelectedSupplier().getBaseDescription();
@@ -1865,14 +1865,14 @@ public class ResolverImpl implements Resolver {
stateWires.put(BundleRevision.BUNDLE_NAMESPACE, requireWires);
GenericCapability[] capabilities = rb.getGenericCapabilities();
- List<GenericDescription> selectedCapabilities = new ArrayList<GenericDescription>(capabilities.length);
+ List<GenericDescription> selectedCapabilities = new ArrayList<>(capabilities.length);
for (GenericCapability capability : capabilities)
if (capability.isEffective() && permissionChecker.checkCapabilityPermission(capability.getGenericDescription()))
selectedCapabilities.add(capability.getGenericDescription());
GenericDescription[] selectedCapabilitiesArray = selectedCapabilities.toArray(new GenericDescription[selectedCapabilities.size()]);
GenericConstraint[] genericRequires = rb.getGenericRequires();
- List<GenericDescription> resolvedGenericRequires = new ArrayList<GenericDescription>(genericRequires.length);
+ List<GenericDescription> resolvedGenericRequires = new ArrayList<>(genericRequires.length);
for (GenericConstraint genericConstraint : genericRequires) {
VersionSupplier[] matching = genericConstraint.getMatchingCapabilities();
if (matching != null)
@@ -1882,7 +1882,7 @@ public class ResolverImpl implements Resolver {
StateWire genericWire = newStateWire(rb.getBundleDescription(), genericConstraint.getVersionConstraint(), supplier.getSupplier(), supplier);
List<StateWire> genericWires = stateWires.get(genericConstraint.getNameSpace());
if (genericWires == null) {
- genericWires = new ArrayList<StateWire>();
+ genericWires = new ArrayList<>();
stateWires.put(genericConstraint.getNameSpace(), genericWires);
}
genericWires.add(genericWire);
@@ -1895,7 +1895,7 @@ public class ResolverImpl implements Resolver {
VersionSupplier[] matchingBundles = rb.getHost().getPossibleSuppliers();
if (matchingBundles != null && matchingBundles.length > 0) {
hostBundles = new BundleDescription[matchingBundles.length];
- List<StateWire> hostWires = new ArrayList<StateWire>(matchingBundles.length);
+ List<StateWire> hostWires = new ArrayList<>(matchingBundles.length);
stateWires.put(BundleRevision.HOST_NAMESPACE, hostWires);
for (int i = 0; i < matchingBundles.length; i++) {
hostBundles[i] = matchingBundles[i].getBundleDescription();
@@ -1937,8 +1937,8 @@ public class ResolverImpl implements Resolver {
private static ExportPackageDescription[] getExportsWiredTo(ResolverBundle rb, Map<String, List<StateWire>> stateWires) {
// Gather exports that have been wired to
ResolverImport[] imports = rb.getImportPackages();
- List<ExportPackageDescription> exportsWiredTo = new ArrayList<ExportPackageDescription>(imports.length);
- List<StateWire> importWires = new ArrayList<StateWire>(imports.length);
+ List<ExportPackageDescription> exportsWiredTo = new ArrayList<>(imports.length);
+ List<StateWire> importWires = new ArrayList<>(imports.length);
for (int i = 0; i < imports.length; i++)
if (imports[i].getSelectedSupplier() != null) {
ExportPackageDescription supplier = (ExportPackageDescription) imports[i].getSelectedSupplier().getBaseDescription();
@@ -2003,7 +2003,7 @@ public class ResolverImpl implements Resolver {
Map<String, List<StateWire>> wires = ((BundleDescriptionImpl) importingBundle).getWires();
List<StateWire> imports = wires.get(BundleRevision.PACKAGE_NAMESPACE);
if (imports == null) {
- imports = new ArrayList<StateWire>();
+ imports = new ArrayList<>();
wires.put(BundleRevision.PACKAGE_NAMESPACE, imports);
}
imports.add(newStateWire(importingBundle, requirement, capabilityHost, capability));
@@ -2294,7 +2294,7 @@ public class ResolverImpl implements Resolver {
String type = capability.getGenericDescription().getType();
VersionHashMap<GenericCapability> namespace = resolverGenerics.get(type);
if (namespace == null) {
- namespace = new VersionHashMap<GenericCapability>(this);
+ namespace = new VersionHashMap<>(this);
resolverGenerics.put(type, namespace);
}
namespace.put(capability.getName(), capability);
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/BaseDescriptionImpl.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/BaseDescriptionImpl.java
index 3abcdfdb6..1eddc7035 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/BaseDescriptionImpl.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/BaseDescriptionImpl.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
@@ -140,7 +140,7 @@ public abstract class BaseDescriptionImpl implements BaseDescription {
if (namespace.equals(internalName))
return attrs;
// we are doing an alias, must remove internal Name and add alias
- attrs = new HashMap<String, Object>(attrs);
+ attrs = new HashMap<>(attrs);
Object nameValue = attrs.remove(internalName);
if (nameValue != null)
attrs.put(namespace, nameValue);
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java
index e460d9c91..d16b510d2 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.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
@@ -258,7 +258,7 @@ public final class BundleDescriptionImpl extends BaseDescriptionImpl implements
LazyData currentData = loadLazyData();
synchronized (this.monitor) {
if (currentData.stateWires == null) {
- currentData.stateWires = new HashMap<String, List<StateWire>>(0);
+ currentData.stateWires = new HashMap<>(0);
}
return currentData.stateWires;
}
@@ -535,7 +535,7 @@ public final class BundleDescriptionImpl extends BaseDescriptionImpl implements
if (newDependencies == null)
return;
if (!checkDups && dependencies == null)
- dependencies = new ArrayList<BundleDescription>(newDependencies.length);
+ dependencies = new ArrayList<>(newDependencies.length);
for (int i = 0; i < newDependencies.length; i++) {
addDependency((BaseDescriptionImpl) newDependencies[i], checkDups);
}
@@ -548,7 +548,7 @@ public final class BundleDescriptionImpl extends BaseDescriptionImpl implements
if (bundle == this)
return;
if (dependencies == null)
- dependencies = new ArrayList<BundleDescription>(10);
+ dependencies = new ArrayList<>(10);
if (!checkDups || !dependencies.contains(bundle)) {
bundle.addDependent(this);
dependencies.add(bundle);
@@ -563,8 +563,8 @@ public final class BundleDescriptionImpl extends BaseDescriptionImpl implements
List<BundleDescription> getBundleDependencies() {
synchronized (this.monitor) {
if (dependencies == null)
- return new ArrayList<BundleDescription>(0);
- ArrayList<BundleDescription> required = new ArrayList<BundleDescription>(dependencies.size());
+ return new ArrayList<>(0);
+ ArrayList<BundleDescription> required = new ArrayList<>(dependencies.size());
for (Iterator<BundleDescription> iter = dependencies.iterator(); iter.hasNext();) {
BundleDescription dep = iter.next();
if (dep != this && dep.getHost() == null)
@@ -577,7 +577,7 @@ public final class BundleDescriptionImpl extends BaseDescriptionImpl implements
protected void addDependent(BundleDescription dependent) {
synchronized (this.monitor) {
if (dependents == null)
- dependents = new ArrayList<BundleDescription>(10);
+ dependents = new ArrayList<>(10);
// no need to check for duplicates here; this is only called in addDepenency which already checks for dups.
dependents.add(dependent);
}
@@ -684,7 +684,7 @@ public final class BundleDescriptionImpl extends BaseDescriptionImpl implements
LazyData currentData = loadLazyData();
synchronized (this.monitor) {
if (currentData.addedDynamicImports == null)
- currentData.addedDynamicImports = new ArrayList<ImportPackageSpecification>();
+ currentData.addedDynamicImports = new ArrayList<>();
for (ImportPackageSpecification addImport : dynamicImport) {
if (!ImportPackageSpecification.RESOLUTION_DYNAMIC.equals(addImport.getDirective(Constants.RESOLUTION_DIRECTIVE)))
throw new IllegalArgumentException("Import must be a dynamic import."); //$NON-NLS-1$
@@ -746,7 +746,7 @@ public final class BundleDescriptionImpl extends BaseDescriptionImpl implements
if (lazyData.dynamicStamps == null) {
if (timestamp == null)
return;
- lazyData.dynamicStamps = new HashMap<String, Long>();
+ lazyData.dynamicStamps = new HashMap<>();
}
if (timestamp == null)
lazyData.dynamicStamps.remove(requestedPackage);
@@ -858,7 +858,7 @@ public final class BundleDescriptionImpl extends BaseDescriptionImpl implements
}
public Map<String, String> getDeclaredDirectives() {
- Map<String, String> result = new HashMap<String, String>(2);
+ Map<String, String> result = new HashMap<>(2);
Map<String, String> arbitrary = getArbitraryDirectives();
if (arbitrary != null)
result.putAll(arbitrary);
@@ -879,7 +879,7 @@ public final class BundleDescriptionImpl extends BaseDescriptionImpl implements
}
public Map<String, Object> getDeclaredAttributes() {
- Map<String, Object> result = new HashMap<String, Object>(1);
+ Map<String, Object> result = new HashMap<>(1);
synchronized (this.monitor) {
if (attributes != null)
result.putAll(attributes);
@@ -890,7 +890,7 @@ public final class BundleDescriptionImpl extends BaseDescriptionImpl implements
}
public List<BundleRequirement> getDeclaredRequirements(String namespace) {
- List<BundleRequirement> result = new ArrayList<BundleRequirement>();
+ List<BundleRequirement> result = new ArrayList<>();
if (namespace == null || BundleRevision.BUNDLE_NAMESPACE.equals(namespace)) {
BundleSpecification[] requires = getRequiredBundles();
for (BundleSpecification require : requires) {
@@ -914,7 +914,7 @@ public final class BundleDescriptionImpl extends BaseDescriptionImpl implements
}
public List<BundleCapability> getDeclaredCapabilities(String namespace) {
- List<BundleCapability> result = new ArrayList<BundleCapability>();
+ List<BundleCapability> result = new ArrayList<>();
if (host == null) {
if (getSymbolicName() != null) {
if (namespace == null || BundleRevision.BUNDLE_NAMESPACE.equals(namespace)) {
@@ -1083,7 +1083,7 @@ public final class BundleDescriptionImpl extends BaseDescriptionImpl implements
public List<BundleCapability> getCapabilities(String namespace) {
if (!isInUse())
return null;
- List<BundleCapability> result = new ArrayList<BundleCapability>();
+ List<BundleCapability> result = new ArrayList<>();
GenericDescription[] genericCapabilities = getSelectedGenericCapabilities();
for (GenericDescription capabilitiy : genericCapabilities) {
if (namespace == null || namespace.equals(capabilitiy.getType()))
@@ -1116,7 +1116,7 @@ public final class BundleDescriptionImpl extends BaseDescriptionImpl implements
if (requiredWires == null)
// happens if not in use
return null;
- List<BundleRequirement> requirements = new ArrayList<BundleRequirement>(requiredWires.size());
+ List<BundleRequirement> requirements = new ArrayList<>(requiredWires.size());
for (BundleWire wire : requiredWires) {
if (!requirements.contains(wire.getRequirement()))
requirements.add(wire.getRequirement());
@@ -1152,7 +1152,7 @@ public final class BundleDescriptionImpl extends BaseDescriptionImpl implements
if (!isInUse())
return null;
BundleDescription[] dependentBundles = getDependents();
- List<BundleWire> unorderedResult = new ArrayList<BundleWire>();
+ List<BundleWire> unorderedResult = new ArrayList<>();
for (BundleDescription dependent : dependentBundles) {
List<BundleWire> dependentWires = dependent.getWiring().getRequiredWires(namespace);
if (dependentWires != null)
@@ -1161,7 +1161,7 @@ public final class BundleDescriptionImpl extends BaseDescriptionImpl implements
unorderedResult.add(bundleWire);
}
}
- List<BundleWire> orderedResult = new ArrayList<BundleWire>(unorderedResult.size());
+ List<BundleWire> orderedResult = new ArrayList<>(unorderedResult.size());
List<BundleCapability> capabilities = getCapabilities(namespace);
for (BundleCapability capability : capabilities) {
for (Iterator<BundleWire> wires = unorderedResult.iterator(); wires.hasNext();) {
@@ -1185,7 +1185,7 @@ public final class BundleDescriptionImpl extends BaseDescriptionImpl implements
List<BundleWire> result = Collections.<BundleWire> emptyList();
Map<String, List<StateWire>> wireMap = getWires();
if (namespace == null) {
- result = new ArrayList<BundleWire>();
+ result = new ArrayList<>();
for (List<StateWire> wires : wireMap.values()) {
for (StateWire wire : wires) {
result.add(new BundleWireImpl(wire));
@@ -1196,7 +1196,7 @@ public final class BundleDescriptionImpl extends BaseDescriptionImpl implements
List<StateWire> wires = wireMap.get(namespace);
if (wires == null)
return result;
- result = new ArrayList<BundleWire>(wires.size());
+ result = new ArrayList<>(wires.size());
for (StateWire wire : wires) {
result.add(new BundleWireImpl(wire));
}
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/BundleSpecificationImpl.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/BundleSpecificationImpl.java
index c0776d788..7fbe25896 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/BundleSpecificationImpl.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/BundleSpecificationImpl.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
@@ -118,7 +118,7 @@ public class BundleSpecificationImpl extends VersionConstraintImpl implements Bu
@Override
protected Map<String, String> getInternalDirectives() {
- Map<String, String> result = new HashMap<String, String>(2);
+ Map<String, String> result = new HashMap<>(2);
synchronized (this.monitor) {
if (arbitraryDirectives != null)
result.putAll(arbitraryDirectives);
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/ExportPackageDescriptionImpl.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/ExportPackageDescriptionImpl.java
index 121d14dea..a7467ba58 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/ExportPackageDescriptionImpl.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/ExportPackageDescriptionImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2011 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
@@ -50,7 +50,7 @@ public class ExportPackageDescriptionImpl extends BaseDescriptionImpl implements
public Map<String, Object> getDirectives() {
synchronized (this.monitor) {
- Map<String, Object> result = new HashMap<String, Object>(7);
+ Map<String, Object> result = new HashMap<>(7);
if (uses != null)
result.put(Constants.USES_DIRECTIVE, uses);
if (exclude != null)
@@ -68,7 +68,7 @@ public class ExportPackageDescriptionImpl extends BaseDescriptionImpl implements
}
public Map<String, String> getDeclaredDirectives() {
- Map<String, String> result = new HashMap<String, String>(6);
+ Map<String, String> result = new HashMap<>(6);
synchronized (this.monitor) {
Map<String, String> arbitrary = getArbitraryDirectives();
if (arbitrary != null)
@@ -90,7 +90,7 @@ public class ExportPackageDescriptionImpl extends BaseDescriptionImpl implements
}
public Map<String, Object> getDeclaredAttributes() {
- Map<String, Object> result = new HashMap<String, Object>(2);
+ Map<String, Object> result = new HashMap<>(2);
synchronized (this.monitor) {
if (attributes != null)
result.putAll(attributes);
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/GenericDescriptionImpl.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/GenericDescriptionImpl.java
index d6ce6d87b..b5adf213b 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/GenericDescriptionImpl.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/GenericDescriptionImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 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,7 +31,7 @@ public class GenericDescriptionImpl extends BaseDescriptionImpl implements Gener
setType(fragmentDeclaration.getType());
Dictionary<String, Object> origAttrs = fragmentDeclaration.getAttributes();
if (origAttrs != null) {
- Hashtable<String, Object> copyAttrs = new Hashtable<String, Object>();
+ Hashtable<String, Object> copyAttrs = new Hashtable<>();
for (Enumeration<String> keys = origAttrs.keys(); keys.hasMoreElements();) {
String key = keys.nextElement();
copyAttrs.put(key, origAttrs.get(key));
@@ -39,7 +39,7 @@ public class GenericDescriptionImpl extends BaseDescriptionImpl implements Gener
setAttributes(copyAttrs);
}
Map<String, String> origDirectives = fragmentDeclaration.getDeclaredDirectives();
- Map<String, String> copyDirectives = new HashMap<String, String>(origDirectives);
+ Map<String, String> copyDirectives = new HashMap<>(origDirectives);
setDirectives(copyDirectives);
setSupplier(host);
this.fragmentDeclaration = fragmentDeclaration;
@@ -118,7 +118,7 @@ public class GenericDescriptionImpl extends BaseDescriptionImpl implements Gener
public Map<String, Object> getDeclaredAttributes() {
synchronized (this.monitor) {
- Map<String, Object> result = new HashMap<String, Object>(5);
+ Map<String, Object> result = new HashMap<>(5);
if (attributes != null)
for (Enumeration<String> keys = attributes.keys(); keys.hasMoreElements();) {
String key = keys.nextElement();
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/GenericSpecificationImpl.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/GenericSpecificationImpl.java
index f53e941b9..45fed239f 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/GenericSpecificationImpl.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/GenericSpecificationImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 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
@@ -169,7 +169,7 @@ public class GenericSpecificationImpl extends VersionConstraintImpl implements G
@Override
protected Map<String, String> getInternalDirectives() {
- Map<String, String> result = new HashMap<String, String>(2);
+ Map<String, String> result = new HashMap<>(2);
synchronized (this.monitor) {
if (arbitraryDirectives != null)
result.putAll(arbitraryDirectives);
@@ -187,7 +187,7 @@ public class GenericSpecificationImpl extends VersionConstraintImpl implements G
@Override
protected Map<String, Object> getInteralAttributes() {
synchronized (this.monitor) {
- return attributes == null ? Collections.<String, Object> emptyMap() : new HashMap<String, Object>(attributes);
+ return attributes == null ? Collections.<String, Object> emptyMap() : new HashMap<>(attributes);
}
}
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/HostSpecificationImpl.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/HostSpecificationImpl.java
index 2b2f2f6ff..cc66a8770 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/HostSpecificationImpl.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/HostSpecificationImpl.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
@@ -137,7 +137,7 @@ public class HostSpecificationImpl extends VersionConstraintImpl implements Host
@Override
protected Map<String, String> getInternalDirectives() {
- Map<String, String> result = new HashMap<String, String>(2);
+ Map<String, String> result = new HashMap<>(2);
synchronized (this.monitor) {
if (arbitraryDirectives != null)
result.putAll(arbitraryDirectives);
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/ImportPackageSpecificationImpl.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/ImportPackageSpecificationImpl.java
index a81392533..8348ae2f0 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/ImportPackageSpecificationImpl.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/ImportPackageSpecificationImpl.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
@@ -27,7 +27,7 @@ public class ImportPackageSpecificationImpl extends VersionConstraintImpl implem
public Map<String, Object> getDirectives() {
synchronized (this.monitor) {
- Map<String, Object> result = new HashMap<String, Object>(5);
+ Map<String, Object> result = new HashMap<>(5);
if (resolution != null)
result.put(Constants.RESOLUTION_DIRECTIVE, resolution);
return result;
@@ -216,7 +216,7 @@ public class ImportPackageSpecificationImpl extends VersionConstraintImpl implem
@Override
protected Map<String, String> getInternalDirectives() {
synchronized (this.monitor) {
- Map<String, String> result = new HashMap<String, String>(5);
+ Map<String, String> result = new HashMap<>(5);
if (arbitraryDirectives != null)
result.putAll(arbitraryDirectives);
if (resolution != null) {
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateBuilder.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateBuilder.java
index 7689ad400..0ae88cc40 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateBuilder.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateBuilder.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
@@ -112,7 +112,7 @@ public class StateBuilder {
ManifestElement[] exports = ManifestElement.parseHeader(Constants.EXPORT_PACKAGE, manifest.get(Constants.EXPORT_PACKAGE));
ManifestElement[] provides = ManifestElement.parseHeader(StateImpl.PROVIDE_PACKAGE, manifest.get(StateImpl.PROVIDE_PACKAGE));
boolean strict = state != null && state.inStrictMode();
- List<String> providedExports = new ArrayList<String>(provides == null ? 0 : provides.length);
+ List<String> providedExports = new ArrayList<>(provides == null ? 0 : provides.length);
result.setExportPackages(createExportPackages(exports, provides, providedExports, strict));
ManifestElement[] imports = ManifestElement.parseHeader(Constants.IMPORT_PACKAGE, manifest.get(Constants.IMPORT_PACKAGE));
ManifestElement[] dynamicImports = ManifestElement.parseHeader(Constants.DYNAMICIMPORT_PACKAGE, manifest.get(Constants.DYNAMICIMPORT_PACKAGE));
@@ -135,7 +135,7 @@ public class StateBuilder {
ManifestElement[] genericRequires = ManifestElement.parseHeader(GENERIC_REQUIRE, manifest.get(GENERIC_REQUIRE));
List<ManifestElement> aliasList = null;
if (genericAliases.length > 0) {
- aliasList = new ArrayList<ManifestElement>(genericRequires == null ? 0 : genericRequires.length);
+ aliasList = new ArrayList<>(genericRequires == null ? 0 : genericRequires.length);
for (int i = 0; i < genericAliases.length; i++) {
ManifestElement[] aliasReqs = ManifestElement.parseHeader(genericAliases[i][1], manifest.get(genericAliases[i][1]));
if (aliasReqs == null)
@@ -163,7 +163,7 @@ public class StateBuilder {
ManifestElement[] genericCapabilities = ManifestElement.parseHeader(GENERIC_CAPABILITY, manifest.get(GENERIC_CAPABILITY));
List<ManifestElement> aliasList = null;
if (genericAliases.length > 0) {
- aliasList = new ArrayList<ManifestElement>(genericCapabilities == null ? 0 : genericCapabilities.length);
+ aliasList = new ArrayList<>(genericCapabilities == null ? 0 : genericCapabilities.length);
for (int i = 0; i < genericAliases.length; i++) {
ManifestElement[] aliasCapabilities = ManifestElement.parseHeader(genericAliases[i][0], manifest.get(genericAliases[i][0]));
if (aliasCapabilities == null)
@@ -250,7 +250,7 @@ public class StateBuilder {
// add implicit imports for each exported package if manifest verions is less than 2.
if (exported.length == 0 && imported == null && dynamicImported == null)
return null;
- allImports = new ArrayList<ImportPackageSpecification>(exported.length + (imported == null ? 0 : imported.length));
+ allImports = new ArrayList<>(exported.length + (imported == null ? 0 : imported.length));
for (int i = 0; i < exported.length; i++) {
if (providedExports.contains(exported[i].getName()))
continue;
@@ -261,7 +261,7 @@ public class StateBuilder {
allImports.add(result);
}
} else {
- allImports = new ArrayList<ImportPackageSpecification>(imported == null ? 0 : imported.length);
+ allImports = new ArrayList<>(imported == null ? 0 : imported.length);
}
// add dynamics first so they will get overriden by static imports if
@@ -320,7 +320,7 @@ public class StateBuilder {
int numExports = (exported == null ? 0 : exported.length) + (provides == null ? 0 : provides.length);
if (numExports == 0)
return null;
- List<ExportPackageDescription> allExports = new ArrayList<ExportPackageDescription>(numExports);
+ List<ExportPackageDescription> allExports = new ArrayList<>(numExports);
if (exported != null)
for (int i = 0; i < exported.length; i++)
addExportPackages(exported[i], allExports, strict);
@@ -384,7 +384,7 @@ public class StateBuilder {
continue keyloop;
}
if (arbitraryDirectives == null)
- arbitraryDirectives = new HashMap<String, String>();
+ arbitraryDirectives = new HashMap<>();
arbitraryDirectives.put(key, element.getDirective(key));
}
return arbitraryDirectives;
@@ -413,7 +413,7 @@ public class StateBuilder {
}
if (!definedAttr) {
if (arbitraryAttrs == null)
- arbitraryAttrs = new HashMap<String, Object>();
+ arbitraryAttrs = new HashMap<>();
arbitraryAttrs.put(key, convertValue(type, value));
}
}
@@ -461,7 +461,7 @@ public class StateBuilder {
throw new RuntimeException("Invalid type, missing ending '>' : " + type); //$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));
}
@@ -494,8 +494,8 @@ public class StateBuilder {
if (brees == null || brees.length == 0)
return result;
if (result == null)
- result = new ArrayList<GenericSpecification>(brees.length);
- List<String> breeFilters = new ArrayList<String>();
+ result = new ArrayList<>(brees.length);
+ List<String> breeFilters = new ArrayList<>();
for (String bree : brees)
breeFilters.add(createOSGiEERequirementFilter(bree));
String filterSpec;
@@ -609,7 +609,7 @@ public class StateBuilder {
if (osgiRequires == null)
return result;
if (result == null)
- result = new ArrayList<GenericSpecification>();
+ result = new ArrayList<>();
for (ManifestElement element : osgiRequires) {
String[] namespaces = element.getValueComponents();
for (String namespace : namespaces) {
@@ -647,7 +647,7 @@ public class StateBuilder {
private static List<GenericSpecification> createEquinoxRequires(ManifestElement[] equinoxRequires) throws BundleException {
if (equinoxRequires == null)
return null;
- ArrayList<GenericSpecification> results = new ArrayList<GenericSpecification>(equinoxRequires.length);
+ ArrayList<GenericSpecification> results = new ArrayList<>(equinoxRequires.length);
for (int i = 0; i < equinoxRequires.length; i++) {
String[] genericNames = equinoxRequires[i].getValueComponents();
for (int j = 0; j < genericNames.length; j++) {
@@ -686,7 +686,7 @@ public class StateBuilder {
static List<GenericDescription> createOSGiCapabilities(ManifestElement[] osgiCapabilities, List<GenericDescription> result, BundleDescription description) throws BundleException {
if (result == null)
- result = new ArrayList<GenericDescription>(osgiCapabilities == null ? 1 : osgiCapabilities.length + 1);
+ result = new ArrayList<>(osgiCapabilities == null ? 1 : osgiCapabilities.length + 1);
// Always have an osgi.identity capability if there is a symbolic name.
GenericDescription osgiIdentity = createOsgiIdentityCapability(description);
if (osgiIdentity != null)
@@ -699,7 +699,7 @@ public class StateBuilder {
if (osgiCapabilities == null)
return result;
if (result == null)
- result = new ArrayList<GenericDescription>(osgiCapabilities.length);
+ result = new ArrayList<>(osgiCapabilities.length);
for (ManifestElement element : osgiCapabilities) {
String[] namespaces = element.getValueComponents();
@@ -712,9 +712,9 @@ public class StateBuilder {
Map<String, Object> mapAttrs = getAttributes(element, new String[0]);
if (profileIndex != null)
mapAttrs.put(ExportPackageDescriptionImpl.EQUINOX_EE, profileIndex);
- Dictionary<String, Object> attrs = mapAttrs == null ? new Hashtable<String, Object>() : new Hashtable<String, Object>(mapAttrs);
+ Dictionary<String, Object> attrs = mapAttrs == null ? new Hashtable<String, Object>() : new Hashtable<>(mapAttrs);
desc.setAttributes(attrs);
- Map<String, String> directives = new HashMap<String, String>();
+ Map<String, String> directives = new HashMap<>();
Enumeration<String> keys = element.getDirectiveKeys();
if (keys != null)
for (keys = element.getDirectiveKeys(); keys.hasMoreElements();) {
@@ -731,7 +731,7 @@ public class StateBuilder {
private static List<GenericDescription> createEquinoxCapabilities(ManifestElement[] equinoxCapabilities) throws BundleException {
if (equinoxCapabilities == null)
return null;
- ArrayList<GenericDescription> results = new ArrayList<GenericDescription>(equinoxCapabilities.length);
+ ArrayList<GenericDescription> results = new ArrayList<>(equinoxCapabilities.length);
for (int i = 0; i < equinoxCapabilities.length; i++) {
String[] genericNames = equinoxCapabilities[i].getValueComponents();
for (int j = 0; j < genericNames.length; j++) {
@@ -745,7 +745,7 @@ public class StateBuilder {
throw new BundleException("A bundle is not allowed to define a capability in the " + IdentityNamespace.IDENTITY_NAMESPACE + " name space."); //$NON-NLS-1$ //$NON-NLS-2$
}
Map<String, Object> mapAttrs = getAttributes(equinoxCapabilities[i], new String[] {Constants.VERSION_ATTRIBUTE});
- Dictionary<String, Object> attrs = mapAttrs == null ? new Hashtable<String, Object>() : new Hashtable<String, Object>(mapAttrs);
+ Dictionary<String, Object> attrs = mapAttrs == null ? new Hashtable<String, Object>() : new Hashtable<>(mapAttrs);
attrs.put(desc.getType(), name);
String versionString = equinoxCapabilities[i].getAttribute(Constants.VERSION_ATTRIBUTE);
if (versionString != null)
@@ -811,7 +811,7 @@ public class StateBuilder {
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();
@@ -893,7 +893,7 @@ public class StateBuilder {
return null;
GenericDescriptionImpl result = new GenericDescriptionImpl();
result.setType(IdentityNamespace.IDENTITY_NAMESPACE);
- Dictionary<String, Object> attributes = new Hashtable<String, Object>(description.getDeclaredAttributes());
+ Dictionary<String, Object> attributes = new Hashtable<>(description.getDeclaredAttributes());
// remove osgi.wiring.bundle and bundle-version attributes
attributes.remove(BundleNamespace.BUNDLE_NAMESPACE);
attributes.remove(Constants.BUNDLE_VERSION_ATTRIBUTE);
@@ -901,7 +901,7 @@ public class StateBuilder {
attributes.put(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE, description.getHost() == null ? IdentityNamespace.TYPE_BUNDLE : IdentityNamespace.TYPE_FRAGMENT);
attributes.put(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE, description.getVersion());
result.setAttributes(attributes);
- Map<String, String> directives = new HashMap<String, String>(description.getDeclaredDirectives());
+ Map<String, String> directives = new HashMap<>(description.getDeclaredDirectives());
// remove defaults directive values
if (!description.isSingleton())
directives.remove(Constants.SINGLETON_DIRECTIVE);
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateDeltaImpl.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateDeltaImpl.java
index 966a0224d..1e269f4a4 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateDeltaImpl.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateDeltaImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2011 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
@@ -22,7 +22,7 @@ final class StateDeltaImpl implements StateDelta {
private final State state;
- private final Map<BundleDescription, BundleDelta> changes = new HashMap<BundleDescription, BundleDelta>();
+ private final Map<BundleDescription, BundleDelta> changes = new HashMap<>();
private ResolverHookException error;
public StateDeltaImpl(State state) {
@@ -37,7 +37,7 @@ final class StateDeltaImpl implements StateDelta {
public BundleDelta[] getChanges(int mask, boolean exact) {
synchronized (this.changes) {
- List<BundleDelta> result = new ArrayList<BundleDelta>();
+ List<BundleDelta> result = new ArrayList<>();
for (Iterator<BundleDelta> changesIter = changes.values().iterator(); changesIter.hasNext();) {
BundleDelta change = changesIter.next();
if (mask == change.getType() || (!exact && (change.getType() & mask) != 0))
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.java
index 29f4e2b26..ad13c790a 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.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
@@ -37,7 +37,7 @@ public final class StateHelperImpl implements StateHelper {
if (bundles == null || bundles.length == 0)
return new BundleDescription[0];
- Set<BundleDescription> reachable = new HashSet<BundleDescription>(bundles.length);
+ Set<BundleDescription> reachable = new HashSet<>(bundles.length);
for (int i = 0; i < bundles.length; i++) {
if (!bundles[i].isResolved())
continue;
@@ -58,7 +58,7 @@ public final class StateHelperImpl implements StateHelper {
public BundleDescription[] getPrerequisites(BundleDescription[] bundles) {
if (bundles == null || bundles.length == 0)
return new BundleDescription[0];
- Set<BundleDescription> reachable = new HashSet<BundleDescription>(bundles.length);
+ Set<BundleDescription> reachable = new HashSet<>(bundles.length);
for (int i = 0; i < bundles.length; i++)
addPrerequisites(bundles[i], reachable);
return reachable.toArray(new BundleDescription[reachable.size()]);
@@ -75,7 +75,7 @@ public final class StateHelperImpl implements StateHelper {
}
private Map<String, List<ExportPackageDescription>> getExportedPackageMap(State state) {
- Map<String, List<ExportPackageDescription>> result = new HashMap<String, List<ExportPackageDescription>>();
+ Map<String, List<ExportPackageDescription>> result = new HashMap<>();
BundleDescription[] bundles = state.getBundles();
for (int i = 0; i < bundles.length; i++) {
ExportPackageDescription[] packages = bundles[i].getExportPackages();
@@ -83,7 +83,7 @@ public final class StateHelperImpl implements StateHelper {
ExportPackageDescription description = packages[j];
List<ExportPackageDescription> exports = result.get(description.getName());
if (exports == null) {
- exports = new ArrayList<ExportPackageDescription>();
+ exports = new ArrayList<>();
result.put(description.getName(), exports);
}
exports.add(description);
@@ -93,7 +93,7 @@ public final class StateHelperImpl implements StateHelper {
}
private Map<String, List<GenericDescription>> getGenericsMap(State state, boolean resolved) {
- Map<String, List<GenericDescription>> result = new HashMap<String, List<GenericDescription>>();
+ Map<String, List<GenericDescription>> result = new HashMap<>();
BundleDescription[] bundles = state.getBundles();
for (int i = 0; i < bundles.length; i++) {
if (resolved && !bundles[i].isResolved())
@@ -103,7 +103,7 @@ public final class StateHelperImpl implements StateHelper {
GenericDescription description = generics[j];
List<GenericDescription> genericList = result.get(description.getName());
if (genericList == null) {
- genericList = new ArrayList<GenericDescription>(1);
+ genericList = new ArrayList<>(1);
result.put(description.getName(), genericList);
}
genericList.add(description);
@@ -115,8 +115,8 @@ public final class StateHelperImpl implements StateHelper {
private VersionConstraint[] getUnsatisfiedLeaves(State state, BundleDescription[] bundles, ResolverHook hook) {
Map<String, List<ExportPackageDescription>> packages = getExportedPackageMap(state);
Map<String, List<GenericDescription>> generics = getGenericsMap(state, false);
- Set<VersionConstraint> result = new HashSet<VersionConstraint>();
- List<BundleDescription> bundleList = new ArrayList<BundleDescription>(bundles.length);
+ Set<VersionConstraint> result = new HashSet<>();
+ List<BundleDescription> bundleList = new ArrayList<>(bundles.length);
for (int i = 0; i < bundles.length; i++)
bundleList.add(bundles[i]);
for (int i = 0; i < bundleList.size(); i++) {
@@ -193,7 +193,7 @@ public final class StateHelperImpl implements StateHelper {
if (containingState == null)
// it is a bug in the client to call this method when not attached to a state
throw new IllegalStateException("Does not belong to a state"); //$NON-NLS-1$
- List<VersionConstraint> unsatisfied = new ArrayList<VersionConstraint>();
+ List<VersionConstraint> unsatisfied = new ArrayList<>();
HostSpecification host = bundle.getHost();
if (host != null)
if (!host.isResolved() && !isBundleConstraintResolvable(host, BundleRevision.HOST_NAMESPACE, hook))
@@ -225,14 +225,14 @@ public final class StateHelperImpl implements StateHelper {
}
private ArrayMap<BundleCapability, BaseDescription> asArrayMap(List<BaseDescription> descriptions, String namespace) {
- List<BundleCapability> capabilities = new ArrayList<BundleCapability>(descriptions.size());
+ List<BundleCapability> capabilities = new ArrayList<>(descriptions.size());
for (BaseDescription description : descriptions)
capabilities.add(((BaseDescriptionImpl) description).getCapability(namespace));
- return new ArrayMap<BundleCapability, BaseDescription>(capabilities, descriptions);
+ return new ArrayMap<>(capabilities, descriptions);
}
private List<BaseDescription> getPossibleCandidates(VersionConstraint constraint, BaseDescription[] descriptions, String namespace, ResolverHook hook, boolean resolved) {
- List<BaseDescription> candidates = new ArrayList<BaseDescription>();
+ List<BaseDescription> candidates = new ArrayList<>();
for (int i = 0; i < descriptions.length; i++)
if ((!resolved || descriptions[i].getSupplier().isResolved()) && constraint.isSatisfiedBy(descriptions[i]))
candidates.add(descriptions[i]);
@@ -300,7 +300,7 @@ public final class StateHelperImpl implements StateHelper {
}
public Object[][] sortBundles(BundleDescription[] toSort) {
- List<Object[]> references = new ArrayList<Object[]>(toSort.length);
+ List<Object[]> references = new ArrayList<>(toSort.length);
for (int i = 0; i < toSort.length; i++)
if (toSort[i].isResolved())
buildReferences(toSort[i], references);
@@ -391,9 +391,9 @@ public final class StateHelperImpl implements StateHelper {
if (state != null)
strict = state.inStrictMode();
BundleDescription host = (BundleDescription) (bundle.getHost() == null ? bundle : bundle.getHost().getSupplier());
- List<ExportPackageDescription> orderedPkgList = new ArrayList<ExportPackageDescription>(); // list of all ExportPackageDescriptions that are visible (ArrayList is used to keep order)
- Set<ExportPackageDescription> pkgSet = new HashSet<ExportPackageDescription>();
- Set<String> importList = new HashSet<String>(); // list of package names which are directly imported
+ List<ExportPackageDescription> orderedPkgList = new ArrayList<>(); // list of all ExportPackageDescriptions that are visible (ArrayList is used to keep order)
+ Set<ExportPackageDescription> pkgSet = new HashSet<>();
+ Set<String> importList = new HashSet<>(); // list of package names which are directly imported
// get the list of directly imported packages first.
ImportsHolder imports = new ImportsHolder(bundle, options);
for (int i = 0; i < imports.getSize(); i++) {
@@ -406,9 +406,9 @@ public final class StateHelperImpl implements StateHelper {
}
// get the sources of the required bundles of the exporter
BundleSpecification[] requires = pkgSupplier.getExporter().getRequiredBundles();
- Set<BundleDescription> visited = new HashSet<BundleDescription>();
+ Set<BundleDescription> visited = new HashSet<>();
visited.add(bundle); // always add self to prevent recursing into self
- Set<String> importNames = new HashSet<String>(1);
+ Set<String> importNames = new HashSet<>(1);
importNames.add(imports.getName(i));
for (int j = 0; j < requires.length; j++) {
BundleDescription bundleSupplier = (BundleDescription) requires[j].getSupplier();
@@ -420,7 +420,7 @@ public final class StateHelperImpl implements StateHelper {
}
// now find all the packages that are visible from required bundles
RequiresHolder requires = new RequiresHolder(bundle, options);
- Set<BundleDescription> visited = new HashSet<BundleDescription>(requires.getSize());
+ Set<BundleDescription> visited = new HashSet<>(requires.getSize());
visited.add(bundle); // always add self to prevent recursing into self
for (int i = 0; i < requires.getSize(); i++) {
BundleDescription bundleSupplier = requires.getSupplier(i);
@@ -443,7 +443,7 @@ public final class StateHelperImpl implements StateHelper {
for (int j = 0; j < imports.length; j++) {
if (substitutedExports[i].getName().equals(imports[j].getName()) && !pkgSet.contains(imports[j])) {
if (substituteNames == null)
- substituteNames = new HashSet<String>(1);
+ substituteNames = new HashSet<>(1);
else
substituteNames.clear();
// substituteNames is a set of one package containing the single substitute we are trying to get the source for
@@ -453,13 +453,13 @@ public final class StateHelperImpl implements StateHelper {
}
}
}
- importList = substitutedExports.length == 0 ? importList : new HashSet<String>(importList);
+ importList = substitutedExports.length == 0 ? importList : new HashSet<>(importList);
for (int i = 0; i < substitutedExports.length; i++)
// we add the package name to the import list to prevent required bundles from adding more sources
importList.add(substitutedExports[i].getName());
ExportPackageDescription[] exports = requiredBundle.getSelectedExports();
- HashSet<String> exportNames = new HashSet<String>(exports.length); // set is used to improve performance of duplicate check.
+ HashSet<String> exportNames = new HashSet<>(exports.length); // set is used to improve performance of duplicate check.
for (int i = 0; i < exports.length; i++)
if ((pkgNames == null || pkgNames.contains(exports[i].getName())) && !isSystemExport(exports[i], options) && isFriend(symbolicName, exports[i], strict) && !importList.contains(exports[i].getName()) && !pkgSet.contains(exports[i])) {
if (!exportNames.contains(exports[i].getName())) {
@@ -479,7 +479,7 @@ public final class StateHelperImpl implements StateHelper {
getPackages(requiredBundles.getSupplier(i), symbolicName, importList, orderedPkgList, pkgSet, visited, strict, pkgNames, options);
} else if (exportNames.size() > 0) {
// adding any exports from required bundles which we also export
- Set<BundleDescription> tmpVisited = new HashSet<BundleDescription>();
+ Set<BundleDescription> tmpVisited = new HashSet<>();
getPackages(requiredBundles.getSupplier(i), symbolicName, importList, orderedPkgList, pkgSet, tmpVisited, strict, exportNames, options);
}
}
@@ -577,7 +577,7 @@ class RequiresHolder {
isUsingResolved = (options & StateHelper.VISIBLE_INCLUDE_ALL_HOST_WIRES) != 0;
if (isUsingResolved) {
requiredBundles = null;
- resolvedBundlesExported = new HashMap<BundleDescription, Boolean>();
+ resolvedBundlesExported = new HashMap<>();
resolvedRequires = bundle.getResolvedRequires();
determineRequiresVisibility(bundle);
} else {
@@ -611,7 +611,7 @@ class RequiresHolder {
*/
private void determineRequiresVisibility(BundleDescription bundle) {
BundleSpecification[] required = bundle.getRequiredBundles();
- Set<BundleDescription> resolved = new HashSet<BundleDescription>();
+ Set<BundleDescription> resolved = new HashSet<>();
for (int i = 0; i < resolvedRequires.length; i++) {
resolved.add(resolvedRequires[i]);
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateImpl.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateImpl.java
index 5972e4363..163c88a4d 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateImpl.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateImpl.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
@@ -112,15 +112,15 @@ public abstract class StateImpl implements State {
transient private Resolver resolver;
transient private StateDeltaImpl changes;
transient private boolean resolving = false;
- transient private LinkedList<BundleDescription> removalPendings = new LinkedList<BundleDescription>();
+ transient private LinkedList<BundleDescription> removalPendings = new LinkedList<>();
private boolean resolved = true;
private long timeStamp = System.currentTimeMillis();
private final KeyedHashSet bundleDescriptions = new KeyedHashSet(false);
- private final Map<BundleDescription, List<ResolverError>> resolverErrors = new HashMap<BundleDescription, List<ResolverError>>();
+ private final Map<BundleDescription, List<ResolverError>> resolverErrors = new HashMap<>();
private StateObjectFactory factory;
private final KeyedHashSet resolvedBundles = new KeyedHashSet();
- private final Map<BundleDescription, List<DisabledInfo>> disabledBundles = new HashMap<BundleDescription, List<DisabledInfo>>();
+ private final Map<BundleDescription, List<DisabledInfo>> disabledBundles = new HashMap<>();
private boolean fullyLoaded = false;
private boolean dynamicCacheChanged = false;
// only used for lazy loading of BundleDescriptions
@@ -128,7 +128,7 @@ public abstract class StateImpl implements State {
@SuppressWarnings("unchecked")
private Dictionary<Object, Object>[] platformProperties = new Dictionary[] {new Hashtable<String, String>(PROPS.length)}; // Dictionary here because of Filter API
private long highestBundleId = -1;
- private final Set<String> platformPropertyKeys = new HashSet<String>(PROPS.length);
+ private final Set<String> platformPropertyKeys = new HashSet<>(PROPS.length);
private ResolverHookFactory hookFactory;
private ResolverHook hook;
private boolean developmentMode = false;
@@ -185,7 +185,7 @@ public abstract class StateImpl implements State {
resolvedBundles.remove(existing);
List<DisabledInfo> infos = disabledBundles.remove(existing);
if (infos != null) {
- List<DisabledInfo> newInfos = new ArrayList<DisabledInfo>(infos.size());
+ List<DisabledInfo> newInfos = new ArrayList<>(infos.size());
for (Iterator<DisabledInfo> iInfos = infos.iterator(); iInfos.hasNext();) {
DisabledInfo info = iInfos.next();
newInfos.add(new DisabledInfo(info.getPolicyName(), info.getMessage(), newDescription));
@@ -282,7 +282,7 @@ public abstract class StateImpl implements State {
synchronized (this.monitor) {
if (Constants.SYSTEM_BUNDLE_SYMBOLICNAME.equals(symbolicName))
symbolicName = getSystemBundle();
- final List<BundleDescription> bundles = new ArrayList<BundleDescription>();
+ final List<BundleDescription> bundles = new ArrayList<>();
for (Iterator<KeyedElement> iter = bundleDescriptions.iterator(); iter.hasNext();) {
BundleDescription bundle = (BundleDescription) iter.next();
if (symbolicName.equals(bundle.getSymbolicName()))
@@ -513,7 +513,7 @@ public abstract class StateImpl implements State {
if (reResolve == null)
reResolve = internalGetRemovalPending();
if (triggers == null) {
- Set<BundleDescription> triggerSet = new HashSet<BundleDescription>();
+ Set<BundleDescription> triggerSet = new HashSet<>();
Collection<BundleDescription> closure = getDependencyClosure(Arrays.asList(reResolve));
for (BundleDescription toRefresh : closure) {
Bundle bundle = toRefresh.getBundle();
@@ -527,7 +527,7 @@ public abstract class StateImpl implements State {
@SuppressWarnings("unchecked")
Headers<Object, Object>[] tmpPlatformProperties = new Headers[platformProperties.length];
for (int i = 0; i < platformProperties.length; i++) {
- tmpPlatformProperties[i] = new Headers<Object, Object>(platformProperties[i].size());
+ tmpPlatformProperties[i] = new Headers<>(platformProperties[i].size());
for (Enumeration<Object> keys = platformProperties[i].keys(); keys.hasMoreElements();) {
Object key = keys.nextElement();
tmpPlatformProperties[i].put(key, platformProperties[i].get(key));
@@ -568,7 +568,7 @@ public abstract class StateImpl implements State {
if (reResolve.length == 0)
return reResolve; // if reResolve length==0 then we want to prevent pending removal
// merge in all removal pending bundles that are not already in the list
- List<BundleDescription> result = new ArrayList<BundleDescription>(reResolve.length + removed.length);
+ List<BundleDescription> result = new ArrayList<>(reResolve.length + removed.length);
for (int i = 0; i < reResolve.length; i++)
result.add(reResolve[i]);
for (int i = 0; i < removed.length; i++) {
@@ -699,7 +699,7 @@ public abstract class StateImpl implements State {
public ExportPackageDescription[] getExportedPackages() {
fullyLoad();
synchronized (this.monitor) {
- List<ExportPackageDescription> allExportedPackages = new ArrayList<ExportPackageDescription>();
+ List<ExportPackageDescription> allExportedPackages = new ArrayList<>();
for (Iterator<KeyedElement> iter = resolvedBundles.iterator(); iter.hasNext();) {
BundleDescription bundle = (BundleDescription) iter.next();
ExportPackageDescription[] bundlePackages = bundle.getSelectedExports();
@@ -721,7 +721,7 @@ public abstract class StateImpl implements State {
}
BundleDescription[] getFragments(final BundleDescription host) {
- final List<BundleDescription> fragments = new ArrayList<BundleDescription>();
+ final List<BundleDescription> fragments = new ArrayList<>();
synchronized (this.monitor) {
for (Iterator<KeyedElement> iter = bundleDescriptions.iterator(); iter.hasNext();) {
BundleDescription bundle = (BundleDescription) iter.next();
@@ -812,7 +812,7 @@ public abstract class StateImpl implements State {
@SuppressWarnings("unchecked")
Dictionary<Object, Object>[] newPlatformProperties = new Dictionary[platformProperties.length];
for (int i = 0; i < platformProperties.length; i++) {
- newPlatformProperties[i] = new Hashtable<Object, Object>(platformProperties[i].size());
+ newPlatformProperties[i] = new Hashtable<>(platformProperties[i].size());
synchronized (platformProperties[i]) {
for (Enumeration<?> keys = platformProperties[i].keys(); keys.hasMoreElements();) {
Object key = keys.nextElement();
@@ -876,7 +876,7 @@ public abstract class StateImpl implements State {
for (int idx = 0; idx < systemBundles.length; idx++) {
BundleDescriptionImpl systemBundle = (BundleDescriptionImpl) systemBundles[idx];
ExportPackageDescription[] exports = systemBundle.getExportPackages();
- List<ExportPackageDescription> newExports = new ArrayList<ExportPackageDescription>(exports.length);
+ List<ExportPackageDescription> newExports = new ArrayList<>(exports.length);
for (int i = 0; i < exports.length; i++)
if (((Integer) exports[i].getDirective(ExportPackageDescriptionImpl.EQUINOX_EE)).intValue() < 0)
newExports.add(exports[i]);
@@ -910,7 +910,7 @@ public abstract class StateImpl implements State {
BundleDescription[] systemBundles = getBundles(Constants.SYSTEM_BUNDLE_SYMBOLICNAME);
for (BundleDescription systemBundle : systemBundles) {
GenericDescription[] capabilities = systemBundle.getGenericCapabilities();
- List<GenericDescription> newCapabilities = new ArrayList<GenericDescription>(capabilities.length);
+ List<GenericDescription> newCapabilities = new ArrayList<>(capabilities.length);
for (GenericDescription capability : capabilities) {
Object equinoxEEIndex = capability.getDeclaredAttributes().get(ExportPackageDescriptionImpl.EQUINOX_EE);
if (equinoxEEIndex == null)
@@ -940,14 +940,14 @@ public abstract class StateImpl implements State {
if (OSGI_EE_NAMESPACE.equals(capability.getType()) && profileIndex.equals(capability.getAttributes().get(ExportPackageDescriptionImpl.EQUINOX_EE)))
return; // profile already specifies osgi.ee capabilities
}
- Map<String, List<String>> eeVersions = new HashMap<String, List<String>>();
+ Map<String, List<String>> eeVersions = new HashMap<>();
String[] ees = ManifestElement.getArrayFromList(profileEE);
for (String ee : ees) {
String[] eeNameVersion = StateBuilder.getOSGiEENameVersion(ee);
List<String> versions = eeVersions.get(eeNameVersion[0]);
if (versions == null) {
- versions = new ArrayList<String>();
+ versions = new ArrayList<>();
eeVersions.put(eeNameVersion[0], versions);
}
if (eeNameVersion[1] != null && !versions.contains(eeNameVersion[1]))
@@ -956,10 +956,10 @@ public abstract class StateImpl implements State {
for (Map.Entry<String, List<String>> eeVersion : eeVersions.entrySet()) {
GenericDescriptionImpl capability = new GenericDescriptionImpl();
capability.setType(OSGI_EE_NAMESPACE);
- Dictionary<String, Object> attributes = new Hashtable<String, Object>();
+ Dictionary<String, Object> attributes = new Hashtable<>();
attributes.put(capability.getType(), eeVersion.getKey());
if (eeVersion.getValue().size() > 0) {
- List<Version> versions = new ArrayList<Version>(eeVersion.getValue().size());
+ List<Version> versions = new ArrayList<>(eeVersion.getValue().size());
for (String version : eeVersion.getValue()) {
versions.add(new Version(version));
}
@@ -1036,7 +1036,7 @@ public abstract class StateImpl implements State {
public Collection<BundleDescription> getDependencyClosure(Collection<BundleDescription> bundles) {
BundleDescription[] removals = getRemovalPending();
- Set<BundleDescription> result = new HashSet<BundleDescription>();
+ Set<BundleDescription> result = new HashSet<>();
for (BundleDescription bundle : bundles) {
addDependents(bundle, result, removals);
}
@@ -1086,7 +1086,7 @@ public abstract class StateImpl implements State {
resolving = true;
ResolverHookFactory currentFactory = hookFactory;
if (currentFactory != null) {
- Collection<BundleRevision> triggers = new ArrayList<BundleRevision>(1);
+ Collection<BundleRevision> triggers = new ArrayList<>(1);
triggers.add(importingBundle);
triggers = Collections.unmodifiableCollection(triggers);
currentHook = begin(triggers);
@@ -1165,7 +1165,7 @@ public abstract class StateImpl implements State {
public ExportPackageDescription[] getSystemPackages() {
synchronized (this.monitor) {
- List<ExportPackageDescription> result = new ArrayList<ExportPackageDescription>();
+ List<ExportPackageDescription> result = new ArrayList<>();
BundleDescription[] systemBundles = getBundles(Constants.SYSTEM_BUNDLE_SYMBOLICNAME);
if (systemBundles.length > 0) {
BundleDescriptionImpl systemBundle = (BundleDescriptionImpl) systemBundles[0];
@@ -1199,7 +1199,7 @@ public abstract class StateImpl implements State {
throw new IllegalStateException(); // TODO need error message here!
List<ResolverError> errors = resolverErrors.get(bundle);
if (errors == null) {
- errors = new ArrayList<ResolverError>(1);
+ errors = new ArrayList<>(1);
resolverErrors.put(bundle, errors);
}
errors.add(new ResolverErrorImpl((BundleDescriptionImpl) bundle, type, data, unsatisfied));
@@ -1266,7 +1266,7 @@ public abstract class StateImpl implements State {
throw new IllegalArgumentException(NLS.bind(StateMsg.BUNDLE_NOT_IN_STATE, disabledInfo.getBundle()));
List<DisabledInfo> currentInfos = disabledBundles.get(disabledInfo.getBundle());
if (currentInfos == null) {
- currentInfos = new ArrayList<DisabledInfo>(1);
+ currentInfos = new ArrayList<>(1);
currentInfos.add(disabledInfo);
disabledBundles.put(disabledInfo.getBundle(), currentInfos);
} else {
@@ -1324,7 +1324,7 @@ public abstract class StateImpl implements State {
* Used by StateWriter to get all the DisabledInfo objects to persist
*/
DisabledInfo[] getDisabledInfos() {
- List<DisabledInfo> results = new ArrayList<DisabledInfo>();
+ List<DisabledInfo> results = new ArrayList<>();
synchronized (this.monitor) {
for (Iterator<List<DisabledInfo>> allDisabledInfos = disabledBundles.values().iterator(); allDisabledInfos.hasNext();)
results.addAll(allDisabledInfos.next());
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateObjectFactoryImpl.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateObjectFactoryImpl.java
index 3561689e6..d5201f667 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateObjectFactoryImpl.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateObjectFactoryImpl.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
@@ -112,7 +112,7 @@ public class StateObjectFactoryImpl implements StateObjectFactory {
bundle.setExecutionEnvironments(executionEnvironments);
bundle.setGenericRequires(genericRequires);
- List<GenericDescription> includeIdentity = new ArrayList<GenericDescription>(genericCapabilities == null ? 1 : genericCapabilities.length + 1);
+ List<GenericDescription> includeIdentity = new ArrayList<>(genericCapabilities == null ? 1 : genericCapabilities.length + 1);
GenericDescription genericIdentity = StateBuilder.createOsgiIdentityCapability(bundle);
if (genericIdentity != null) {
includeIdentity.add(genericIdentity);
@@ -332,7 +332,7 @@ public class StateObjectFactoryImpl implements StateObjectFactory {
private GenericDescription createGenericDescription(String name, String type, Version version, Map<String, ?> attributes, Map<String, String> directives, BundleDescription supplier) {
GenericDescriptionImpl result = new GenericDescriptionImpl();
result.setType(type);
- Dictionary<String, Object> attrs = attributes == null ? new Hashtable<String, Object>() : new Hashtable<String, Object>(attributes);
+ Dictionary<String, Object> attrs = attributes == null ? new Hashtable<String, Object>() : new Hashtable<>(attributes);
if (version != null) {
Object versionObj = attrs.get(Constants.VERSION_ATTRIBUTE);
if (!(versionObj instanceof Version) && version != null)
@@ -509,7 +509,7 @@ public class StateObjectFactoryImpl implements StateObjectFactory {
ManifestElement[] elements = ManifestElement.parseHeader(Constants.REQUIRE_BUNDLE, declaration);
if (elements == null)
return Collections.<BundleSpecification> emptyList();
- List<BundleSpecification> result = new ArrayList<BundleSpecification>(elements.length);
+ List<BundleSpecification> result = new ArrayList<>(elements.length);
for (ManifestElement element : elements)
result.add(StateBuilder.createRequiredBundle(element));
return result;
@@ -523,7 +523,7 @@ public class StateObjectFactoryImpl implements StateObjectFactory {
ManifestElement[] elements = ManifestElement.parseHeader(Constants.FRAGMENT_HOST, declaration);
if (elements == null)
return Collections.<HostSpecification> emptyList();
- List<HostSpecification> result = new ArrayList<HostSpecification>(elements.length);
+ List<HostSpecification> result = new ArrayList<>(elements.length);
for (ManifestElement element : elements)
result.add(StateBuilder.createHostSpecification(element, null));
return result;
@@ -537,7 +537,7 @@ public class StateObjectFactoryImpl implements StateObjectFactory {
ManifestElement[] elements = ManifestElement.parseHeader(Constants.IMPORT_PACKAGE, declaration);
if (elements == null)
return Collections.<ImportPackageSpecification> emptyList();
- List<ImportPackageSpecification> result = new ArrayList<ImportPackageSpecification>(elements.length);
+ List<ImportPackageSpecification> result = new ArrayList<>(elements.length);
for (ManifestElement element : elements)
StateBuilder.addImportPackages(element, result, 2, false);
return result;
@@ -573,7 +573,7 @@ public class StateObjectFactoryImpl implements StateObjectFactory {
ManifestElement[] elements = ManifestElement.parseHeader(Constants.IMPORT_PACKAGE, declaration);
if (elements == null)
return Collections.<ExportPackageDescription> emptyList();
- List<ExportPackageDescription> result = new ArrayList<ExportPackageDescription>(elements.length);
+ List<ExportPackageDescription> result = new ArrayList<>(elements.length);
for (ManifestElement element : elements)
StateBuilder.addExportPackages(element, result, false);
return result;
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateReader.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateReader.java
index 149c0cb7d..a139e6252 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateReader.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateReader.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
@@ -104,7 +104,7 @@ final class StateReader {
int numSets = in.readInt();
Dictionary<?, ?>[] platformProps = new Dictionary[numSets];
for (int i = 0; i < numSets; i++) {
- Hashtable<Object, Object> props = new Hashtable<Object, Object>(platformPropKeys.length);
+ Hashtable<Object, Object> props = new Hashtable<>(platformPropKeys.length);
int numProps = in.readInt();
for (int j = 0; j < numProps; j++) {
Object value = readPlatformProp(in);
@@ -164,7 +164,7 @@ final class StateReader {
int numSets = in.readInt();
Dictionary<?, ?>[] platformProps = new Dictionary[numSets];
for (int i = 0; i < numSets; i++) {
- Hashtable<Object, Object> props = new Hashtable<Object, Object>(platformPropKeys.length);
+ Hashtable<Object, Object> props = new Hashtable<>(platformPropKeys.length);
int numProps = in.readInt();
for (int j = 0; j < numProps; j++) {
Object value = readPlatformProp(in);
@@ -335,7 +335,7 @@ final class StateReader {
int dynamicPkgCnt = in.readInt();
if (dynamicPkgCnt > 0) {
- HashMap<String, Long> dynamicStamps = new HashMap<String, Long>(dynamicPkgCnt);
+ HashMap<String, Long> dynamicStamps = new HashMap<>(dynamicPkgCnt);
for (int i = 0; i < dynamicPkgCnt; i++) {
String pkg = readString(in, false);
Long stamp = new Long(in.readLong());
@@ -432,7 +432,7 @@ final class StateReader {
int count = in.readInt();
if (count == 0)
return null;
- HashMap<String, Object> result = new HashMap<String, Object>(count);
+ HashMap<String, Object> result = new HashMap<>(count);
for (int i = 0; i < count; i++) {
String key = readString(in, false);
Object value = null;
@@ -467,7 +467,7 @@ final class StateReader {
} else if (type == 8) {
int listType = in.readByte();
int size = in.readInt();
- List<Object> list = new ArrayList<Object>(size);
+ List<Object> list = new ArrayList<>(size);
for (int j = 0; j < size; j++) {
switch (listType) {
case 0 :
@@ -607,7 +607,7 @@ final class StateReader {
result.setSupplier(readBundleDescription(in));
result.setType(readString(in, false));
Map<String, Object> mapAttrs = readMap(in);
- Dictionary<String, Object> attrs = new Hashtable<String, Object>();
+ Dictionary<String, Object> attrs = new Hashtable<>();
if (mapAttrs != null) {
for (Iterator<String> keys = mapAttrs.keySet().iterator(); keys.hasNext();) {
String key = keys.next();
@@ -718,8 +718,7 @@ final class StateReader {
int minorComponent = in.readInt();
int serviceComponent = in.readInt();
String qualifierComponent = readString(in, false);
- Version result = (Version) ObjectPool.intern(new Version(majorComponent, minorComponent, serviceComponent, qualifierComponent));
- //Version result = new Version(majorComponent, minorComponent, serviceComponent, qualifierComponent);
+ Version result = ObjectPool.intern(new Version(majorComponent, minorComponent, serviceComponent, qualifierComponent));
return result;
}
@@ -763,12 +762,12 @@ final class StateReader {
if (intern)
return string.intern();
- return (String) ObjectPool.intern(string);
+ return ObjectPool.intern(string);
}
if (intern)
return in.readUTF().intern();
- return (String) ObjectPool.intern(in.readUTF());
+ return ObjectPool.intern(in.readUTF());
}
private byte readTag(DataInputStream in) throws IOException {
@@ -818,7 +817,7 @@ final class StateReader {
try {
in = openLazyFile();
// get the set of bundles that must be loaded according to dependencies
- List<BundleDescriptionImpl> toLoad = new ArrayList<BundleDescriptionImpl>();
+ List<BundleDescriptionImpl> toLoad = new ArrayList<>();
addDependencies(target, toLoad);
int skipBytes[] = getSkipBytes(toLoad);
// look for the lazy data of the toLoad list
diff --git a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateWriter.java b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateWriter.java
index 28ebabc70..be522861b 100644
--- a/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateWriter.java
+++ b/bundles/org.eclipse.osgi.compatibility.state/src/org/eclipse/osgi/internal/resolver/StateWriter.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
@@ -27,9 +27,9 @@ class StateWriter {
// like BundleDescription, ExportPackageDescription, Version etc.. The integer
// index value will be used in the cache to allow cross-references in the
// cached state.
- private final Map<Object, Integer> objectTable = new HashMap<Object, Integer>();
+ private final Map<Object, Integer> objectTable = new HashMap<>();
- private final List<Object> forcedWrite = new ArrayList<Object>();
+ private final List<Object> forcedWrite = new ArrayList<>();
private int addToObjectTable(Object object) {
Integer cur = objectTable.get(object);
@@ -383,7 +383,7 @@ class StateWriter {
writeBundleDescription(description.getSupplier(), out, false);
writeStringOrNull(description.getType() == GenericDescription.DEFAULT_TYPE ? null : description.getType(), out);
Dictionary<String, Object> attrs = description.getAttributes();
- Map<String, Object> mapAttrs = new HashMap<String, Object>(attrs.size());
+ Map<String, Object> mapAttrs = new HashMap<>(attrs.size());
for (Enumeration<String> keys = attrs.keys(); keys.hasMoreElements();) {
String key = keys.nextElement();
mapAttrs.put(key, attrs.get(key));
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