Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Hammer2019-07-05 18:33:32 +0000
committerCarsten Hammer2019-07-14 18:49:03 +0000
commitffec1a4ff7435f6a3397429c587d7258d1c1deab (patch)
treefe16d698303763c8a0e1bbfd93d99cc2070c769f
parent0f5bf99a54101b35af6783802ad0e174ac5fa15e (diff)
downloadrt.equinox.bundles-ffec1a4ff7435f6a3397429c587d7258d1c1deab.tar.gz
rt.equinox.bundles-ffec1a4ff7435f6a3397429c587d7258d1c1deab.tar.xz
rt.equinox.bundles-ffec1a4ff7435f6a3397429c587d7258d1c1deab.zip
Use jdk 5 for-each-loop (app, cm, cm.test, common)
Replace most simple uses of Iterator with a corresponding for-each-loop. Also add missing braces on loops as necessary. Change-Id: I0dcaa50a43e0ff3b450f386dfa856d75bdcb6cbf Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
-rw-r--r--bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/Activator.java8
-rw-r--r--bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/AppCommands.java36
-rw-r--r--bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/AppPersistence.java11
-rw-r--r--bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppContainer.java33
-rw-r--r--bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppHandle.java6
-rw-r--r--bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/ProductExtensionBranding.java3
-rw-r--r--bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/Activator.java6
-rw-r--r--bundles/org.eclipse.equinox.cm/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.cm/pom.xml4
-rw-r--r--bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ConfigurationAdminImpl.java8
-rw-r--r--bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/reliablefile/ReliableFile.java19
-rw-r--r--bundles/org.eclipse.equinox.common.tests/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.common.tests/pom.xml4
-rw-r--r--bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/WaitingRegistryListener.java6
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/Activator.java6
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/AdapterManager.java30
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/FindSupport.java8
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PlatformLogWriter.java4
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PrintStackUtil.java16
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/ReferenceHashSet.java7
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/ResourceTranslator.java18
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/RuntimeLog.java16
22 files changed, 131 insertions, 122 deletions
diff --git a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/Activator.java b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/Activator.java
index 5773e0732..9834f8b20 100644
--- a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/Activator.java
+++ b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/Activator.java
@@ -225,9 +225,11 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer {
if (bundles == null)
return null;
//Return the first bundle that is not installed or uninstalled
- for (int i = 0; i < bundles.length; i++)
- if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0)
- return bundles[i];
+ for (Bundle bundle : bundles) {
+ if ((bundle.getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) {
+ return bundle;
+ }
+ }
return null;
}
diff --git a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/AppCommands.java b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/AppCommands.java
index b8c57180d..a43695903 100644
--- a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/AppCommands.java
+++ b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/AppCommands.java
@@ -176,8 +176,9 @@ public class AppCommands implements CommandProvider {
private Dictionary<String, Object> getServiceProps(ServiceReference ref) {
String[] keys = ref.getPropertyKeys();
Hashtable<String, Object> props = new Hashtable<>(keys.length);
- for (int i = 0; i < keys.length; i++)
- props.put(keys[i], ref.getProperty(keys[i]));
+ for (String key : keys) {
+ props.put(key, ref.getProperty(key));
+ }
return props;
}
@@ -187,8 +188,8 @@ public class AppCommands implements CommandProvider {
intp.println("No applications found."); //$NON-NLS-1$
return;
}
- for (int i = 0; i < apps.length; i++) {
- String application = (String) apps[i].getProperty(ApplicationDescriptor.APPLICATION_PID);
+ for (ServiceReference app : apps) {
+ String application = (String) app.getProperty(ApplicationDescriptor.APPLICATION_PID);
intp.print(application);
if (getApplication(applicationHandles.getServiceReferences(), application, ApplicationHandle.APPLICATION_DESCRIPTOR, true) != null)
@@ -196,14 +197,14 @@ public class AppCommands implements CommandProvider {
if (getApplication(scheduledApplications.getServiceReferences(), application, ScheduledApplication.APPLICATION_PID, true) != null)
intp.print(" [scheduled]"); //$NON-NLS-1$
-
- if (!launchableApp.match(getServiceProps(apps[i])))
+ if (!launchableApp.match(getServiceProps(app))) {
intp.print(" [not launchable]"); //$NON-NLS-1$
- else
+ } else {
intp.print(" [launchable]"); //$NON-NLS-1$
-
- if (lockedApp.match(getServiceProps(apps[i])))
+ }
+ if (lockedApp.match(getServiceProps(app))) {
intp.print(" [locked]"); //$NON-NLS-1$
+ }
intp.println();
}
}
@@ -214,10 +215,10 @@ public class AppCommands implements CommandProvider {
intp.println("No active applications found"); //$NON-NLS-1$
return;
}
- for (int i = 0; i < active.length; i++) {
- intp.print(active[i].getProperty(ApplicationHandle.APPLICATION_PID));
+ for (ServiceReference r : active) {
+ intp.print(r.getProperty(ApplicationHandle.APPLICATION_PID));
intp.print(" ["); //$NON-NLS-1$
- intp.print(activeApp.match(getServiceProps(active[i])) ? "running" : "stopping"); //$NON-NLS-1$ //$NON-NLS-2$
+ intp.print(activeApp.match(getServiceProps(r)) ? "running" : "stopping"); //$NON-NLS-1$ //$NON-NLS-2$
intp.println("]"); //$NON-NLS-1$
}
}
@@ -228,16 +229,17 @@ public class AppCommands implements CommandProvider {
ServiceReference result = null;
boolean ambigous = false;
- for (int i = 0; i < apps.length; i++) {
- String id = (String) apps[i].getProperty(idKey);
- if (targetId.equals(id))
- return apps[i]; // always return a perfect match
+ for (ServiceReference app : apps) {
+ String id = (String) app.getProperty(idKey);
+ if (targetId.equals(id)) {
+ return app; // always return a perfect match
+ }
if (perfectMatch)
continue;
if (id.contains(targetId)) {
if (result != null)
ambigous = true;
- result = apps[i];
+ result = app;
}
}
return ambigous ? null : result;
diff --git a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/AppPersistence.java b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/AppPersistence.java
index 188f57e0d..cf18f42f6 100644
--- a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/AppPersistence.java
+++ b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/AppPersistence.java
@@ -359,14 +359,15 @@ public class AppPersistence implements ServiceTrackerCustomizer {
continue;
apps = timerApps.toArray(new EclipseScheduledApplication[timerApps.size()]);
}
- for (int i = 0; i < apps.length; i++) {
+ for (EclipseScheduledApplication app : apps) {
try {
- String filterString = apps[i].getEventFilter();
+ String filterString = app.getEventFilter();
Filter filter = filterString == null ? null : FrameworkUtil.createFilter(filterString);
- if (filter == null || filter.match(props))
- apps[i].handleEvent(timerEvent);
+ if (filter == null || filter.match(props)) {
+ app.handleEvent(timerEvent);
+ }
} catch (Throwable t) {
- String message = NLS.bind(Messages.scheduled_app_launch_error, apps[i].getAppPid());
+ String message = NLS.bind(Messages.scheduled_app_launch_error, app.getAppPid());
Activator.log(new FrameworkLogEntry(Activator.PI_APP, FrameworkLogEntry.WARNING, 0, message, 0, t, null));
}
}
diff --git a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppContainer.java b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppContainer.java
index 65709f609..6ad86589e 100644
--- a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppContainer.java
+++ b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppContainer.java
@@ -272,8 +272,9 @@ public class EclipseAppContainer implements IRegistryEventListener, SynchronousB
*/
private void registerAppDescriptors() {
IExtension[] availableApps = getAvailableAppExtensions();
- for (int i = 0; i < availableApps.length; i++)
- createAppDescriptor(availableApps[i]);
+ for (IExtension availableApp : availableApps) {
+ createAppDescriptor(availableApp);
+ }
}
private void registerAppDescriptor(String applicationId) {
@@ -382,8 +383,8 @@ public class EclipseAppContainer implements IRegistryEventListener, SynchronousB
try {
ServiceReference[] runningRefs = context.getServiceReferences(ApplicationHandle.class.getName(), "(!(application.state=STOPPING))"); //$NON-NLS-1$
if (runningRefs != null)
- for (int i = 0; i < runningRefs.length; i++) {
- ApplicationHandle handle = (ApplicationHandle) context.getService(runningRefs[i]);
+ for (ServiceReference runningRef : runningRefs) {
+ ApplicationHandle handle = (ApplicationHandle) context.getService(runningRef);
try {
if (handle != null)
handle.destroy();
@@ -391,8 +392,9 @@ public class EclipseAppContainer implements IRegistryEventListener, SynchronousB
String message = NLS.bind(Messages.application_error_stopping, handle.getInstanceId());
Activator.log(new FrameworkLogEntry(Activator.PI_APP, FrameworkLogEntry.WARNING, 0, message, 0, t, null));
} finally {
- if (handle != null)
- context.ungetService(runningRefs[i]);
+ if (handle != null) {
+ context.ungetService(runningRef);
+ }
}
}
} catch (InvalidSyntaxException e) {
@@ -439,16 +441,15 @@ public class EclipseAppContainer implements IRegistryEventListener, SynchronousB
}
IConfigurationElement[] elements = extensionRegistry.getConfigurationElementsFor(PI_RUNTIME, PT_PRODUCTS);
List<FrameworkLogEntry> logEntries = null;
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement element = elements[i];
+ for (IConfigurationElement element : elements) {
if (element.getName().equalsIgnoreCase("provider")) { //$NON-NLS-1$
try {
Object provider = element.createExecutableExtension("run"); //$NON-NLS-1$
Object[] products = (Object[]) EclipseAppContainer.callMethod(provider, "getProducts", null, null); //$NON-NLS-1$
if (products != null)
- for (int j = 0; j < products.length; j++) {
- if (productId.equalsIgnoreCase((String) EclipseAppContainer.callMethod(products[j], "getId", null, null))) { //$NON-NLS-1$
- branding = new ProviderExtensionBranding(products[j]);
+ for (Object product : products) {
+ if (productId.equalsIgnoreCase((String) EclipseAppContainer.callMethod(product, "getId", null, null))) { //$NON-NLS-1$
+ branding = new ProviderExtensionBranding(product);
return branding;
}
}
@@ -633,8 +634,9 @@ public class EclipseAppContainer implements IRegistryEventListener, SynchronousB
@Override
public void added(IExtension[] extensions) {
- for (int i = 0; i < extensions.length; i++)
- createAppDescriptor(extensions[i]);
+ for (IExtension extension : extensions) {
+ createAppDescriptor(extension);
+ }
}
@Override
@@ -644,8 +646,9 @@ public class EclipseAppContainer implements IRegistryEventListener, SynchronousB
@Override
public void removed(IExtension[] extensions) {
- for (int i = 0; i < extensions.length; i++)
- removeAppDescriptor(extensions[i].getUniqueIdentifier());
+ for (IExtension extension : extensions) {
+ removeAppDescriptor(extension.getUniqueIdentifier());
+ }
}
@Override
diff --git a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppHandle.java b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppHandle.java
index b884eb41a..23f3c5c13 100644
--- a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppHandle.java
+++ b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/EclipseAppHandle.java
@@ -273,11 +273,11 @@ public class EclipseAppHandle extends ApplicationHandle implements ApplicationRu
@Override
public void run() throws Exception {
- for (int i = 0; i < monitors.length; i++) {
- StartupMonitor monitor = (StartupMonitor) Activator.getContext().getService(monitors[i]);
+ for (ServiceReference m : monitors) {
+ StartupMonitor monitor = (StartupMonitor) Activator.getContext().getService(m);
if (monitor != null) {
monitor.applicationRunning();
- Activator.getContext().ungetService(monitors[i]);
+ Activator.getContext().ungetService(m);
}
}
}
diff --git a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/ProductExtensionBranding.java b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/ProductExtensionBranding.java
index 445f742b6..8187e8bd1 100644
--- a/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/ProductExtensionBranding.java
+++ b/bundles/org.eclipse.equinox.app/src/org/eclipse/equinox/internal/app/ProductExtensionBranding.java
@@ -43,8 +43,7 @@ public class ProductExtensionBranding implements IBranding {
private void loadProperties(IConfigurationElement element) {
IConfigurationElement[] children = element.getChildren();
properties = new HashMap<>(children.length);
- for (int i = 0; i < children.length; i++) {
- IConfigurationElement child = children[i];
+ for (IConfigurationElement child : children) {
String key = child.getAttribute(ATTR_NAME);
String value = child.getAttribute(ATTR_VALUE);
if (key != null && value != null)
diff --git a/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/Activator.java b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/Activator.java
index fab882f33..8e59b6af3 100644
--- a/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/Activator.java
+++ b/bundles/org.eclipse.equinox.cm.test/src/org/eclipse/equinox/cm/test/Activator.java
@@ -54,9 +54,9 @@ public class Activator implements BundleActivator {
if (bundles == null)
return null;
//Return the first bundle that is not installed or uninstalled
- for (int i = 0; i < bundles.length; i++) {
- if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) {
- return bundles[i];
+ for (Bundle bundle : bundles) {
+ if ((bundle.getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) {
+ return bundle;
}
}
return null;
diff --git a/bundles/org.eclipse.equinox.cm/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.cm/META-INF/MANIFEST.MF
index b9171b099..8a1b9175e 100644
--- a/bundles/org.eclipse.equinox.cm/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.cm/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-Name: %bundleName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.equinox.cm
-Bundle-Version: 1.4.0.qualifier
+Bundle-Version: 1.4.100.qualifier
Bundle-Activator: org.eclipse.equinox.internal.cm.Activator
Import-Package: org.osgi.framework;version="1.7.0",
org.osgi.service.cm;version="[1.6,1.7)",
diff --git a/bundles/org.eclipse.equinox.cm/pom.xml b/bundles/org.eclipse.equinox.cm/pom.xml
index a06641226..a3ce854ab 100644
--- a/bundles/org.eclipse.equinox.cm/pom.xml
+++ b/bundles/org.eclipse.equinox.cm/pom.xml
@@ -5,7 +5,7 @@
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/org/documents/edl-v10.php
-
+
Contributors:
Igor Fedorenko - initial implementation
-->
@@ -19,6 +19,6 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.cm</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.4.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ConfigurationAdminImpl.java b/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ConfigurationAdminImpl.java
index 1cb31fb26..296cc761e 100644
--- a/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ConfigurationAdminImpl.java
+++ b/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/ConfigurationAdminImpl.java
@@ -103,13 +103,13 @@ class ConfigurationAdminImpl implements ConfigurationAdmin {
List<Configuration> result = new ArrayList<>(configs.length);
SecurityManager sm = System.getSecurityManager();
- for (int i = 0; i < configs.length; i++) {
+ for (ConfigurationImpl config : configs) {
try {
if (sm != null) {
- this.configurationAdminFactory.checkConfigurePermission(configs[i].getLocation(), bundleLocation);
+ this.configurationAdminFactory.checkConfigurePermission(config.getLocation(), bundleLocation);
}
- result.add(configs[i]);
- } catch (SecurityException e) {
+ result.add(config);
+ }catch (SecurityException e) {
// ignore;
}
}
diff --git a/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/reliablefile/ReliableFile.java b/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/reliablefile/ReliableFile.java
index 43842111b..9ed2445d0 100644
--- a/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/reliablefile/ReliableFile.java
+++ b/bundles/org.eclipse.equinox.cm/src/org/eclipse/equinox/internal/cm/reliablefile/ReliableFile.java
@@ -202,12 +202,12 @@ public class ReliableFile {
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++) {
- if (files[i].startsWith(prefix)) {
+ for (String n : files) {
+ if (n.startsWith(prefix)) {
try {
- int id = Integer.parseInt(files[i].substring(prefixLen));
+ int id = Integer.parseInt(n.substring(prefixLen));
list.add(Integer.valueOf(id));
- } catch (NumberFormatException e) {/*ignore*/
+ }catch (NumberFormatException e) {/*ignore*/
}
}
}
@@ -531,12 +531,12 @@ public class ReliableFile {
String[] files = parent.list();
if (files == null)
return false;
- for (int i = 0; i < files.length; i++) {
- if (files[i].startsWith(prefix)) {
+ for (String n : files) {
+ if (n.startsWith(prefix)) {
try {
- Integer.parseInt(files[i].substring(prefixLen));
+ Integer.parseInt(n.substring(prefixLen));
return true;
- } catch (NumberFormatException e) {/*ignore*/
+ }catch (NumberFormatException e) {/*ignore*/
}
}
}
@@ -630,8 +630,7 @@ public class ReliableFile {
throw new IOException("Not a valid directory"); //$NON-NLS-1$
String files[] = directory.list();
Set<String> list = new HashSet<>(files.length / 2);
- for (int idx = 0; idx < files.length; idx++) {
- String file = files[idx];
+ for (String file : files) {
int pos = file.lastIndexOf('.');
if (pos == -1)
continue;
diff --git a/bundles/org.eclipse.equinox.common.tests/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.common.tests/META-INF/MANIFEST.MF
index 101dfc7b4..f1a6a6dc3 100644
--- a/bundles/org.eclipse.equinox.common.tests/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.common.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Common Eclipse Runtime Tests
Bundle-SymbolicName: org.eclipse.equinox.common.tests;singleton:=true
-Bundle-Version: 3.10.300.qualifier
+Bundle-Version: 3.10.400.qualifier
Automatic-Module-Name: org.eclipse.equinox.common.tests
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
diff --git a/bundles/org.eclipse.equinox.common.tests/pom.xml b/bundles/org.eclipse.equinox.common.tests/pom.xml
index 3544fea78..c6593e50a 100644
--- a/bundles/org.eclipse.equinox.common.tests/pom.xml
+++ b/bundles/org.eclipse.equinox.common.tests/pom.xml
@@ -5,7 +5,7 @@
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/org/documents/edl-v10.php
-
+
Contributors:
Julian Honnen - initial implementation
-->
@@ -19,6 +19,6 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.common.tests</artifactId>
- <version>3.10.300-SNAPSHOT</version>
+ <version>3.10.400-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/WaitingRegistryListener.java b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/WaitingRegistryListener.java
index d5c95a619..b3d8f3d58 100644
--- a/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/WaitingRegistryListener.java
+++ b/bundles/org.eclipse.equinox.common.tests/src/org/eclipse/equinox/common/tests/registry/WaitingRegistryListener.java
@@ -177,11 +177,11 @@ public class WaitingRegistryListener extends Assert implements IRegistryEventLis
if (children == null) {
return true;
}
- for (int i = 0; i < children.length; i++) {
- if (!children[i].isValid()) {
+ for (IConfigurationElement child : children) {
+ if (!child.isValid()) {
return false;
}
- if (!validContents(children[i].getChildren())) {
+ if (!validContents(child.getChildren())) {
return false;
}
}
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/Activator.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/Activator.java
index 4d1981dc3..578c365e4 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/Activator.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/Activator.java
@@ -148,9 +148,9 @@ public class Activator implements BundleActivator {
if (bundles == null)
return null;
//Return the first bundle that is not installed or uninstalled
- for (int i = 0; i < bundles.length; i++) {
- if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) {
- return bundles[i];
+ for (Bundle bundle : bundles) {
+ if ((bundle.getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) {
+ return bundle;
}
}
return null;
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/AdapterManager.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/AdapterManager.java
index 12f006f30..7a1f881f4 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/AdapterManager.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/AdapterManager.java
@@ -107,14 +107,15 @@ public final class AdapterManager implements IAdapterManager {
IAdapterFactory factory = factoryList.get(i);
if (factory instanceof IAdapterFactoryExt) {
String[] adapters = ((IAdapterFactoryExt) factory).getAdapterNames();
- for (int j = 0; j < adapters.length; j++) {
- if (table.get(adapters[j]) == null)
- table.put(adapters[j], factory);
+ for (String adapter : adapters) {
+ if (table.get(adapter) == null) {
+ table.put(adapter, factory);
+ }
}
} else {
Class<?>[] adapters = factory.getAdapterList();
- for (int j = 0; j < adapters.length; j++) {
- String adapterName = adapters[j].getName();
+ for (Class<?> adapter : adapters) {
+ String adapterName = adapter.getName();
if (table.get(adapterName) == null)
table.put(adapterName, factory);
}
@@ -172,9 +173,9 @@ public final class AdapterManager implements IAdapterManager {
return null;
Class<?>[] adapterList = factory.getAdapterList();
clazz = null;
- for (int i = 0; i < adapterList.length; i++) {
- if (typeName.equals(adapterList[i].getName())) {
- clazz = adapterList[i];
+ for (Class<?> adapter : adapterList) {
+ if (typeName.equals(adapter.getName())) {
+ clazz = adapter;
break;
}
}
@@ -208,8 +209,9 @@ public final class AdapterManager implements IAdapterManager {
// calculate adapters for the class
table = new HashMap<>(4);
Class<?>[] classes = computeClassOrder(adaptable);
- for (int i = 0; i < classes.length; i++)
- addFactoriesFor(classes[i].getName(), table);
+ for (Class<?> cl : classes) {
+ addFactoriesFor(cl.getName(), table);
+ }
// cache the table
lookup.put(adaptable.getName(), table);
}
@@ -253,15 +255,15 @@ public final class AdapterManager implements IAdapterManager {
}
//now traverse interface hierarchy for each class
Class<?>[] classHierarchy = classes.toArray(new Class[classes.size()]);
- for (int i = 0; i < classHierarchy.length; i++)
- computeInterfaceOrder(classHierarchy[i].getInterfaces(), classes, seen);
+ for (Class<?> cl : classHierarchy) {
+ computeInterfaceOrder(cl.getInterfaces(), classes, seen);
+ }
return classes.toArray(new Class[classes.size()]);
}
private void computeInterfaceOrder(Class<?>[] interfaces, Collection<Class<?>> classes, Set<Class<?>> seen) {
List<Class<?>> newInterfaces = new ArrayList<>(interfaces.length);
- for (int i = 0; i < interfaces.length; i++) {
- Class<?> interfac = interfaces[i];
+ for (Class<?> interfac : interfaces) {
if (seen.add(interfac)) {
//note we cannot recurse here without changing the resulting interface order
classes.add(interfac);
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/FindSupport.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/FindSupport.java
index 7cac8c763..41275dcc1 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/FindSupport.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/FindSupport.java
@@ -215,8 +215,8 @@ public class FindSupport {
return null;
URL result = null;
- for (int i = 0; i < nlVariants.length; i++) {
- IPath filePath = new Path(nlVariants[i]).append(path);
+ for (String nlVariant : nlVariants) {
+ IPath filePath = new Path(nlVariant).append(path);
result = findInPlugin(b, filePath, multiple);
if (result != null && multiple == null)
return result;
@@ -250,8 +250,8 @@ public class FindSupport {
if (multiple != null)
multiple.ensureCapacity(fragments.length + 1);
- for (int i = 0; i < fragments.length; i++) {
- URL fileURL = fragments[i].getEntry(filePath.toString());
+ for (Bundle fragment : fragments) {
+ URL fileURL = fragment.getEntry(filePath.toString());
if (fileURL != null) {
if (multiple == null)
return fileURL;
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PlatformLogWriter.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PlatformLogWriter.java
index f046ee244..952547cbd 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PlatformLogWriter.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PlatformLogWriter.java
@@ -78,8 +78,8 @@ public class PlatformLogWriter implements SynchronousLogListener, LogFilter {
if (status.isMultiStatus()) {
IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- childlist.add(getLog(children[i]));
+ for (IStatus child : children) {
+ childlist.add(getLog(child));
}
}
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PrintStackUtil.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PrintStackUtil.java
index 5adc99488..ce48f25a8 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PrintStackUtil.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/PrintStackUtil.java
@@ -23,12 +23,12 @@ public class PrintStackUtil {
IStatus[] children = status.getChildren();
if (children == null || children.length == 0)
return;
- for (int i = 0; i < children.length; i++) {
- output.println("Contains: " + children[i].getMessage()); //$NON-NLS-1$
- Throwable exception = children[i].getException();
+ for (IStatus child : children) {
+ output.println("Contains: " + child.getMessage()); //$NON-NLS-1$
+ Throwable exception = child.getException();
if (exception != null)
exception.printStackTrace(output);
- printChildren(children[i], output);
+ printChildren(child, output);
}
}
@@ -36,13 +36,13 @@ public class PrintStackUtil {
IStatus[] children = status.getChildren();
if (children == null || children.length == 0)
return;
- for (int i = 0; i < children.length; i++) {
- output.println("Contains: " + children[i].getMessage()); //$NON-NLS-1$
+ for (IStatus child : children) {
+ output.println("Contains: " + child.getMessage()); //$NON-NLS-1$
output.flush(); // call to synchronize output
- Throwable exception = children[i].getException();
+ Throwable exception = child.getException();
if (exception != null)
exception.printStackTrace(output);
- printChildren(children[i], output);
+ printChildren(child, output);
}
}
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/ReferenceHashSet.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/ReferenceHashSet.java
index d997ee1b0..83c0be1ff 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/ReferenceHashSet.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/ReferenceHashSet.java
@@ -325,10 +325,11 @@ public class ReferenceHashSet<T> {
cleanupGarbageCollectedValues();
Object[] result = new Object[elementSize];
int resultSize = 0;
- for (int i = 0; i < values.length; i++) {
- if (values[i] == null)
+ for (HashedReference<T> value : values) {
+ if (value == null) {
continue;
- Object tmp = values[i].get();
+ }
+ Object tmp = value.get();
if (tmp != null)
result[resultSize++] = tmp;
}
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/ResourceTranslator.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/ResourceTranslator.java
index 4bd6d111b..f0b5a572c 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/ResourceTranslator.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/ResourceTranslator.java
@@ -95,8 +95,8 @@ public class ResourceTranslator {
ManifestElement[] prereqs = ManifestElement.parseHeader(Constants.REQUIRE_BUNDLE, b.getHeaders("").get(Constants.REQUIRE_BUNDLE)); //$NON-NLS-1$
if (prereqs == null)
return false;
- for (int i = 0; i < prereqs.length; i++) {
- if ("2.1".equals(prereqs[i].getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE)) && "org.eclipse.core.runtime".equals(prereqs[i].getValue())) { //$NON-NLS-1$//$NON-NLS-2$
+ for (ManifestElement prereq : prereqs) {
+ if ("2.1".equals(prereq.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE)) && "org.eclipse.core.runtime".equals(prereq.getValue())) {//$NON-NLS-1$//$NON-NLS-2$
return true;
}
}
@@ -124,9 +124,9 @@ public class ResourceTranslator {
if (fragments == null)
return;
- for (int i = 0; i < fragments.length; i++) {
- addClasspathEntries(fragments[i], classpath);
- addDevEntries(fragments[i], classpath);
+ for (Bundle fragment : fragments) {
+ addClasspathEntries(fragment, classpath);
+ addDevEntries(fragment, classpath);
}
}
@@ -136,8 +136,8 @@ public class ResourceTranslator {
classpathElements = ManifestElement.parseHeader(Constants.BUNDLE_CLASSPATH, b.getHeaders("").get(Constants.BUNDLE_CLASSPATH)); //$NON-NLS-1$
if (classpathElements == null)
return;
- for (int i = 0; i < classpathElements.length; i++) {
- URL classpathEntry = b.getEntry(classpathElements[i].getValue());
+ for (ManifestElement classpathElement : classpathElements) {
+ URL classpathEntry = b.getEntry(classpathElement.getValue());
if (classpathEntry != null)
classpath.add(classpathEntry);
}
@@ -155,8 +155,8 @@ public class ResourceTranslator {
return;
String[] binaryPaths = DevClassPathHelper.getDevClassPath(b.getSymbolicName());
- for (int i = 0; i < binaryPaths.length; i++) {
- URL classpathEntry = b.getEntry(binaryPaths[i]);
+ for (String binaryPath : binaryPaths) {
+ URL classpathEntry = b.getEntry(binaryPath);
if (classpathEntry != null)
classpath.add(classpathEntry);
}
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/RuntimeLog.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/RuntimeLog.java
index 321eb4d58..c461d6803 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/RuntimeLog.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/internal/runtime/RuntimeLog.java
@@ -101,10 +101,10 @@ public final class RuntimeLog {
return;
}
if (listeners != null) {
- for (int i = 0; i < listeners.length; i++) {
+ for (ILogListener listener : listeners) {
try {
- listeners[i].logging(status, IRuntimeConstants.PI_RUNTIME);
- } catch (Exception | LinkageError e) {
+ listener.logging(status, IRuntimeConstants.PI_RUNTIME);
+ }catch (Exception | LinkageError e) {
handleException(e);
}
}
@@ -146,8 +146,8 @@ public final class RuntimeLog {
queued = queuedMessages.toArray(new IStatus[queuedMessages.size()]);
queuedMessages.clear();
}
- for (int i = 0; i < queued.length; i++) {
- log(queued[i]);
+ for (IStatus s : queued) {
+ log(s);
}
}
@@ -157,10 +157,10 @@ public final class RuntimeLog {
synchronized (logListeners) {
listeners = logListeners.toArray(new ILogListener[logListeners.size()]);
}
- for (int i = 0; i < listeners.length; i++) {
+ for (ILogListener listener : listeners) {
try {
- listeners[i].logging(status, IRuntimeConstants.PI_RUNTIME);
- } catch (Exception | LinkageError e) {
+ listener.logging(status, IRuntimeConstants.PI_RUNTIME);
+ }catch (Exception | LinkageError e) {
handleException(e);
}
}

Back to the top