Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Hammer2019-09-25 16:05:15 -0400
committerAlexander Kurtakov2019-09-26 07:39:45 -0400
commita6d42bb9c978cc3e52288343fc18d7115afa485b (patch)
treea87f4ca1cb87c542d8b898f129bdab07064940c4
parentc2d75396df08f2ac007d6fba94ae9baa28c03dad (diff)
downloadrt.equinox.p2-a6d42bb9c978cc3e52288343fc18d7115afa485b.tar.gz
rt.equinox.p2-a6d42bb9c978cc3e52288343fc18d7115afa485b.tar.xz
rt.equinox.p2-a6d42bb9c978cc3e52288343fc18d7115afa485b.zip
Replace simple uses of Iterator with a corresponding for-loop. Also add missing braces on loops as necessary. Change-Id: I5a1ce717f07969e3fe5ee3c2ddba2e4dd1f3fc1b Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/optimizers/TestData.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ElementUtilsTest.java34
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWithRemediationTest.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/WizardTest.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/UpdateOperationTests.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AvailableIUWrapperTest.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryProviderTests.java6
12 files changed, 47 insertions, 39 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/optimizers/TestData.java b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/optimizers/TestData.java
index a7e0a483f..acb250c9a 100644
--- a/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/optimizers/TestData.java
+++ b/bundles/org.eclipse.equinox.p2.tests.optimizers/src/org/eclipse/equinox/p2/tests/optimizers/TestData.java
@@ -129,8 +129,7 @@ public class TestData {
public static void assertEquals(ZipInputStream input1, ZipInputStream input2) throws IOException {
Map<String, Object[]> jar1 = getEntries(input1);
Map<String, Object[]> jar2 = getEntries(input2);
- for (Iterator<String> i = jar1.keySet().iterator(); i.hasNext();) {
- String name = i.next();
+ for (String name : jar1.keySet()) {
Object[] file1 = jar1.get(name);
Object[] file2 = jar2.remove(name);
Assert.assertNotNull(file2);
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF
index a6807dbbe..6a2296558 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.p2.tests.ui
-Bundle-Version: 1.2.300.qualifier
+Bundle-Version: 1.2.400.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.4.100",
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml b/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml
index 258ac549f..314f68373 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/pom.xml
@@ -21,7 +21,7 @@
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.p2.tests.ui</artifactId>
- <version>1.2.300-SNAPSHOT</version>
+ <version>1.2.400-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java
index fbdbd5fa7..048f7e5af 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java
@@ -57,8 +57,8 @@ public class ImportExportRemoteTests extends ServerBasedTestCase {
importexportService = null;
IMetadataRepositoryManager repoMan = getAgent().getService(IMetadataRepositoryManager.class);
URI[] urls = repoMan.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL);
- for (int i = 0; i < urls.length; i++) {
- repoMan.removeRepository(urls[i]);
+ for (URI url : urls) {
+ repoMan.removeRepository(url);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java
index c9ab3a6ef..e68ea79d8 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/AbstractProvisioningUITest.java
@@ -113,9 +113,10 @@ public abstract class AbstractProvisioningUITest extends AbstractProvisioningTes
protected boolean managerContains(IRepositoryManager<?> manager, URI location) {
URI[] locations = manager.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL);
- for (int i = 0; i < locations.length; i++) {
- if (locations[i].equals(location))
+ for (URI location1 : locations) {
+ if (location1.equals(location)) {
return true;
+ }
}
return false;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ElementUtilsTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ElementUtilsTest.java
index bdaa3dea5..319338c91 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ElementUtilsTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/actions/ElementUtilsTest.java
@@ -99,29 +99,39 @@ public class ElementUtilsTest extends ProfileModificationActionTest {
boolean found2 = false;
boolean found3 = false;
- for (int i = 0; i < enabled.length; i++) {
- if (enabled[i].equals(known1))
+ for (URI enabled1 : enabled) {
+ if (enabled1.equals(known1)) {
foundKnown1 = true;
- if (enabled[i].equals(known2))
+ }
+ if (enabled1.equals(known2)) {
foundKnown2 = true;
- if (enabled[i].equals(uri))
+ }
+ if (enabled1.equals(uri)) {
found1 = true;
- if (enabled[i].equals(uri2))
+ }
+ if (enabled1.equals(uri2)) {
found2 = true;
- if (enabled[i].equals(uri3))
+ }
+ if (enabled1.equals(uri3)) {
found3 = true;
+ }
}
- for (int i = 0; i < disabled.length; i++) {
- if (disabled[i].equals(known1))
+ for (URI disabled1 : disabled) {
+ if (disabled1.equals(known1)) {
foundKnown1 = true;
- if (disabled[i].equals(known2))
+ }
+ if (disabled1.equals(known2)) {
foundKnown2 = true;
- if (disabled[i].equals(uri))
+ }
+ if (disabled1.equals(uri)) {
found1 = true;
- if (disabled[i].equals(uri2))
+ }
+ if (disabled1.equals(uri2)) {
found2 = true;
- if (disabled[i].equals(uri3))
+ }
+ if (disabled1.equals(uri3)) {
found3 = true;
+ }
}
assertTrue("1.0", found1); // Enabled system repo still exists
assertTrue("1.1", found2); // Disabled system repo still exists
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWithRemediationTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWithRemediationTest.java
index e32fc5d6b..acf2fe1d4 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWithRemediationTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWithRemediationTest.java
@@ -237,8 +237,8 @@ public class InstallWithRemediationTest extends WizardTest {
group.getCheckboxTreeViewer().expandAll();
Tree tree = (Tree) group.getCheckboxTreeViewer().getControl();
TreeItem[] items = tree.getItems();
- for (int i = 0; i < items.length; i++) {
- Object element = items[i].getData();
+ for (TreeItem item : items) {
+ Object element = item.getData();
if (element != null && element instanceof IIUElement) {
IInstallableUnit iu = ((IIUElement) element).getIU();
if (iu != null && iu.getId().equals(TOPLEVELIU)) {
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java
index eca36f127..f1ca13870 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/InstallWizardTest.java
@@ -233,8 +233,8 @@ public class InstallWizardTest extends WizardTest {
group.getCheckboxTreeViewer().expandAll();
Tree tree = (Tree) group.getCheckboxTreeViewer().getControl();
TreeItem[] items = tree.getItems();
- for (int i = 0; i < items.length; i++) {
- Object element = items[i].getData();
+ for (TreeItem item : items) {
+ Object element = item.getData();
if (element != null && element instanceof IIUElement) {
IInstallableUnit iu = ((IIUElement) element).getIU();
if (iu != null && iu.getId().equals(MAIN_IU)) {
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/WizardTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/WizardTest.java
index 53d43323c..aa6b9feb4 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/WizardTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/dialogs/WizardTest.java
@@ -31,8 +31,8 @@ public abstract class WizardTest extends AbstractProvisioningUITest {
return (Tree) control;
if (control instanceof Composite) {
Control[] children = ((Composite) control).getChildren();
- for (int i = 0; i < children.length; i++) {
- Tree tree = findTree(children[i]);
+ for (Control children1 : children) {
+ Tree tree = findTree(children1);
if (tree != null)
return tree;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/UpdateOperationTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/UpdateOperationTests.java
index f6adf95c7..cb0c9aa5c 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/UpdateOperationTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/UpdateOperationTests.java
@@ -77,9 +77,9 @@ public class UpdateOperationTests extends AbstractProvisioningUITest {
op.resolveModal(getMonitor());
Update[] updates = op.getPossibleUpdates();
Update firstPatch = null;
- for (int i = 0; i < updates.length; i++) {
- if (updates[i].replacement.equals(firstPatchForA1)) {
- firstPatch = updates[i];
+ for (Update update : updates) {
+ if (update.replacement.equals(firstPatchForA1)) {
+ firstPatch = update;
break;
}
}
@@ -118,9 +118,9 @@ public class UpdateOperationTests extends AbstractProvisioningUITest {
op.resolveModal(getMonitor());
Update[] updates = op.getPossibleUpdates();
Update notNewest = null;
- for (int i = 0; i < updates.length; i++) {
- if (updates[i].replacement.equals(a120WithDifferentId)) {
- notNewest = updates[i];
+ for (Update update : updates) {
+ if (update.replacement.equals(a120WithDifferentId)) {
+ notNewest = update;
break;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AvailableIUWrapperTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AvailableIUWrapperTest.java
index ee50077fe..048005da1 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AvailableIUWrapperTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/AvailableIUWrapperTest.java
@@ -89,8 +89,7 @@ public class AvailableIUWrapperTest extends AbstractQueryTest {
Collection<?> results = wrapper.getElements(collector);
assertEquals("1.0", 2, collector.size());
boolean categoryFound = false;
- for (Iterator<?> it = results.iterator(); it.hasNext();) {
- Object element = it.next();
+ for (Object element : results) {
IInstallableUnit collected = getIU(element);
if (collected.equals(category)) {
categoryFound = true;
@@ -118,8 +117,7 @@ public class AvailableIUWrapperTest extends AbstractQueryTest {
Collection<?> results = wrapper.getElements(collector);
assertEquals("1.0", 2, results.size());
boolean categoryFound = false;
- for (Iterator<?> it = results.iterator(); it.hasNext();) {
- Object element = it.next();
+ for (Object element : results) {
IInstallableUnit collected = getIU(element);
if (collected.equals(category)) {
categoryFound = true;
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryProviderTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryProviderTests.java
index 42161b483..6214b5448 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryProviderTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/query/QueryProviderTests.java
@@ -56,9 +56,9 @@ public class QueryProviderTests extends AbstractProvisioningUITest {
CategoryElement cat = (CategoryElement) children[0];
children = cat.getChildren(cat);
boolean foundNestedCategory = false;
- for (int i = 0; i < children.length; i++) {
- if (children[i] instanceof CategoryElement) {
- if (((CategoryElement) children[i]).getIU().equals(nestedCategory)) {
+ for (Object children1 : children) {
+ if (children1 instanceof CategoryElement) {
+ if (((CategoryElement) children1).getIU().equals(nestedCategory)) {
foundNestedCategory = true;
break;
}

Back to the top