Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Hammer2019-11-19 20:59:42 +0000
committerCarsten Hammer2019-12-13 17:57:11 +0000
commit42e3fcc319b639637559276fa037d25599302be5 (patch)
tree9a1aeed7421b08c23df8fb7625da639faee7a637
parent5e36a10cfcb63a762e6c1593064b8548f2ebf4f5 (diff)
downloadrt.equinox.bundles-42e3fcc319b639637559276fa037d25599302be5.tar.gz
rt.equinox.bundles-42e3fcc319b639637559276fa037d25599302be5.tar.xz
rt.equinox.bundles-42e3fcc319b639637559276fa037d25599302be5.zip
Use jdk 5 for-each loop
Replace simple uses of Iterator with a corresponding for-loop. Also add missing braces on loops as necessary. Change-Id: I0df5316b4d9700b94508e15cfba8f6f805d6a7ae Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
-rw-r--r--bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ConfigurationStore.java3
-rw-r--r--bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/PluginManager.java3
-rw-r--r--bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/internal/HttpServerManager.java3
-rw-r--r--bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/ContextController.java5
-rw-r--r--bundles/org.eclipse.equinox.jsp.jasper/src/org/eclipse/equinox/internal/jsp/jasper/JSPContextFinder.java16
-rw-r--r--bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java14
-rw-r--r--bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/ImmutableMap.java5
-rw-r--r--bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/InstancePreferences.java4
-rw-r--r--bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/tests/BundleInstaller.java3
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/adapter/AdapterManagerListener.java4
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/BaseExtensionPointHandle.java7
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/CombinedEventDelta.java4
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ConfigurationElement.java4
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionRegistry.java48
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionsParser.java8
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryIndexChildren.java6
-rw-r--r--bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryObjectManager.java30
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/wizard/CertificateImportCertSelectPage.java9
-rw-r--r--bundles/org.eclipse.equinox.servletbridge/src/org/eclipse/equinox/servletbridge/FrameworkLauncher.java5
-rw-r--r--bundles/org.eclipse.equinox.weaving.caching.j9/src/org/eclipse/equinox/weaving/internal/caching/j9/CachingService.java4
20 files changed, 79 insertions, 106 deletions
diff --git a/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ConfigurationStore.java b/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ConfigurationStore.java
index 16f385eb7..b92f76893 100644
--- a/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ConfigurationStore.java
+++ b/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ConfigurationStore.java
@@ -45,8 +45,7 @@ class ConfigurationStore {
return; // no persistent store
store.mkdir();
- File[] configurationFiles = store.listFiles();
- for (File configurationFile : configurationFiles) {
+ for (File configurationFile : store.listFiles()) {
String configurationFileName = configurationFile.getName();
if (!configurationFileName.endsWith(CFG_EXT))
continue;
diff --git a/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/PluginManager.java b/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/PluginManager.java
index 9b749c8b8..51c5ffc71 100644
--- a/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/PluginManager.java
+++ b/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/PluginManager.java
@@ -43,8 +43,7 @@ public class PluginManager {
if (properties == null)
return null;
- ServiceReference<ConfigurationPlugin>[] references = pluginTracker.getServiceReferences();
- for (ServiceReference<ConfigurationPlugin> reference : references) {
+ for (ServiceReference<ConfigurationPlugin> reference : pluginTracker.getServiceReferences()) {
Collection<?> pids = getStringProperty(reference.getProperty(ConfigurationPlugin.CM_TARGET));
if (pids != null) {
String pid = config.getFactoryPid();
diff --git a/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/internal/HttpServerManager.java b/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/internal/HttpServerManager.java
index 64808ff9b..42a63e856 100644
--- a/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/internal/HttpServerManager.java
+++ b/bundles/org.eclipse.equinox.http.jetty/src/org/eclipse/equinox/http/jetty/internal/HttpServerManager.java
@@ -208,8 +208,7 @@ public class HttpServerManager implements ManagedServiceFactory {
}
public synchronized void shutdown() throws Exception {
- for (Iterator<Server> it = servers.values().iterator(); it.hasNext();) {
- Server server = it.next();
+ for (Server server : servers.values()) {
server.stop();
}
servers.clear();
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/ContextController.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/ContextController.java
index 093e2b888..621f4380b 100644
--- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/ContextController.java
+++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/ContextController.java
@@ -969,10 +969,7 @@ public class ContextController {
List<FilterDTO> filterDTOs = new ArrayList<FilterDTO>();
- for (int i = 0; i < matchedFilterRegistrations.size() ; i++) {
- FilterRegistration filterRegistration =
- matchedFilterRegistrations.get(i);
-
+ for (FilterRegistration filterRegistration : matchedFilterRegistrations) {
if (Arrays.binarySearch(filterRegistration.getD().dispatcher, DispatcherType.REQUEST.toString()) > -1) {
filterDTOs.add(filterRegistration.getD());
}
diff --git a/bundles/org.eclipse.equinox.jsp.jasper/src/org/eclipse/equinox/internal/jsp/jasper/JSPContextFinder.java b/bundles/org.eclipse.equinox.jsp.jasper/src/org/eclipse/equinox/internal/jsp/jasper/JSPContextFinder.java
index 3df777872..29f945962 100644
--- a/bundles/org.eclipse.equinox.jsp.jasper/src/org/eclipse/equinox/internal/jsp/jasper/JSPContextFinder.java
+++ b/bundles/org.eclipse.equinox.jsp.jasper/src/org/eclipse/equinox/internal/jsp/jasper/JSPContextFinder.java
@@ -20,7 +20,6 @@ import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
// This class is a slightly augmented copy of org.eclipse.core.runtime.internal.adaptor.ContextFinder
@@ -127,10 +126,9 @@ public class JSPContextFinder extends ClassLoader implements PrivilegedAction<Ar
throw new ClassNotFoundException(arg0);
try {
- ArrayList<ClassLoader> toConsult = findClassLoaders();
- for (Iterator<ClassLoader> loaders = toConsult.iterator(); loaders.hasNext();)
+ for (ClassLoader classLoader : findClassLoaders())
try {
- return loaders.next().loadClass(arg0);
+ return classLoader.loadClass(arg0);
} catch (ClassNotFoundException e) {
// go to the next class loader
}
@@ -146,9 +144,8 @@ public class JSPContextFinder extends ClassLoader implements PrivilegedAction<Ar
if (startLoading(arg0) == false)
return null;
try {
- ArrayList<ClassLoader> toConsult = findClassLoaders();
- for (Iterator<ClassLoader> loaders = toConsult.iterator(); loaders.hasNext();) {
- URL result = loaders.next().getResource(arg0);
+ for (ClassLoader classLoader : findClassLoaders()) {
+ URL result = classLoader.getResource(arg0);
if (result != null)
return result;
// go to the next class loader
@@ -165,9 +162,8 @@ public class JSPContextFinder extends ClassLoader implements PrivilegedAction<Ar
if (startLoading(arg0) == false)
return null;
try {
- ArrayList<ClassLoader> toConsult = findClassLoaders();
- for (Iterator<ClassLoader> loaders = toConsult.iterator(); loaders.hasNext();) {
- Enumeration<URL> result = loaders.next().getResources(arg0);
+ for (ClassLoader classLoader : findClassLoaders()) {
+ Enumeration<URL> result = classLoader.getResources(arg0);
if (result != null && result.hasMoreElements())
return result;
// go to the next class loader
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
index 07aadc255..a9a125fc3 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/EclipsePreferences.java
@@ -243,8 +243,8 @@ public class EclipsePreferences implements IEclipsePreferences, IScope {
// ignore for now
}
table.remove(VERSION_KEY);
- for (Iterator<?> i = table.keySet().iterator(); i.hasNext();) {
- String fullKey = (String) i.next();
+ for (Object propName : table.keySet()) {
+ String fullKey = (String) propName;
String value = table.getProperty(fullKey);
if (value != null) {
String[] splitPath = decodePath(fullKey);
@@ -320,15 +320,13 @@ public class EclipsePreferences implements IEclipsePreferences, IScope {
synchronized (childAndPropertyLock) {
temp = properties;
}
- String[] keys = temp.keys();
- for (int i = 0, imax = keys.length; i < imax; i++) {
- String value = temp.get(keys[i]);
+ for (String key : temp.keys()) {
+ String value = temp.get(key);
if (value != null)
- result.put(encodePath(prefix, keys[i]), value);
+ result.put(encodePath(prefix, key), value);
}
// recursively add the child information
- IEclipsePreferences[] childNodes = getChildren(true);
- for (IEclipsePreferences childNode : childNodes) {
+ for (IEclipsePreferences childNode : getChildren(true)) {
EclipsePreferences child = (EclipsePreferences) childNode;
String fullPath = addSeparator ? prefix + PATH_SEPARATOR + child.name() : child.name();
child.convertToProperties(result, fullPath);
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/ImmutableMap.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/ImmutableMap.java
index dc93f069b..93309eb7a 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/ImmutableMap.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/ImmutableMap.java
@@ -282,9 +282,8 @@ public abstract class ImmutableMap implements Cloneable {
@Override
public String toString() {
StringBuilder s = new StringBuilder();
- String[] keys = keys();
- for (int i = 0, length = keys.length; i < length; i++)
- s.append(keys[i]).append(" -> ").append(get(keys[i])).append("\n"); //$NON-NLS-2$ //$NON-NLS-1$
+ for (String key : keys())
+ s.append(key).append(" -> ").append(get(key)).append("\n"); //$NON-NLS-2$ //$NON-NLS-1$
return s.toString();
}
}
diff --git a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/InstancePreferences.java b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/InstancePreferences.java
index 5f4fa881e..6a95b4dcd 100644
--- a/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/InstancePreferences.java
+++ b/bundles/org.eclipse.equinox.preferences/src/org/eclipse/core/internal/preferences/InstancePreferences.java
@@ -153,8 +153,8 @@ public class InstancePreferences extends EclipsePreferences {
}
// Store values in the preferences object
- for (Iterator<?> i = values.keySet().iterator(); i.hasNext();) {
- String key = (String) i.next();
+ for (Object propName : values.keySet()) {
+ String key = (String) propName;
String value = values.getProperty(key);
// value shouldn't be null but check just in case...
if (value != null) {
diff --git a/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/tests/BundleInstaller.java b/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/tests/BundleInstaller.java
index c269c44c2..e7a550532 100644
--- a/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/tests/BundleInstaller.java
+++ b/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/region/tests/BundleInstaller.java
@@ -138,8 +138,7 @@ public class BundleInstaller {
if (bundles == null)
return null;
List<Bundle> result = new ArrayList<Bundle>(bundles.size());
- for (Iterator<Bundle> iter = bundles.values().iterator(); iter.hasNext();) {
- Bundle bundle = iter.next();
+ for (Bundle bundle : bundles.values()) {
try {
bundle.uninstall();
} catch (IllegalStateException e) {
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/adapter/AdapterManagerListener.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/adapter/AdapterManagerListener.java
index 688b22cb2..a540f7828 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/adapter/AdapterManagerListener.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/adapter/AdapterManagerListener.java
@@ -84,8 +84,8 @@ public final class AdapterManagerListener implements IRegistryEventListener, IAd
public synchronized void removed(IExtension[] extensions) {
theAdapterManager.flushLookup();
for (IExtension extension : extensions) {
- for (Iterator<List<IAdapterFactory>> it = theAdapterManager.getFactories().values().iterator(); it.hasNext();) {
- for (Iterator<IAdapterFactory> it2 = (it.next()).iterator(); it2.hasNext();) {
+ for (List<IAdapterFactory> adapterFactories : theAdapterManager.getFactories().values()) {
+ for (Iterator<IAdapterFactory> it2 = (adapterFactories).iterator(); it2.hasNext();) {
IAdapterFactory factory = it2.next();
if (!(factory instanceof AdapterFactoryProxy))
continue;
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/BaseExtensionPointHandle.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/BaseExtensionPointHandle.java
index 995a15386..e99a42079 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/BaseExtensionPointHandle.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/BaseExtensionPointHandle.java
@@ -60,11 +60,10 @@ public class BaseExtensionPointHandle extends Handle implements IExtensionPoint
public IExtension getExtension(String extensionId) {
if (extensionId == null)
return null;
- int[] children = getExtensionPoint().getRawChildren();
- for (int i = 0; i < children.length; i++) {
+ for (int element : getExtensionPoint().getRawChildren()) {
// Here we directly get the object because it avoids the creation of garbage and because we'll need the object anyway to compare the value
- if (extensionId.equals(((Extension) objectManager.getObject(children[i], RegistryObjectManager.EXTENSION)).getUniqueIdentifier()))
- return (ExtensionHandle) objectManager.getHandle(children[i], RegistryObjectManager.EXTENSION);
+ if (extensionId.equals(((Extension) objectManager.getObject(element, RegistryObjectManager.EXTENSION)).getUniqueIdentifier()))
+ return (ExtensionHandle) objectManager.getHandle(element, RegistryObjectManager.EXTENSION);
}
return null;
}
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/CombinedEventDelta.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/CombinedEventDelta.java
index 98ccce132..08cddf16c 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/CombinedEventDelta.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/CombinedEventDelta.java
@@ -127,8 +127,8 @@ public class CombinedEventDelta {
return;
if (exts.length == 0)
return;
- for (int i = 0; i < exts.length; i++)
- rememberExtension(extensionPoint, exts[i]);
+ for (int ext : exts)
+ rememberExtension(extensionPoint, ext);
}
public IExtensionPoint[] getExtensionPoints(String id) {
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ConfigurationElement.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ConfigurationElement.java
index 479d0f0eb..3f714db10 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ConfigurationElement.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ConfigurationElement.java
@@ -140,8 +140,8 @@ public class ConfigurationElement extends RegistryObject {
ConfigurationElement[] result = new ConfigurationElement[1]; //Most of the time there is only one match
int idx = 0;
RegistryObjectManager objectManager = registry.getObjectManager();
- for (int i = 0; i < children.length; i++) {
- ConfigurationElement toTest = (ConfigurationElement) objectManager.getObject(children[i], noExtraData() ? RegistryObjectManager.CONFIGURATION_ELEMENT : RegistryObjectManager.THIRDLEVEL_CONFIGURATION_ELEMENT);
+ for (int child : children) {
+ ConfigurationElement toTest = (ConfigurationElement) objectManager.getObject(child, noExtraData() ? RegistryObjectManager.CONFIGURATION_ELEMENT : RegistryObjectManager.THIRDLEVEL_CONFIGURATION_ELEMENT);
if (toTest.name.equals(childrenName)) {
if (idx != 0) {
ConfigurationElement[] copy = new ConfigurationElement[result.length + 1];
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionRegistry.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionRegistry.java
index 25f44b892..9ad03f6bd 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionRegistry.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionRegistry.java
@@ -187,15 +187,13 @@ public class ExtensionRegistry implements IExtensionRegistry, IDynamicExtensionR
private Set<String> addExtensionsAndExtensionPoints(Contribution element) {
// now add and resolve extensions and extension points
Set<String> affectedNamespaces = new HashSet<>();
- int[] extPoints = element.getExtensionPoints();
- for (int i = 0; i < extPoints.length; i++) {
- String namespace = this.addExtensionPoint(extPoints[i]);
+ for (int extPoint : element.getExtensionPoints()) {
+ String namespace = this.addExtensionPoint(extPoint);
if (namespace != null)
affectedNamespaces.add(namespace);
}
- int[] extensions = element.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- String namespace = this.addExtension(extensions[i]);
+ for (int extension : element.getExtensions()) {
+ String namespace = this.addExtension(extension);
if (namespace != null)
affectedNamespaces.add(namespace);
}
@@ -238,8 +236,8 @@ public class ExtensionRegistry implements IExtensionRegistry, IDynamicExtensionR
}
private void setObjectManagers(Set<String> affectedNamespaces, IObjectManager manager) {
- for (Iterator<String> iter = affectedNamespaces.iterator(); iter.hasNext();) {
- getDelta(iter.next()).setObjectManager(manager);
+ for (String namespace : affectedNamespaces) {
+ getDelta(namespace).setObjectManager(manager);
}
if (eventDelta != null)
eventDelta.setObjectManager(manager);
@@ -358,8 +356,7 @@ public class ExtensionRegistry implements IExtensionRegistry, IDynamicExtensionR
} finally {
access.exitRead();
}
- for (int i = 0; i < extensions.length; i++) {
- ExtensionHandle suspect = extensions[i];
+ for (ExtensionHandle suspect : extensions) {
if (extensionId.equals(suspect.getUniqueIdentifier()))
return suspect;
}
@@ -554,9 +551,9 @@ public class ExtensionRegistry implements IExtensionRegistry, IDynamicExtensionR
if (extensions == null || extensions.length == 0)
return namespace;
RegistryDelta pluginDelta = getDelta(extPoint.getNamespace());
- for (int i = 0; i < extensions.length; i++) {
+ for (int extension : extensions) {
ExtensionDelta extensionDelta = new ExtensionDelta();
- extensionDelta.setExtension(extensions[i]);
+ extensionDelta.setExtension(extension);
extensionDelta.setExtensionPoint(extPoint.getObjectId());
extensionDelta.setKind(kind);
pluginDelta.addExtensionDelta(extensionDelta);
@@ -645,17 +642,15 @@ public class ExtensionRegistry implements IExtensionRegistry, IDynamicExtensionR
private Set<String> removeExtensionsAndExtensionPoints(String contributorId) {
Set<String> affectedNamespaces = new HashSet<>();
- int[] extensions = registryObjects.getExtensionsFrom(contributorId);
- for (int i = 0; i < extensions.length; i++) {
- String namespace = this.removeExtension(extensions[i]);
+ for (int extension : registryObjects.getExtensionsFrom(contributorId)) {
+ String namespace = this.removeExtension(extension);
if (namespace != null)
affectedNamespaces.add(namespace);
}
// remove extension points
- int[] extPoints = registryObjects.getExtensionPointsFrom(contributorId);
- for (int i = 0; i < extPoints.length; i++) {
- String namespace = this.removeExtensionPoint(extPoints[i]);
+ for (int extPoint : registryObjects.getExtensionPointsFrom(contributorId)) {
+ String namespace = this.removeExtensionPoint(extPoint);
if (namespace != null)
affectedNamespaces.add(namespace);
}
@@ -836,10 +831,9 @@ public class ExtensionRegistry implements IExtensionRegistry, IDynamicExtensionR
* Clear the registry cache files from the file manager so on next start-up we recompute it.
*/
public void clearRegistryCache() {
- String[] keys = new String[] {TableReader.TABLE, TableReader.MAIN, TableReader.EXTRA, TableReader.CONTRIBUTIONS, TableReader.ORPHANS};
- for (int i = 0; i < keys.length; i++)
+ for (String key : new String[] {TableReader.TABLE, TableReader.MAIN, TableReader.EXTRA, TableReader.CONTRIBUTIONS, TableReader.ORPHANS})
try {
- cacheStorageManager.remove(keys[i]);
+ cacheStorageManager.remove(key);
} catch (IOException e) {
log(new Status(IStatus.ERROR, RegistryMessages.OWNER_NAME, IStatus.ERROR, RegistryMessages.meta_registryCacheReadProblems, e));
}
@@ -937,8 +931,8 @@ public class ExtensionRegistry implements IExtensionRegistry, IDynamicExtensionR
final CombinedEventDelta extendedDelta = (CombinedEventDelta) scheduledDeltas.remove(notNamespace);
final MultiStatus result = new MultiStatus(RegistryMessages.OWNER_NAME, IStatus.OK, RegistryMessages.plugin_eventListenerError, null);
- for (int i = 0; i < listenerInfos.length; i++) {
- final ListenerInfo listenerInfo = (ListenerInfo) listenerInfos[i];
+ for (Object info : listenerInfos) {
+ final ListenerInfo listenerInfo = (ListenerInfo) info;
if ((listenerInfo.listener instanceof IRegistryChangeListener) && scheduledDeltas.size() != 0) {
if (listenerInfo.filter == null || scheduledDeltas.containsKey(listenerInfo.filter)) {
SafeRunner.run(new ISafeRunnable() {
@@ -973,8 +967,8 @@ public class ExtensionRegistry implements IExtensionRegistry, IDynamicExtensionR
}
}
}
- for (Iterator<?> iter = scheduledDeltas.values().iterator(); iter.hasNext();) {
- ((RegistryDelta) iter.next()).getObjectManager().close();
+ for (Object delta : scheduledDeltas.values()) {
+ ((RegistryDelta) delta).getObjectManager().close();
}
IObjectManager manager = extendedDelta.getObjectManager();
if (manager != null)
@@ -1311,8 +1305,8 @@ public class ExtensionRegistry implements IExtensionRegistry, IDynamicExtensionR
// process children
ConfigurationElementDescription[] children = description.getChildren();
if (children != null) {
- for (int i = 0; i < children.length; i++) {
- createExtensionData(contributorId, children[i], currentConfigurationElement, persist);
+ for (ConfigurationElementDescription element : children) {
+ createExtensionData(contributorId, element, currentConfigurationElement, persist);
}
}
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionsParser.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionsParser.java
index f393203ad..689c80498 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionsParser.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/ExtensionsParser.java
@@ -219,8 +219,8 @@ public class ExtensionsParser extends DefaultHandler {
// Put the extension points into this namespace
if (extensionPoints.size() > 0) {
namespaceChildren[Contribution.EXTENSION_POINT] = extensionPoints.size();
- for (Iterator<?> iter = extensionPoints.iterator(); iter.hasNext();) {
- namespaceChildren[position++] = ((RegistryObject) iter.next()).getObjectId();
+ for (Object extPoint : extensionPoints) {
+ namespaceChildren[position++] = ((RegistryObject) extPoint).getObjectId();
}
extensionPoints.clear();
}
@@ -494,8 +494,8 @@ public class ExtensionsParser extends DefaultHandler {
String msg = NLS.bind(RegistryMessages.parse_duplicateExtension, new String[] {currentSupplier, existingSupplier, uniqueId});
registry.log(new Status(IStatus.WARNING, RegistryMessages.OWNER_NAME, 0, msg, null));
} else if (processedExtensionIds != null) { // check elements in this contribution
- for (Iterator<String> i = processedExtensionIds.iterator(); i.hasNext();) {
- if (uniqueId.equals(i.next())) {
+ for (String extensionId : processedExtensionIds) {
+ if (uniqueId.equals(extensionId)) {
String currentSupplier = contribution.getDefaultNamespace();
String existingSupplier = currentSupplier;
String msg = NLS.bind(RegistryMessages.parse_duplicateExtension, new String[] {currentSupplier, existingSupplier, uniqueId});
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryIndexChildren.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryIndexChildren.java
index 37dbf2fa9..ac221630a 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryIndexChildren.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryIndexChildren.java
@@ -96,10 +96,10 @@ public class RegistryIndexChildren {
}
int[] result = new int[size];
int pos = 0;
- for (int i = 0; i < children.length; i++) {
- if (children[i] == -1)
+ for (int child : children) {
+ if (child == -1)
continue;
- result[pos] = children[i];
+ result[pos] = child;
pos++;
}
return true;
diff --git a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryObjectManager.java b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryObjectManager.java
index 92bf7562f..6f0af64d2 100644
--- a/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryObjectManager.java
+++ b/bundles/org.eclipse.equinox.registry/src/org/eclipse/core/internal/registry/RegistryObjectManager.java
@@ -660,14 +660,14 @@ public class RegistryObjectManager implements IObjectManager {
int[] xpts = getExtensionPointsFrom(contributionId);
int[] exts = getExtensionsFrom(contributionId);
Map<Integer, RegistryObject> actualObjects = new HashMap<>(xpts.length + exts.length);
- for (int i = 0; i < exts.length; i++) {
- Extension tmp = (Extension) basicGetObject(exts[i], RegistryObjectManager.EXTENSION);
- actualObjects.put(Integer.valueOf(exts[i]), tmp);
+ for (int ext : exts) {
+ Extension tmp = (Extension) basicGetObject(ext, RegistryObjectManager.EXTENSION);
+ actualObjects.put(Integer.valueOf(ext), tmp);
collectChildren(tmp, 0, actualObjects);
}
- for (int i = 0; i < xpts.length; i++) {
- ExtensionPoint xpt = (ExtensionPoint) basicGetObject(xpts[i], RegistryObjectManager.EXTENSION_POINT);
- actualObjects.put(Integer.valueOf(xpts[i]), xpt);
+ for (int xpt2 : xpts) {
+ ExtensionPoint xpt = (ExtensionPoint) basicGetObject(xpt2, RegistryObjectManager.EXTENSION_POINT);
+ actualObjects.put(Integer.valueOf(xpt2), xpt);
}
return actualObjects;
@@ -698,12 +698,11 @@ public class RegistryObjectManager implements IObjectManager {
result.put(Integer.valueOf(extPoint.getKeyHashCode()), extPoint);
// add all extensions for the extension point
- int[] extensions = extPoint.getRawChildren();
- for (int j = 0; j < extensions.length; j++) {
- Extension tmp = (Extension) basicGetObject(extensions[j], RegistryObjectManager.EXTENSION);
+ for (int childId : extPoint.getRawChildren()) {
+ Extension tmp = (Extension) basicGetObject(childId, RegistryObjectManager.EXTENSION);
if (tmp == null) // already removed
continue;
- Integer extensionIndex = Integer.valueOf(extensions[j]);
+ Integer extensionIndex = Integer.valueOf(childId);
if (!associatedObjects.containsKey(extensionIndex)) {
result.put(extensionIndex, tmp);
collectChildren(tmp, 0, result);
@@ -715,11 +714,11 @@ public class RegistryObjectManager implements IObjectManager {
String name = ((ExtensionPoint) object).getUniqueIdentifier();
int[] extensions = orphans.get(name);
if (extensions != null) {
- for (int j = 0; j < extensions.length; j++) {
- Extension tmp = (Extension) basicGetObject(extensions[j], RegistryObjectManager.EXTENSION);
+ for (int orphanId : extensions) {
+ Extension tmp = (Extension) basicGetObject(orphanId, RegistryObjectManager.EXTENSION);
if (tmp == null) // already removed
continue;
- Integer extensionIndex = Integer.valueOf(extensions[j]);
+ Integer extensionIndex = Integer.valueOf(orphanId);
if (!associatedObjects.containsKey(extensionIndex)) {
result.put(extensionIndex, tmp);
collectChildren(tmp, 0, result);
@@ -733,9 +732,8 @@ public class RegistryObjectManager implements IObjectManager {
synchronized void removeObjects(Map<?, ?> associatedObjects) {
//Remove the objects from the main object manager so they can no longer be accessed.
- Collection<?> allValues = associatedObjects.values();
- for (Iterator<?> iter = allValues.iterator(); iter.hasNext();) {
- RegistryObject toRemove = (RegistryObject) iter.next();
+ for (Object registryObject : associatedObjects.values()) {
+ RegistryObject toRemove = (RegistryObject) registryObject;
remove((toRemove).getObjectId(), true);
if (toRemove instanceof ExtensionPoint)
removeExtensionPoint(((ExtensionPoint) toRemove).getUniqueIdentifier());
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/wizard/CertificateImportCertSelectPage.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/wizard/CertificateImportCertSelectPage.java
index 795e08e31..7a799ac5d 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/wizard/CertificateImportCertSelectPage.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/wizard/CertificateImportCertSelectPage.java
@@ -79,10 +79,9 @@ public class CertificateImportCertSelectPage extends WizardPage implements Liste
try {
certList = new ArrayList<>();
- Collection<? extends Certificate> collection = certFact.generateCertificates(new FileInputStream(certImportWizard.selectedImportFile));
// For a set or list
- for (Iterator<? extends Certificate> it = collection.iterator(); it.hasNext();) {
- certList.add(it.next());
+ for (Certificate certificate : certFact.generateCertificates(new FileInputStream(certImportWizard.selectedImportFile))) {
+ certList.add(certificate);
}
} catch (CertificateException e) {
@@ -91,8 +90,8 @@ public class CertificateImportCertSelectPage extends WizardPage implements Liste
setErrorMessage(e.getMessage());
}
- for (int i = 0; i < certList.size(); i++) {
- X509Certificate x509Cert = (X509Certificate) certList.get(i);
+ for (Certificate certificate : certList) {
+ X509Certificate x509Cert = (X509Certificate) certificate;
String subjectDN = x509Cert.getSubjectDN().getName();
certDropDown.add(subjectDN);
}
diff --git a/bundles/org.eclipse.equinox.servletbridge/src/org/eclipse/equinox/servletbridge/FrameworkLauncher.java b/bundles/org.eclipse.equinox.servletbridge/src/org/eclipse/equinox/servletbridge/FrameworkLauncher.java
index bfcdc5898..66bddb4eb 100644
--- a/bundles/org.eclipse.equinox.servletbridge/src/org/eclipse/equinox/servletbridge/FrameworkLauncher.java
+++ b/bundles/org.eclipse.equinox.servletbridge/src/org/eclipse/equinox/servletbridge/FrameworkLauncher.java
@@ -678,9 +678,8 @@ public class FrameworkLauncher {
* clearPrefixedSystemProperties clears System Properties by writing null properties in the targetPropertyMap that match a prefix
*/
private static void clearPrefixedSystemProperties(String prefix, Map<String, String> targetPropertyMap) {
- for (@SuppressWarnings("rawtypes")
- Iterator it = System.getProperties().keySet().iterator(); it.hasNext();) {
- String propertyName = (String) it.next();
+ for (Object key : System.getProperties().keySet()) {
+ String propertyName = (String) key;
if (propertyName.startsWith(prefix) && !targetPropertyMap.containsKey(propertyName)) {
targetPropertyMap.put(propertyName, null);
}
diff --git a/bundles/org.eclipse.equinox.weaving.caching.j9/src/org/eclipse/equinox/weaving/internal/caching/j9/CachingService.java b/bundles/org.eclipse.equinox.weaving.caching.j9/src/org/eclipse/equinox/weaving/internal/caching/j9/CachingService.java
index cfd77887c..ee6f7485c 100644
--- a/bundles/org.eclipse.equinox.weaving.caching.j9/src/org/eclipse/equinox/weaving/internal/caching/j9/CachingService.java
+++ b/bundles/org.eclipse.equinox.weaving.caching.j9/src/org/eclipse/equinox/weaving/internal/caching/j9/CachingService.java
@@ -101,10 +101,8 @@ public class CachingService implements ICachingService {
} catch (final NoSuchAlgorithmException e) {
e.printStackTrace();
}
- final byte[] bytes = md.digest(namespace.getBytes());
final StringBuffer result = new StringBuffer();
- for (int i = 0; i < bytes.length; i++) {
- final byte b = bytes[i];
+ for (final byte b : md.digest(namespace.getBytes())) {
int num;
if (b < 0) {
num = b + 256;

Back to the top