Generics and other fixes in tests and tutorials

Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/8b9f2d51
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/8b9f2d51
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/8b9f2d51

Branch: refs/heads/master
Commit: 8b9f2d5177c849b37809ab38035e1d757d963314
Parents: 4c6450f
Author: twogee <g.grigelio...@gmail.com>
Authored: Sat Jun 10 08:56:44 2017 +0200
Committer: twogee <g.grigelio...@gmail.com>
Committed: Sat Jun 10 21:47:21 2017 +0200

----------------------------------------------------------------------
 ivy.xml                                         | 32 +++----
 .../src/filter/ccimpl/CCFilter.java             |  4 +-
 .../src/filter/hmimpl/HMFilter.java             |  4 +-
 .../test/filter/AbstractTestFilter.java         |  1 -
 src/example/dual/project/src/example/Hello.java | 51 ----------
 .../dual/project/src/example/HelloIvy.java      | 51 ++++++++++
 src/example/hello-ivy/src/example/Hello.java    | 51 ----------
 .../hello-ivy/src/example/HelloConsole.java     | 51 ++++++++++
 .../projects/find/src/find/FindFile.java        |  2 +-
 .../projects/find/src/find/Main.java            |  4 +-
 .../projects/list/src/list/ListFile.java        |  5 +-
 .../projects/size/src/size/FileSize.java        |  5 +-
 .../ivy/plugins/repository/vfs/VfsResource.java |  8 +-
 test/java/org/apache/ivy/TestFixture.java       |  3 +-
 test/java/org/apache/ivy/TestHelper.java        | 42 ++++-----
 .../apache/ivy/ant/AntBuildResolverTest.java    | 12 +--
 .../org/apache/ivy/ant/FixDepsTaskTest.java     |  9 +-
 .../org/apache/ivy/ant/IvyBuildListTest.java    |  4 +-
 .../java/org/apache/ivy/ant/IvyDeliverTest.java | 10 +-
 .../apache/ivy/ant/IvyPostResolveTaskTest.java  | 69 +++++++-------
 .../java/org/apache/ivy/ant/IvyResolveTest.java |  2 +-
 .../org/apache/ivy/ant/IvyResourcesTest.java    |  5 +-
 .../apache/ivy/core/module/id/ModuleIdTest.java |  2 +-
 .../ivy/core/publish/PublishEventsTest.java     |  5 +-
 .../org/apache/ivy/core/search/SearchTest.java  | 18 ++--
 .../java/org/apache/ivy/core/sort/SortTest.java | 97 ++++++++++----------
 .../conflict/LatestConflictManagerTest.java     | 20 +---
 .../matcher/AbstractPatternMatcherTest.java     | 16 ++--
 .../parser/xml/XmlModuleUpdaterTest.java        | 18 ++--
 .../repository/vfs/VfsRepositoryTest.java       | 33 ++-----
 .../plugins/repository/vfs/VfsResourceTest.java | 50 ++++------
 .../plugins/repository/vfs/VfsTestHelper.java   | 10 +-
 .../ivy/plugins/resolver/ChainResolverTest.java | 16 ++--
 .../plugins/resolver/IBiblioResolverTest.java   |  4 +-
 .../ivy/util/url/ApacheURLListerTest.java       | 20 ++--
 35 files changed, 336 insertions(+), 398 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/ivy.xml
----------------------------------------------------------------------
diff --git a/ivy.xml b/ivy.xml
index f2f7e86..d7417c8 100644
--- a/ivy.xml
+++ b/ivy.xml
@@ -26,7 +26,7 @@
         Apache Ivy is a tool for managing (recording, tracking, resolving and 
reporting) project dependencies.
         </description>
     </info>
-    <configurations>
+    <configurations defaultconfmapping="*->default">
         <conf name="core" description="only ivy jar, without any 
dependencies"/>
         <conf name="httpclient" extends="core" description="core + optional 
httpclient for better http handling"/>
         <conf name="oro" extends="core" description="to use optional glob 
matcher"/>
@@ -35,32 +35,32 @@
         <conf name="standalone" extends="core" description="to launch in 
standalone mode (from command line)"/>
         <conf name="ant" extends="core" description="core + ant jar provided 
as a dependency"/>
         <conf name="default" extends="core" description="full ivy with all 
dependencies"/>
-        <conf name="test" description="dependencies used for junit testing 
ivy" visibility="private" />
-        <conf name="source" description="ivy sources" />
+        <conf name="test" description="dependencies used for junit testing 
ivy" visibility="private"/>
+        <conf name="source" description="ivy sources"/>
     </configurations>
     <publications>
         <artifact name="ivy" type="jar" conf="core"/>
         <artifact name="ivy" type="source" ext="jar" conf="source"/>
     </publications>
     <dependencies>
-        <dependency org="org.apache.ant" name="ant" rev="1.9.9" 
conf="default,ant->default"/>
+        <dependency org="org.apache.ant" name="ant" rev="1.9.9" 
conf="default,ant"/>
         <dependency org="commons-httpclient" name="commons-httpclient" 
rev="3.1" conf="default,httpclient->runtime,master"/>
-        <dependency org="oro" name="oro" rev="2.0.8" 
conf="default,oro->default"/>
-        <dependency org="commons-vfs" name="commons-vfs" rev="1.0" 
conf="default,vfs->default"/>
-        <dependency org="com.jcraft" name="jsch" rev="0.1.54" 
conf="default,sftp->default"/>
-        <dependency org="com.jcraft" name="jsch.agentproxy" rev="0.0.9" 
conf="default,sftp->default"/>
-        <dependency org="com.jcraft" name="jsch.agentproxy.connector-factory" 
rev="0.0.9" conf="default,sftp->default"/>
-        <dependency org="com.jcraft" name="jsch.agentproxy.jsch" rev="0.0.9" 
conf="default,sftp->default"/>
+        <dependency org="oro" name="oro" rev="2.0.8" conf="default,oro"/>
+        <dependency org="commons-vfs" name="commons-vfs" rev="1.0" 
conf="default,vfs"/>
+        <dependency org="com.jcraft" name="jsch" rev="0.1.54" 
conf="default,sftp"/>
+        <dependency org="com.jcraft" name="jsch.agentproxy" rev="0.0.9" 
conf="default,sftp"/>
+        <dependency org="com.jcraft" name="jsch.agentproxy.connector-factory" 
rev="0.0.9" conf="default,sftp"/>
+        <dependency org="com.jcraft" name="jsch.agentproxy.jsch" rev="0.0.9" 
conf="default,sftp"/>
         <dependency org="org.bouncycastle" name="bcpg-jdk15on" rev="1.52" 
conf="default"/>
         <dependency org="org.bouncycastle" name="bcprov-jdk15on" rev="1.52" 
conf="default"/>
 
         <!-- Test dependencies -->
-        <dependency org="junit" name="junit" rev="4.12" conf="test->default"/>
-        <dependency org="org.hamcrest" name="hamcrest-core" rev="1.3" 
conf="test->default"/>
-        <dependency org="org.apache.ant" name="ant-testutil" rev="1.9.9" 
conf="test->default" transitive="false"/>
-        <dependency org="org.apache.ant" name="ant-launcher" rev="1.9.9" 
conf="test->default" transitive="false"/>
-        <dependency org="ant-contrib" name="ant-contrib" rev="1.0b3" 
conf="test->default" transitive="false"/>
-        <dependency org="xmlunit" name="xmlunit" rev="1.6" 
conf="test->default" transitive="false"/>
+        <dependency org="junit" name="junit" rev="4.12" conf="test"/>
+        <dependency org="org.hamcrest" name="hamcrest-core" rev="1.3" 
conf="test"/>
+        <dependency org="org.apache.ant" name="ant-testutil" rev="1.9.9" 
conf="test" transitive="false"/>
+        <dependency org="org.apache.ant" name="ant-launcher" rev="1.9.9" 
conf="test" transitive="false"/>
+        <dependency org="ant-contrib" name="ant-contrib" rev="1.0b3" 
conf="test" transitive="false"/>
+        <dependency org="xmlunit" name="xmlunit" rev="1.6" conf="test" 
transitive="false"/>
 
         <!-- Global exclude for junit and hamcrest -->
         <exclude org="junit" module="junit" 
conf="core,default,httpclient,oro,vfs,sftp,standalone,ant"/>

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/example/configurations/multi-projects/filter-framework/src/filter/ccimpl/CCFilter.java
----------------------------------------------------------------------
diff --git 
a/src/example/configurations/multi-projects/filter-framework/src/filter/ccimpl/CCFilter.java
 
b/src/example/configurations/multi-projects/filter-framework/src/filter/ccimpl/CCFilter.java
index 3dd8abb..2dc71c4 100644
--- 
a/src/example/configurations/multi-projects/filter-framework/src/filter/ccimpl/CCFilter.java
+++ 
b/src/example/configurations/multi-projects/filter-framework/src/filter/ccimpl/CCFilter.java
@@ -34,12 +34,12 @@ public class CCFilter implements IFilter {
             return values;
         }
 
-        List result = new ArrayList(Arrays.asList(values));
+        List<String> result = new ArrayList<String>(Arrays.asList(values));
         CollectionUtils.filter(result, new Predicate() {
             public boolean evaluate(Object o) {
                 return o != null && o.toString().startsWith(prefix);
             }
         });
-        return (String[]) result.toArray(new String[result.size()]);
+        return result.toArray(new String[result.size()]);
     }
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java
----------------------------------------------------------------------
diff --git 
a/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java
 
b/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java
index 18191c2..bcb2e1d 100644
--- 
a/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java
+++ 
b/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java
@@ -30,13 +30,13 @@ public class HMFilter implements IFilter {
         if (prefix == null) {
             return values;
         }
-        List result = new ArrayList();
+        List<String> result = new ArrayList<String>();
         for (int i = 0; i < values.length; i++) {
             String string = values[i];
             if (string != null && string.startsWith(prefix)) {
                 result.add(string);
             }
         }
-        return (String[]) result.toArray(new String[result.size()]);
+        return result.toArray(new String[result.size()]);
     }
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/example/configurations/multi-projects/filter-framework/test/filter/AbstractTestFilter.java
----------------------------------------------------------------------
diff --git 
a/src/example/configurations/multi-projects/filter-framework/test/filter/AbstractTestFilter.java
 
b/src/example/configurations/multi-projects/filter-framework/test/filter/AbstractTestFilter.java
index 81da01a..7c8c4f2 100644
--- 
a/src/example/configurations/multi-projects/filter-framework/test/filter/AbstractTestFilter.java
+++ 
b/src/example/configurations/multi-projects/filter-framework/test/filter/AbstractTestFilter.java
@@ -21,7 +21,6 @@ import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
 
 public abstract class AbstractTestFilter {
     /**

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/example/dual/project/src/example/Hello.java
----------------------------------------------------------------------
diff --git a/src/example/dual/project/src/example/Hello.java 
b/src/example/dual/project/src/example/Hello.java
deleted file mode 100644
index bc84237..0000000
--- a/src/example/dual/project/src/example/Hello.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-package example;
-
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.methods.HeadMethod;
-import org.apache.commons.lang.WordUtils;
-
-/**
- * Simple hello world example to show how easy it is to retrieve libs with ivy,
- * including transitive dependencies
- */
-public final class Hello {
-    public static void main(String[] args) throws Exception {
-        String  message = "hello ivy !";
-        System.out.println("standard message : " + message);
-        System.out.println("capitalized by " + WordUtils.class.getName()
-            + " : " + WordUtils.capitalizeFully(message));
-
-        HttpClient client = new HttpClient();
-        HeadMethod head = new HeadMethod("http://www.ibiblio.org/";);
-        client.executeMethod(head);
-
-        int status = head.getStatusCode();
-        System.out.println("head status code with httpclient: " + status);
-        head.releaseConnection();
-
-        System.out.println(
-            "now check if httpclient dependency on commons-logging has been 
realized");
-        Class clss = Class.forName("org.apache.commons.logging.Log");
-        System.out.println("found logging class in classpath: " + clss);
-    }
-
-    private Hello() {
-    }
-}

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/example/dual/project/src/example/HelloIvy.java
----------------------------------------------------------------------
diff --git a/src/example/dual/project/src/example/HelloIvy.java 
b/src/example/dual/project/src/example/HelloIvy.java
new file mode 100644
index 0000000..bc84237
--- /dev/null
+++ b/src/example/dual/project/src/example/HelloIvy.java
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package example;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.HeadMethod;
+import org.apache.commons.lang.WordUtils;
+
+/**
+ * Simple hello world example to show how easy it is to retrieve libs with ivy,
+ * including transitive dependencies
+ */
+public final class Hello {
+    public static void main(String[] args) throws Exception {
+        String  message = "hello ivy !";
+        System.out.println("standard message : " + message);
+        System.out.println("capitalized by " + WordUtils.class.getName()
+            + " : " + WordUtils.capitalizeFully(message));
+
+        HttpClient client = new HttpClient();
+        HeadMethod head = new HeadMethod("http://www.ibiblio.org/";);
+        client.executeMethod(head);
+
+        int status = head.getStatusCode();
+        System.out.println("head status code with httpclient: " + status);
+        head.releaseConnection();
+
+        System.out.println(
+            "now check if httpclient dependency on commons-logging has been 
realized");
+        Class clss = Class.forName("org.apache.commons.logging.Log");
+        System.out.println("found logging class in classpath: " + clss);
+    }
+
+    private Hello() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/example/hello-ivy/src/example/Hello.java
----------------------------------------------------------------------
diff --git a/src/example/hello-ivy/src/example/Hello.java 
b/src/example/hello-ivy/src/example/Hello.java
deleted file mode 100644
index f3d0d45..0000000
--- a/src/example/hello-ivy/src/example/Hello.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-package example;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.CommandLineParser;
-import org.apache.commons.cli.GnuParser;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.commons.cli.Options;
-import org.apache.commons.lang.WordUtils;
-
-/**
- * Simple example to show how easy it is to retrieve transitive libs with ivy 
!!!
- */
-public final class Hello {
-    public static void main(String[] args) throws Exception {
-        Option msg = OptionBuilder.withArgName("msg")
-            .hasArg()
-            .withDescription("the message to capitalize")
-            .create("message");
-        Options options = new Options();
-        options.addOption(msg);
-
-        CommandLineParser parser = new GnuParser();
-        CommandLine line = parser.parse(options, args);
-
-        String  message = line.getOptionValue("message", "hello ivy !");
-        System.out.println("standard message : " + message);
-        System.out.println("capitalized by " + WordUtils.class.getName()
-            + " : " + WordUtils.capitalizeFully(message));
-    }
-
-    private Hello() {
-    }
-}

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/example/hello-ivy/src/example/HelloConsole.java
----------------------------------------------------------------------
diff --git a/src/example/hello-ivy/src/example/HelloConsole.java 
b/src/example/hello-ivy/src/example/HelloConsole.java
new file mode 100644
index 0000000..f3d0d45
--- /dev/null
+++ b/src/example/hello-ivy/src/example/HelloConsole.java
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package example;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+import org.apache.commons.lang.WordUtils;
+
+/**
+ * Simple example to show how easy it is to retrieve transitive libs with ivy 
!!!
+ */
+public final class Hello {
+    public static void main(String[] args) throws Exception {
+        Option msg = OptionBuilder.withArgName("msg")
+            .hasArg()
+            .withDescription("the message to capitalize")
+            .create("message");
+        Options options = new Options();
+        options.addOption(msg);
+
+        CommandLineParser parser = new GnuParser();
+        CommandLine line = parser.parse(options, args);
+
+        String  message = line.getOptionValue("message", "hello ivy !");
+        System.out.println("standard message : " + message);
+        System.out.println("capitalized by " + WordUtils.class.getName()
+            + " : " + WordUtils.capitalizeFully(message));
+    }
+
+    private Hello() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/example/multi-project/projects/find/src/find/FindFile.java
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/find/src/find/FindFile.java 
b/src/example/multi-project/projects/find/src/find/FindFile.java
index 1e1e7ea..8e54dc2 100644
--- a/src/example/multi-project/projects/find/src/find/FindFile.java
+++ b/src/example/multi-project/projects/find/src/find/FindFile.java
@@ -38,7 +38,7 @@ public final class FindFile {
   private static Collection find(Collection files, final String name) {
     return CollectionUtils.select(files, new Predicate() {
       public boolean evaluate(Object o) {
-        return ((File) o).getName().indexOf(name) != -1;
+        return ((File) o).getName().contains(name);
       }
     });
   }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/example/multi-project/projects/find/src/find/Main.java
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/find/src/find/Main.java 
b/src/example/multi-project/projects/find/src/find/Main.java
index 1ed0c7e..ccfa1ce 100644
--- a/src/example/multi-project/projects/find/src/find/Main.java
+++ b/src/example/multi-project/projects/find/src/find/Main.java
@@ -59,8 +59,8 @@ public final class Main {
             String name = line.getOptionValue("name", "jar");
             Collection files = FindFile.find(dir, name);
             System.out.println("listing files in " + dir + " containing " + 
name);
-            for (Iterator it = files.iterator(); it.hasNext();) {
-                System.out.println("\t" + it.next() + "\n");
+            for (Object file : files) {
+                System.out.println("\t" + file + "\n");
             }
         } catch (ParseException exp) {
             // oops, something went wrong

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/example/multi-project/projects/list/src/list/ListFile.java
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/list/src/list/ListFile.java 
b/src/example/multi-project/projects/list/src/list/ListFile.java
index 0985ab7..14a28e7 100644
--- a/src/example/multi-project/projects/list/src/list/ListFile.java
+++ b/src/example/multi-project/projects/list/src/list/ListFile.java
@@ -35,9 +35,8 @@ public final class ListFile {
 
   private static Collection list(File file, Collection files) {
     if (file.isDirectory()) {
-      File[] f = file.listFiles();
-      for (int i = 0; i < f.length; i++) {
-        list(f[i], files);
+      for (File f : file.listFiles()) {
+        list(f, files);
       }
     } else {
       files.add(file);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/example/multi-project/projects/size/src/size/FileSize.java
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/size/src/size/FileSize.java 
b/src/example/multi-project/projects/size/src/size/FileSize.java
index f0e0163..c2efcf1 100644
--- a/src/example/multi-project/projects/size/src/size/FileSize.java
+++ b/src/example/multi-project/projects/size/src/size/FileSize.java
@@ -33,9 +33,8 @@ public final class FileSize {
 
   public static long totalSize(Collection files) {
     long total = 0;
-    for (Iterator it = files.iterator(); it.hasNext();) {
-      File f = (File) it.next();
-      total += f.length();
+    for (Object file : files) {
+      total += ((File) file).length();
     }
     return total;
   }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java 
b/src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java
index 444b2f9..53e4429 100644
--- a/src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java
+++ b/src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java
@@ -86,15 +86,13 @@ public class VfsResource implements Resource {
      *
      * @return A <code>ArrayList</code> of VFSResources
      */
-    public List getChildren() {
+    public List<String> getChildren() {
         init();
-        ArrayList list = new ArrayList();
+        ArrayList<String> list = new ArrayList<String>();
         try {
             if ((resourceImpl != null) && resourceImpl.exists()
                     && (resourceImpl.getType() == FileType.FOLDER)) {
-                FileObject[] children = resourceImpl.getChildren();
-                for (int i = 0; i < children.length; i++) {
-                    FileObject child = children[i];
+                for (FileObject child : resourceImpl.getChildren()) {
                     list.add(normalize(child.getName().getURI()));
                 }
             }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/TestFixture.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/TestFixture.java 
b/test/java/org/apache/ivy/TestFixture.java
index 9690978..b47b626 100644
--- a/test/java/org/apache/ivy/TestFixture.java
+++ b/test/java/org/apache/ivy/TestFixture.java
@@ -24,6 +24,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 
 import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
+import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 import org.apache.ivy.core.report.ResolveReport;
 import org.apache.ivy.core.settings.IvySettings;
@@ -64,7 +65,7 @@ import org.apache.ivy.plugins.resolver.util.ResolvedResource;
  */
 public class TestFixture {
 
-    private Collection mds = new ArrayList();
+    private final Collection<ModuleDescriptor> mds = new 
ArrayList<ModuleDescriptor>();
 
     private Ivy ivy;
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/TestHelper.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/TestHelper.java 
b/test/java/org/apache/ivy/TestHelper.java
index 7963407..1a18c66 100644
--- a/test/java/org/apache/ivy/TestHelper.java
+++ b/test/java/org/apache/ivy/TestHelper.java
@@ -22,7 +22,6 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -95,8 +94,8 @@ public class TestHelper {
      *            the3 mrids to test
      */
     public static void assertModuleRevisionIds(String expectedMrids,
-            Collection/* <ModuleRevisionId> */mrids) {
-        Collection expected = parseMrids(expectedMrids);
+            Collection<ModuleRevisionId> mrids) {
+        Collection<ModuleRevisionId> expected = parseMrids(expectedMrids);
         assertEquals(expected, mrids);
     }
 
@@ -108,11 +107,11 @@ public class TestHelper {
      *            the text representation of the {@link ModuleRevisionId}
      * @return a collection of {@link ModuleRevisionId}
      */
-    public static Collection parseMrids(String mrids) {
+    public static Collection<ModuleRevisionId> parseMrids(String mrids) {
         String[] m = mrids.split(",?\\s+");
-        Collection c = new LinkedHashSet();
-        for (int i = 0; i < m.length; i++) {
-            c.add(ModuleRevisionId.parse(m[i]));
+        Collection<ModuleRevisionId> c = new LinkedHashSet<ModuleRevisionId>();
+        for (String s : m) {
+            c.add(ModuleRevisionId.parse(s));
         }
         return c;
     }
@@ -126,8 +125,8 @@ public class TestHelper {
      * @return an array of {@link ModuleRevisionId}
      */
     public static ModuleRevisionId[] parseMridsToArray(String mrids) {
-        Collection parsedMrids = parseMrids(mrids);
-        return (ModuleRevisionId[]) parsedMrids.toArray(new 
ModuleRevisionId[parsedMrids.size()]);
+        Collection<ModuleRevisionId> parsedMrids = parseMrids(mrids);
+        return parsedMrids.toArray(new ModuleRevisionId[parsedMrids.size()]);
     }
 
     /**
@@ -185,9 +184,8 @@ public class TestHelper {
                 ModuleRevisionId.parse(m.group(1)), new Date());
             String mrids = m.group(2);
             if (mrids != null) {
-                Collection depMrids = parseMrids(mrids);
-                for (Iterator iter = depMrids.iterator(); iter.hasNext();) {
-                    ModuleRevisionId dep = (ModuleRevisionId) iter.next();
+                Collection<ModuleRevisionId> depMrids = parseMrids(mrids);
+                for (ModuleRevisionId dep : depMrids) {
                     md.addDependency(new DefaultDependencyDescriptor(dep, 
false));
                 }
             }
@@ -204,11 +202,11 @@ public class TestHelper {
      *            the text representation of the collection of module 
descriptors
      * @return the collection of module descriptors parsed
      */
-    public static Collection/* <ModuleDescriptor> 
*/parseMicroIvyDescriptors(String microIvy) {
+    public static Collection<ModuleDescriptor> parseMicroIvyDescriptors(String 
microIvy) {
         String[] mds = microIvy.split("\\s*;;\\s*");
-        Collection r = new ArrayList();
-        for (int i = 0; i < mds.length; i++) {
-            r.add(parseMicroIvyDescriptor(mds[i]));
+        Collection<ModuleDescriptor> r = new ArrayList<ModuleDescriptor>();
+        for (String md : mds) {
+            r.add(parseMicroIvyDescriptor(md));
         }
         return r;
     }
@@ -223,13 +221,12 @@ public class TestHelper {
      * @throws IOException
      *             if an IO problem occurs while filling the repository
      */
-    public static void fillRepository(DependencyResolver resolver,
-            Collection/* <ModuleDescriptor> */mds) throws IOException {
+    public static void fillRepository(DependencyResolver resolver, 
Collection<ModuleDescriptor> mds)
+            throws IOException {
         File tmp = File.createTempFile("ivy", "tmp");
         try {
-            for (Iterator iter = mds.iterator(); iter.hasNext();) {
+            for (ModuleDescriptor md : mds) {
                 boolean overwrite = false;
-                ModuleDescriptor md = (ModuleDescriptor) iter.next();
                 resolver.beginPublishTransaction(md.getModuleRevisionId(), 
overwrite);
                 boolean published = false;
                 try {
@@ -237,9 +234,8 @@ public class TestHelper {
                     resolver.publish(md.getMetadataArtifact(), tmp, overwrite);
                     tmp.delete();
                     tmp.createNewFile();
-                    Artifact[] artifacts = md.getAllArtifacts();
-                    for (int i = 0; i < artifacts.length; i++) {
-                        resolver.publish(artifacts[i], tmp, overwrite);
+                    for (Artifact artifact : md.getAllArtifacts()) {
+                        resolver.publish(artifact, tmp, overwrite);
                     }
                     resolver.commitPublishTransaction();
                     published = true;

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/ant/AntBuildResolverTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/AntBuildResolverTest.java 
b/test/java/org/apache/ivy/ant/AntBuildResolverTest.java
index 9e228a4..0bf8bd8 100644
--- a/test/java/org/apache/ivy/ant/AntBuildResolverTest.java
+++ b/test/java/org/apache/ivy/ant/AntBuildResolverTest.java
@@ -85,7 +85,7 @@ public class AntBuildResolverTest {
         resolve.setKeep(true);
         resolve.execute();
 
-        ResolveReport report = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport report = project.getReference("ivy.resolved.report");
         assertEquals(1, report.getDependencies().size());
         assertEquals(MRID_MODULE1, 
report.getDependencies().get(0).getResolvedId());
     }
@@ -98,7 +98,7 @@ public class AntBuildResolverTest {
         resolve.setKeep(true);
         resolve.execute();
 
-        ResolveReport report = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport report = project.getReference("ivy.resolved.report");
         assertEquals(2, report.getDependencies().size());
         assertEquals(MRID_PROJECT1, 
report.getDependencies().get(0).getResolvedId());
         assertEquals(MRID_MODULE1, 
report.getDependencies().get(1).getResolvedId());
@@ -122,7 +122,7 @@ public class AntBuildResolverTest {
         resolve.setKeep(true);
         resolve.execute();
 
-        ResolveReport report = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport report = project.getReference("ivy.resolved.report");
         assertEquals(2, report.getDependencies().size());
         assertEquals(MRID_PROJECT1, 
report.getDependencies().get(0).getResolvedId());
         assertEquals(MRID_MODULE1, 
report.getDependencies().get(1).getResolvedId());
@@ -143,7 +143,7 @@ public class AntBuildResolverTest {
         resolve.setKeep(true);
         resolve.execute();
 
-        ResolveReport report = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport report = project.getReference("ivy.resolved.report");
         assertEquals(2, report.getDependencies().size());
         assertEquals(MRID_PROJECT1, 
report.getDependencies().get(0).getResolvedId());
         assertEquals(MRID_MODULE1, 
report.getDependencies().get(1).getResolvedId());
@@ -170,7 +170,7 @@ public class AntBuildResolverTest {
         cachePath.setPathid("test.cachepath.id");
         cachePath.execute();
 
-        Path path = (Path) project.getReference("test.cachepath.id");
+        Path path = project.getReference("test.cachepath.id");
         assertEquals(2, path.size());
         assertEquals(
             new 
File("test/workspace/project1/target/dist/jars/project1.jar").getAbsolutePath(),
@@ -194,7 +194,7 @@ public class AntBuildResolverTest {
         cachePath.setPathid("test.cachepath.id");
         cachePath.execute();
 
-        Path path = (Path) project.getReference("test.cachepath.id");
+        Path path = project.getReference("test.cachepath.id");
         assertEquals(2, path.size());
         assertEquals(new 
File("test/workspace/project1/target/classes").getAbsolutePath(),
             path.list()[0]);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/ant/FixDepsTaskTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/FixDepsTaskTest.java 
b/test/java/org/apache/ivy/ant/FixDepsTaskTest.java
index 42a8037..8811348 100644
--- a/test/java/org/apache/ivy/ant/FixDepsTaskTest.java
+++ b/test/java/org/apache/ivy/ant/FixDepsTaskTest.java
@@ -23,6 +23,7 @@ import java.util.Arrays;
 import java.util.List;
 
 import org.apache.ivy.TestHelper;
+import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
 import org.apache.ivy.core.settings.IvySettings;
 import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
@@ -215,10 +216,10 @@ public class FixDepsTaskTest {
             toString(Arrays.asList(md2.getDependencies())));
     }
 
-    private List/* <String> */toString(List list) {
-        List strings = new ArrayList(list.size());
-        for (int i = 0; i < list.size(); i++) {
-            strings.add(list.get(i).toString());
+    private List<String> toString(List<DependencyDescriptor> list) {
+        List<String> strings = new ArrayList<String>(list.size());
+        for (DependencyDescriptor dd : list) {
+            strings.add(dd.toString());
         }
         return strings;
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/ant/IvyBuildListTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/IvyBuildListTest.java 
b/test/java/org/apache/ivy/ant/IvyBuildListTest.java
index 2599c70..cb5b4e4 100644
--- a/test/java/org/apache/ivy/ant/IvyBuildListTest.java
+++ b/test/java/org/apache/ivy/ant/IvyBuildListTest.java
@@ -340,7 +340,7 @@ public class IvyBuildListTest {
         fs.setExcludes("E2/build.xml,F/build.xml,G/build.xml");
 
         buildlist.addFileset(fs);
-        buildlist.setOnMissingDescriptor(new String("tail")); // IVY-805: new 
String instance
+        buildlist.setOnMissingDescriptor("tail"); // IVY-805: new String 
instance
 
         String[] files = getFiles(buildlist);
 
@@ -357,7 +357,7 @@ public class IvyBuildListTest {
         fs.setExcludes("E2/build.xml,F/build.xml,G/build.xml");
 
         buildlist.addFileset(fs);
-        buildlist.setOnMissingDescriptor(new String("skip")); // IVY-805: new 
String instance
+        buildlist.setOnMissingDescriptor("skip"); // IVY-805: new String 
instance
 
         String[] files = getFiles(buildlist);
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/ant/IvyDeliverTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/IvyDeliverTest.java 
b/test/java/org/apache/ivy/ant/IvyDeliverTest.java
index 15ac59a..881b971 100644
--- a/test/java/org/apache/ivy/ant/IvyDeliverTest.java
+++ b/test/java/org/apache/ivy/ant/IvyDeliverTest.java
@@ -385,7 +385,7 @@ public class IvyDeliverTest {
             md.getModuleRevisionId());
         DependencyDescriptor[] dds = md.getDependencies();
         assertEquals(1, dds.length);
-        Map extraAtt = new HashMap();
+        Map<String, String> extraAtt = new HashMap<String, String>();
         extraAtt.put("myExtraAtt", "myValue");
         assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2", 
extraAtt),
             dds[0].getDependencyRevisionId());
@@ -423,8 +423,8 @@ public class IvyDeliverTest {
 
         File list = new File("build/test/retrieve");
         String[] files = list.list();
-        HashSet actualFileSet = new HashSet(Arrays.asList(files));
-        HashSet expectedFileSet = new HashSet();
+        HashSet<String> actualFileSet = new 
HashSet<String>(Arrays.asList(files));
+        HashSet<String> expectedFileSet = new HashSet<String>();
         for (DependencyDescriptor dd : dds) {
             String name = dd.getDependencyId().getName();
             String rev = dd.getDependencyRevisionId().getRevision();
@@ -470,8 +470,8 @@ public class IvyDeliverTest {
 
         File list = new File("build/test/retrieve");
         String[] files = list.list();
-        HashSet actualFileSet = new HashSet(Arrays.asList(files));
-        HashSet expectedFileSet = new HashSet();
+        HashSet<String> actualFileSet = new 
HashSet<String>(Arrays.asList(files));
+        HashSet<String> expectedFileSet = new HashSet<String>();
         for (DependencyDescriptor dd : dds) {
             String name = dd.getDependencyId().getName();
             String rev = dd.getDependencyRevisionId().getRevision();

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/ant/IvyPostResolveTaskTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/IvyPostResolveTaskTest.java 
b/test/java/org/apache/ivy/ant/IvyPostResolveTaskTest.java
index 295fc1c..23bbf3f 100644
--- a/test/java/org/apache/ivy/ant/IvyPostResolveTaskTest.java
+++ b/test/java/org/apache/ivy/ant/IvyPostResolveTaskTest.java
@@ -72,12 +72,12 @@ public class IvyPostResolveTaskTest {
         resolve.setConf("default,compile");
         resolve.execute();
 
-        ResolveReport reportBefore = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport reportBefore = 
project.getReference("ivy.resolved.report");
 
         task.setConf("default");
         task.execute();
 
-        ResolveReport reportAfter = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport reportAfter = 
project.getReference("ivy.resolved.report");
 
         assertSame("IvyPostResolveTask has performed a resolve where it 
shouldn't", reportBefore,
             reportAfter);
@@ -91,12 +91,12 @@ public class IvyPostResolveTaskTest {
         resolve.setConf("default");
         resolve.execute();
 
-        ResolveReport reportBefore = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport reportBefore = 
project.getReference("ivy.resolved.report");
 
         task.setConf("default");
         task.execute();
 
-        ResolveReport reportAfter = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport reportAfter = 
project.getReference("ivy.resolved.report");
 
         assertSame("IvyPostResolveTask has performed a resolve where it 
shouldn't", reportBefore,
             reportAfter);
@@ -110,12 +110,12 @@ public class IvyPostResolveTaskTest {
         resolve.setConf("*");
         resolve.execute();
 
-        ResolveReport reportBefore = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport reportBefore = 
project.getReference("ivy.resolved.report");
 
         task.setConf("default");
         task.execute();
 
-        ResolveReport reportAfter = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport reportAfter = 
project.getReference("ivy.resolved.report");
 
         assertSame("IvyPostResolveTask has performed a resolve where it 
shouldn't", reportBefore,
             reportAfter);
@@ -129,12 +129,12 @@ public class IvyPostResolveTaskTest {
         resolve.setConf("*");
         resolve.execute();
 
-        ResolveReport reportBefore = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport reportBefore = 
project.getReference("ivy.resolved.report");
 
         task.setConf("*");
         task.execute();
 
-        ResolveReport reportAfter = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport reportAfter = 
project.getReference("ivy.resolved.report");
 
         assertSame("IvyPostResolveTask has performed a resolve where it 
shouldn't", reportBefore,
             reportAfter);
@@ -148,14 +148,14 @@ public class IvyPostResolveTaskTest {
         resolve.setConf("compile");
         resolve.execute();
 
-        ResolveReport reportBefore = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport reportBefore = 
project.getReference("ivy.resolved.report");
         assertTrue(getArchiveFileInCache("org1", "mod1.1", "2.0", "mod1.1", 
"jar", "jar").exists());
         assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", 
"jar", "jar").exists());
 
         task.setConf("*");
         task.execute();
 
-        ResolveReport reportAfter = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport reportAfter = 
project.getReference("ivy.resolved.report");
 
         assertNotSame("IvyPostResolveTask hasn't performed a resolve where it 
should have",
             reportBefore, reportAfter);
@@ -170,7 +170,7 @@ public class IvyPostResolveTaskTest {
         resolve.setConf("compile");
         resolve.execute();
 
-        ResolveReport reportBefore = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport reportBefore = 
project.getReference("ivy.resolved.report");
         assertTrue(getArchiveFileInCache("org1", "mod1.1", "2.0", "mod1.1", 
"jar", "jar").exists());
         assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", 
"jar", "jar").exists());
 
@@ -178,7 +178,7 @@ public class IvyPostResolveTaskTest {
         task.setKeep(false); // don't keep the resolve results
         task.execute();
 
-        ResolveReport reportAfter = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport reportAfter = 
project.getReference("ivy.resolved.report");
 
         assertSame("IvyPostResolveTask has kept the resolve report where it 
should have",
             reportBefore, reportAfter);
@@ -194,7 +194,7 @@ public class IvyPostResolveTaskTest {
         task.setConf("*"); // will trigger a resolve
         task.execute();
 
-        ResolveReport reportAfter = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport reportAfter = 
project.getReference("ivy.resolved.report");
 
         assertNull("IvyPostResolveTask has kept the resolve report where it 
should have",
             reportAfter);
@@ -211,7 +211,7 @@ public class IvyPostResolveTaskTest {
         task.setConf("*"); // will trigger a resolve
         task.execute();
 
-        ResolveReport reportAfter = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport reportAfter = 
project.getReference("ivy.resolved.report");
 
         assertNotNull("IvyPostResolveTask has kept the resolve report where it 
should have",
             reportAfter);
@@ -227,8 +227,7 @@ public class IvyPostResolveTaskTest {
         resolve.setResolveId("testResolveId");
         resolve.execute();
 
-        ResolveReport report1 = (ResolveReport) project
-                .getReference("ivy.resolved.report.testResolveId");
+        ResolveReport report1 = 
project.getReference("ivy.resolved.report.testResolveId");
 
         // perform another resolve
         resolve = new IvyResolve();
@@ -237,14 +236,14 @@ public class IvyPostResolveTaskTest {
         resolve.setConf("*");
         resolve.execute();
 
-        ResolveReport reportBefore = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport reportBefore = 
project.getReference("ivy.resolved.report");
 
         task.setConf("default");
         task.setResolveId("testResolveId");
         task.execute();
 
-        ResolveReport reportAfter = (ResolveReport) 
project.getReference("ivy.resolved.report");
-        ResolveReport report2 = (ResolveReport) project
+        ResolveReport reportAfter = 
project.getReference("ivy.resolved.report");
+        ResolveReport report2 = project
                 .getReference("ivy.resolved.report.testResolveId");
 
         assertSame("IvyPostResolveTask has performed a resolve where it 
shouldn't", reportBefore,
@@ -262,7 +261,7 @@ public class IvyPostResolveTaskTest {
         resolve.setResolveId("testResolveId");
         resolve.execute();
 
-        ResolveReport report1 = (ResolveReport) project
+        ResolveReport report1 = project
                 .getReference("ivy.resolved.report.testResolveId");
 
         // perform another resolve
@@ -272,14 +271,14 @@ public class IvyPostResolveTaskTest {
         resolve.setConf("*");
         resolve.execute();
 
-        ResolveReport reportBefore = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport reportBefore = 
project.getReference("ivy.resolved.report");
 
         task.setConf("default");
         task.setResolveId("testResolveId");
         task.execute();
 
-        ResolveReport reportAfter = (ResolveReport) 
project.getReference("ivy.resolved.report");
-        ResolveReport report2 = (ResolveReport) project
+        ResolveReport reportAfter = 
project.getReference("ivy.resolved.report");
+        ResolveReport report2 = project
                 .getReference("ivy.resolved.report.testResolveId");
 
         assertSame("IvyPostResolveTask has performed a resolve where it 
shouldn't", reportBefore,
@@ -297,7 +296,7 @@ public class IvyPostResolveTaskTest {
         resolve.setResolveId("testResolveId");
         resolve.execute();
 
-        ResolveReport report1 = (ResolveReport) project
+        ResolveReport report1 = project
                 .getReference("ivy.resolved.report.testResolveId");
 
         // perform another resolve
@@ -307,14 +306,14 @@ public class IvyPostResolveTaskTest {
         resolve.setConf("*");
         resolve.execute();
 
-        ResolveReport reportBefore = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport reportBefore = 
project.getReference("ivy.resolved.report");
 
         task.setConf("default");
         task.setResolveId("testResolveId");
         task.execute();
 
-        ResolveReport reportAfter = (ResolveReport) 
project.getReference("ivy.resolved.report");
-        ResolveReport report2 = (ResolveReport) project
+        ResolveReport reportAfter = 
project.getReference("ivy.resolved.report");
+        ResolveReport report2 = project
                 .getReference("ivy.resolved.report.testResolveId");
 
         assertSame("IvyPostResolveTask has performed a resolve where it 
shouldn't", reportBefore,
@@ -332,7 +331,7 @@ public class IvyPostResolveTaskTest {
         resolve.setResolveId("testResolveId");
         resolve.execute();
 
-        ResolveReport report1 = (ResolveReport) project
+        ResolveReport report1 = project
                 .getReference("ivy.resolved.report.testResolveId");
 
         // perform another resolve
@@ -342,14 +341,14 @@ public class IvyPostResolveTaskTest {
         resolve.setConf("*");
         resolve.execute();
 
-        ResolveReport reportBefore = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport reportBefore = 
project.getReference("ivy.resolved.report");
 
         task.setConf("*");
         task.setResolveId("testResolveId");
         task.execute();
 
-        ResolveReport reportAfter = (ResolveReport) 
project.getReference("ivy.resolved.report");
-        ResolveReport report2 = (ResolveReport) project
+        ResolveReport reportAfter = 
project.getReference("ivy.resolved.report");
+        ResolveReport report2 = project
                 .getReference("ivy.resolved.report.testResolveId");
 
         assertSame("IvyPostResolveTask has performed a resolve where it 
shouldn't", reportBefore,
@@ -367,7 +366,7 @@ public class IvyPostResolveTaskTest {
         resolve.setResolveId("testResolveId");
         resolve.execute();
 
-        ResolveReport report1 = (ResolveReport) project
+        ResolveReport report1 = project
                 .getReference("ivy.resolved.report.testResolveId");
         assertTrue(getArchiveFileInCache("org1", "mod1.1", "2.0", "mod1.1", 
"jar", "jar").exists());
         assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", 
"jar", "jar").exists());
@@ -379,14 +378,14 @@ public class IvyPostResolveTaskTest {
         resolve.setConf("*");
         resolve.execute();
 
-        ResolveReport reportBefore = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport reportBefore = 
project.getReference("ivy.resolved.report");
 
         task.setConf("*");
         task.setResolveId("testResolveId");
         task.execute();
 
-        ResolveReport reportAfter = (ResolveReport) 
project.getReference("ivy.resolved.report");
-        ResolveReport report2 = (ResolveReport) project
+        ResolveReport reportAfter = 
project.getReference("ivy.resolved.report");
+        ResolveReport report2 = project
                 .getReference("ivy.resolved.report.testResolveId");
 
         assertNotSame("IvyPostResolveTask hasn't performed a resolve where it 
should have",

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/ant/IvyResolveTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/IvyResolveTest.java 
b/test/java/org/apache/ivy/ant/IvyResolveTest.java
index 49cfd91..ee220e9 100644
--- a/test/java/org/apache/ivy/ant/IvyResolveTest.java
+++ b/test/java/org/apache/ivy/ant/IvyResolveTest.java
@@ -101,7 +101,7 @@ public class IvyResolveTest {
         resolve.setKeep(true);
         resolve.execute();
 
-        ResolveReport report = (ResolveReport) 
project.getReference("ivy.resolved.report");
+        ResolveReport report = project.getReference("ivy.resolved.report");
         assertNotNull(report);
         assertFalse(report.hasError());
         assertEquals(1, report.getArtifacts().size());

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/ant/IvyResourcesTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/IvyResourcesTest.java 
b/test/java/org/apache/ivy/ant/IvyResourcesTest.java
index 95a9c9d..ab60e6d 100644
--- a/test/java/org/apache/ivy/ant/IvyResourcesTest.java
+++ b/test/java/org/apache/ivy/ant/IvyResourcesTest.java
@@ -22,7 +22,6 @@ import static org.junit.Assert.assertTrue;
 
 import java.io.File;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.ivy.Ivy;
@@ -66,9 +65,7 @@ public class IvyResourcesTest {
 
     private List asList(IvyResources ivyResources) {
         List resources = new ArrayList();
-        Iterator it = ivyResources.iterator();
-        while (it.hasNext()) {
-            Object r = it.next();
+        for (Object r : ivyResources) {
             assertTrue(r instanceof FileResource);
             resources.add(((FileResource) r).getFile());
         }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/core/module/id/ModuleIdTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/module/id/ModuleIdTest.java 
b/test/java/org/apache/ivy/core/module/id/ModuleIdTest.java
index d65b91a..6adc823 100644
--- a/test/java/org/apache/ivy/core/module/id/ModuleIdTest.java
+++ b/test/java/org/apache/ivy/core/module/id/ModuleIdTest.java
@@ -69,7 +69,7 @@ public class ModuleIdTest {
         ModuleId moduleId = new ModuleId(org, name);
         ModuleId moduleId2 = new ModuleId(null, name);
 
-        assertFalse(moduleId.equals(null));
+        assertNotNull(moduleId);
         assertFalse(moduleId.equals(moduleId2));
         assertFalse(moduleId2.equals(moduleId));
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/core/publish/PublishEventsTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/publish/PublishEventsTest.java 
b/test/java/org/apache/ivy/core/publish/PublishEventsTest.java
index 6062441..858d44a 100644
--- a/test/java/org/apache/ivy/core/publish/PublishEventsTest.java
+++ b/test/java/org/apache/ivy/core/publish/PublishEventsTest.java
@@ -23,7 +23,6 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.Iterator;
 
 import org.apache.ivy.Ivy;
 import org.apache.ivy.core.IvyContext;
@@ -247,8 +246,8 @@ public class PublishEventsTest {
         // set an error to be thrown during publication of the data file.
         this.publishError = new IOException("boom!");
         // we don't care which artifact is attempted; either will fail with an 
IOException.
-        for (Iterator it = expectedPublications.values().iterator(); 
it.hasNext();) {
-            ((PublishTestCase) it.next()).expectedSuccess = false;
+        for (Object o : expectedPublications.values()) {
+            ((PublishTestCase) o).expectedSuccess = false;
         }
 
         try {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/core/search/SearchTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/search/SearchTest.java 
b/test/java/org/apache/ivy/core/search/SearchTest.java
index 2fa96ee..e56f9bd 100644
--- a/test/java/org/apache/ivy/core/search/SearchTest.java
+++ b/test/java/org/apache/ivy/core/search/SearchTest.java
@@ -42,13 +42,13 @@ public class SearchTest {
         Ivy ivy = Ivy.newInstance();
         ivy.configure(new 
File("test/repositories/m2/ivysettings.xml").toURI().toURL());
 
-        Map otherTokenValues = new HashMap();
+        Map<String, Object> otherTokenValues = new HashMap<String, Object>();
         otherTokenValues.put(IvyPatternHelper.ORGANISATION_KEY, "org.apache");
         otherTokenValues.put(IvyPatternHelper.MODULE_KEY, "test-metadata");
         String[] revs = ivy.listTokenValues(IvyPatternHelper.REVISION_KEY, 
otherTokenValues);
 
-        assertEquals(new HashSet(Arrays.asList(new String[] {"1.0", "1.1"})),
-            new HashSet(Arrays.asList(revs)));
+        assertEquals(new HashSet<String>(Arrays.asList(new String[] {"1.0", 
"1.1"})),
+            new HashSet<String>(Arrays.asList(revs)));
     }
 
     @Test
@@ -57,13 +57,13 @@ public class SearchTest {
         ivy.configure(new 
File("test/repositories/m2/ivysettings.xml").toURI().toURL());
         ((IBiblioResolver) 
ivy.getSettings().getResolver("m2")).setUseMavenMetadata(false);
 
-        Map otherTokenValues = new HashMap();
+        Map<String, Object> otherTokenValues = new HashMap<String, Object>();
         otherTokenValues.put(IvyPatternHelper.ORGANISATION_KEY, "org.apache");
         otherTokenValues.put(IvyPatternHelper.MODULE_KEY, "test-metadata");
         String[] revs = ivy.listTokenValues(IvyPatternHelper.REVISION_KEY, 
otherTokenValues);
 
-        assertEquals(new HashSet(Arrays.asList(new String[] {"1.0", "1.1", 
"1.2"})), new HashSet(
-                Arrays.asList(revs)));
+        assertEquals(new HashSet<String>(Arrays.asList(new String[] {"1.0", 
"1.1", "1.2"})),
+            new HashSet<String>(Arrays.asList(revs)));
     }
 
     @Test
@@ -72,7 +72,7 @@ public class SearchTest {
         ivy.configure(new File("test/repositories/IVY-1128/ivysettings.xml"));
         IvySettings settings = ivy.getSettings();
 
-        Map extendedAttributes = new HashMap();
+        Map<String, String> extendedAttributes = new HashMap<String, String>();
         extendedAttributes.put("e:att1", "extraatt");
         extendedAttributes.put("e:att2", "extraatt2");
         ModuleRevisionId criteria = ModuleRevisionId.newInstance("test", "a", 
"*",
@@ -85,12 +85,12 @@ public class SearchTest {
         ModuleRevisionId mrid = mrids[0];
         assertEquals("extraatt", mrid.getExtraAttribute("att1"));
 
-        Map extraAttributes = mrid.getExtraAttributes();
+        Map<String, String> extraAttributes = mrid.getExtraAttributes();
         assertEquals(2, extraAttributes.size());
         assertTrue(extraAttributes.toString(), 
extraAttributes.keySet().contains("att1"));
         assertTrue(extraAttributes.toString(), 
extraAttributes.keySet().contains("att2"));
 
-        Map qualifiedExtraAttributes = mrid.getQualifiedExtraAttributes();
+        Map<String, String> qualifiedExtraAttributes = 
mrid.getQualifiedExtraAttributes();
         assertEquals(2, qualifiedExtraAttributes.size());
         assertTrue(qualifiedExtraAttributes.toString(),
             qualifiedExtraAttributes.keySet().contains("e:att1"));

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/core/sort/SortTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/sort/SortTest.java 
b/test/java/org/apache/ivy/core/sort/SortTest.java
index 4a8477d..9dda5df 100644
--- a/test/java/org/apache/ivy/core/sort/SortTest.java
+++ b/test/java/org/apache/ivy/core/sort/SortTest.java
@@ -21,7 +21,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
@@ -83,9 +82,8 @@ public class SortTest {
         DefaultModuleDescriptor[][] expectedOrder = new 
DefaultModuleDescriptor[][] {
                 {md1, md2, md3, md4}};
 
-        Collection permutations = getAllLists(md1, md3, md2, md4);
-        for (Iterator it = permutations.iterator(); it.hasNext();) {
-            List toSort = (List) it.next();
+        Collection<List<ModuleDescriptor>> permutations = getAllLists(md1, 
md3, md2, md4);
+        for (List<ModuleDescriptor> toSort : permutations) {
             assertSorted(expectedOrder, sortModuleDescriptors(toSort, 
nonMatchReporter));
         }
     }
@@ -106,9 +104,8 @@ public class SortTest {
                 {md2, md3, md4, md1}, {md3, md4, md1, md2}, {md4, md1, md2, 
md3},
                 {md1, md2, md3, md4}};
 
-        Collection permutations = getAllLists(md1, md3, md2, md4);
-        for (Iterator it = permutations.iterator(); it.hasNext();) {
-            List toSort = (List) it.next();
+        Collection<List<ModuleDescriptor>> permutations = getAllLists(md1, 
md3, md2, md4);
+        for (List<ModuleDescriptor> toSort : permutations) {
             assertSorted(possibleOrder, sortModuleDescriptors(toSort, 
nonMatchReporter));
         }
     }
@@ -124,9 +121,8 @@ public class SortTest {
                 // {md3, md1, md2, md4}
                 // we don't have this solution. The loops appear has one 
contiguous element.
         };
-        Collection permutations = getAllLists(md1, md3, md2, md4);
-        for (Iterator it = permutations.iterator(); it.hasNext();) {
-            List toSort = (List) it.next();
+        Collection<List<ModuleDescriptor>> permutations = getAllLists(md1, 
md3, md2, md4);
+        for (List<ModuleDescriptor> toSort : permutations) {
             assertSorted(possibleOrder, sortModuleDescriptors(toSort, 
nonMatchReporter));
         }
     }
@@ -140,7 +136,7 @@ public class SortTest {
         addDependency(md3, "md4", "rev4");
         addDependency(md4, "md1", "rev1");
         addDependency(md4, "md2", "rev2");
-        List toSort = Arrays.asList(new Object[] {md1, md2, md3, md4});
+        List<ModuleDescriptor> toSort = Arrays.asList(new ModuleDescriptor[] 
{md1, md2, md3, md4});
         sortModuleDescriptors(toSort, nonMatchReporter);
         // If it ends, it's ok.
     }
@@ -188,7 +184,7 @@ public class SortTest {
         CircularDependencyReporterMock circularDepReportMock = new 
CircularDependencyReporterMock();
         settings.setCircularDependencyStrategy(circularDepReportMock);
 
-        List toSort = Arrays.asList(new ModuleDescriptor[] {md4, md3, md2, 
md1});
+        List<ModuleDescriptor> toSort = Arrays.asList(new ModuleDescriptor[] 
{md4, md3, md2, md1});
         sortModuleDescriptors(toSort, nonMatchReporter);
 
         circularDepReportMock.validate();
@@ -210,9 +206,8 @@ public class SortTest {
         DefaultModuleDescriptor[][] expectedOrder = new 
DefaultModuleDescriptor[][] {
                 {md1, md2, md3, md4}};
 
-        Collection permutations = getAllLists(md1, md3, md2, md4);
-        for (Iterator it = permutations.iterator(); it.hasNext();) {
-            List toSort = (List) it.next();
+        Collection<List<ModuleDescriptor>> permutations = getAllLists(md1, 
md3, md2, md4);
+        for (List<ModuleDescriptor> toSort : permutations) {
             assertSorted(expectedOrder, sortModuleDescriptors(toSort, 
nonMatchReporter));
         }
 
@@ -237,9 +232,8 @@ public class SortTest {
         DefaultModuleDescriptor[][] possibleOrder = new 
DefaultModuleDescriptor[][] {
                 {md1, md2, md3, md4}};
 
-        Collection permutations = getAllLists(md1, md3, md2, md4);
-        for (Iterator it = permutations.iterator(); it.hasNext();) {
-            List toSort = (List) it.next();
+        Collection<List<ModuleDescriptor>> permutations = getAllLists(md1, 
md3, md2, md4);
+        for (List<ModuleDescriptor> toSort : permutations) {
             assertSorted(possibleOrder, sortModuleDescriptors(toSort, 
nonMatchReporter));
         }
 
@@ -273,12 +267,12 @@ public class SortTest {
             }
         }
         NonMatchingVersionReporterMock nonMatchingVersionReporterMock = new 
NonMatchingVersionReporterMock();
-        List toSort = Arrays.asList(new ModuleDescriptor[] {md4, md3, md2, 
md1});
+        List<ModuleDescriptor> toSort = Arrays.asList(new ModuleDescriptor[] 
{md4, md3, md2, md1});
         sortModuleDescriptors(toSort, nonMatchingVersionReporterMock);
         nonMatchingVersionReporterMock.validate();
     }
 
-    private List sortModuleDescriptors(List toSort,
+    private List<ModuleDescriptor> 
sortModuleDescriptors(List<ModuleDescriptor> toSort,
             NonMatchingVersionReporter nonMatchingVersionReporter) {
         return sortEngine.sortModuleDescriptors(toSort,
             new 
SortOptions().setNonMatchingVersionReporter(nonMatchingVersionReporter));
@@ -299,16 +293,16 @@ public class SortTest {
     }
 
     /**
-     * Verifies that sorted in one of the list of listOfPossibleSort.
+     * Verifies that sorted is one of the lists of listOfPossibleSort.
      *
      * @param listOfPossibleSort
      *            array of possible sort result
      * @param sorted
      *            actual sortedList to compare
      */
-    private void assertSorted(DefaultModuleDescriptor[][] listOfPossibleSort, 
List sorted) {
-        for (int i = 0; i < listOfPossibleSort.length; i++) {
-            DefaultModuleDescriptor[] expectedList = listOfPossibleSort[i];
+    private void assertSorted(DefaultModuleDescriptor[][] listOfPossibleSort,
+            List<ModuleDescriptor> sorted) {
+        for (DefaultModuleDescriptor[] expectedList : listOfPossibleSort) {
             assertEquals(expectedList.length, sorted.size());
             boolean isExpected = true;
             for (int j = 0; j < expectedList.length; j++) {
@@ -328,7 +322,7 @@ public class SortTest {
             if (i > 0) {
                 errorMessage.append(" , ");
             }
-            errorMessage.append(((DefaultModuleDescriptor) 
sorted.get(i)).getModuleRevisionId());
+            errorMessage.append(sorted.get(i).getModuleRevisionId());
         }
         errorMessage.append("}\nExpected : \n");
         for (int i = 0; i < listOfPossibleSort.length; i++) {
@@ -349,33 +343,34 @@ public class SortTest {
     }
 
     /** Returns a collection of lists that contains the elements a,b,c and d */
-    private Collection getAllLists(Object a, Object b, Object c, Object d) {
+    private Collection<List<ModuleDescriptor>> getAllLists(ModuleDescriptor a, 
ModuleDescriptor b,
+            ModuleDescriptor c, ModuleDescriptor d) {
         final int nbOfList = 24;
-        ArrayList r = new ArrayList(nbOfList);
-        r.add(Arrays.asList(new Object[] {a, b, c, d}));
-        r.add(Arrays.asList(new Object[] {a, b, d, c}));
-        r.add(Arrays.asList(new Object[] {a, c, b, d}));
-        r.add(Arrays.asList(new Object[] {a, c, d, b}));
-        r.add(Arrays.asList(new Object[] {a, d, b, c}));
-        r.add(Arrays.asList(new Object[] {a, d, c, b}));
-        r.add(Arrays.asList(new Object[] {b, a, c, d}));
-        r.add(Arrays.asList(new Object[] {b, a, d, c}));
-        r.add(Arrays.asList(new Object[] {b, c, a, d}));
-        r.add(Arrays.asList(new Object[] {b, c, d, a}));
-        r.add(Arrays.asList(new Object[] {b, d, a, c}));
-        r.add(Arrays.asList(new Object[] {b, d, c, a}));
-        r.add(Arrays.asList(new Object[] {c, b, a, d}));
-        r.add(Arrays.asList(new Object[] {c, b, d, a}));
-        r.add(Arrays.asList(new Object[] {c, a, b, d}));
-        r.add(Arrays.asList(new Object[] {c, a, d, b}));
-        r.add(Arrays.asList(new Object[] {c, d, b, a}));
-        r.add(Arrays.asList(new Object[] {c, d, a, b}));
-        r.add(Arrays.asList(new Object[] {d, b, c, a}));
-        r.add(Arrays.asList(new Object[] {d, b, a, c}));
-        r.add(Arrays.asList(new Object[] {d, c, b, a}));
-        r.add(Arrays.asList(new Object[] {d, c, a, b}));
-        r.add(Arrays.asList(new Object[] {d, a, b, c}));
-        r.add(Arrays.asList(new Object[] {d, a, c, b}));
+        Collection<List<ModuleDescriptor>> r = new 
ArrayList<List<ModuleDescriptor>>(nbOfList);
+        r.add(Arrays.asList(new ModuleDescriptor[] {a, b, c, d}));
+        r.add(Arrays.asList(new ModuleDescriptor[] {a, b, d, c}));
+        r.add(Arrays.asList(new ModuleDescriptor[] {a, c, b, d}));
+        r.add(Arrays.asList(new ModuleDescriptor[] {a, c, d, b}));
+        r.add(Arrays.asList(new ModuleDescriptor[] {a, d, b, c}));
+        r.add(Arrays.asList(new ModuleDescriptor[] {a, d, c, b}));
+        r.add(Arrays.asList(new ModuleDescriptor[] {b, a, c, d}));
+        r.add(Arrays.asList(new ModuleDescriptor[] {b, a, d, c}));
+        r.add(Arrays.asList(new ModuleDescriptor[] {b, c, a, d}));
+        r.add(Arrays.asList(new ModuleDescriptor[] {b, c, d, a}));
+        r.add(Arrays.asList(new ModuleDescriptor[] {b, d, a, c}));
+        r.add(Arrays.asList(new ModuleDescriptor[] {b, d, c, a}));
+        r.add(Arrays.asList(new ModuleDescriptor[] {c, b, a, d}));
+        r.add(Arrays.asList(new ModuleDescriptor[] {c, b, d, a}));
+        r.add(Arrays.asList(new ModuleDescriptor[] {c, a, b, d}));
+        r.add(Arrays.asList(new ModuleDescriptor[] {c, a, d, b}));
+        r.add(Arrays.asList(new ModuleDescriptor[] {c, d, b, a}));
+        r.add(Arrays.asList(new ModuleDescriptor[] {c, d, a, b}));
+        r.add(Arrays.asList(new ModuleDescriptor[] {d, b, c, a}));
+        r.add(Arrays.asList(new ModuleDescriptor[] {d, b, a, c}));
+        r.add(Arrays.asList(new ModuleDescriptor[] {d, c, b, a}));
+        r.add(Arrays.asList(new ModuleDescriptor[] {d, c, a, b}));
+        r.add(Arrays.asList(new ModuleDescriptor[] {d, a, b, c}));
+        r.add(Arrays.asList(new ModuleDescriptor[] {d, a, c, b}));
         return r;
     }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/plugins/conflict/LatestConflictManagerTest.java
----------------------------------------------------------------------
diff --git 
a/test/java/org/apache/ivy/plugins/conflict/LatestConflictManagerTest.java 
b/test/java/org/apache/ivy/plugins/conflict/LatestConflictManagerTest.java
index cdefcea..3a9e113 100644
--- a/test/java/org/apache/ivy/plugins/conflict/LatestConflictManagerTest.java
+++ b/test/java/org/apache/ivy/plugins/conflict/LatestConflictManagerTest.java
@@ -65,8 +65,7 @@ public class LatestConflictManagerTest {
         String[] confs = report.getConfigurations();
         while (dependencies.hasNext()) {
             IvyNode node = (IvyNode) dependencies.next();
-            for (int i = 0; i < confs.length; i++) {
-                String conf = confs[i];
+            for (String conf : confs) {
                 if (!node.isEvicted(conf)) {
                     boolean flag1 = 
report.getConfigurationReport(conf).getDependency(
                         node.getResolvedId()) != null;
@@ -85,9 +84,7 @@ public class LatestConflictManagerTest {
         ResolveReport report = ivy.resolve(
             LatestConflictManagerTest.class.getResource("ivy-383.xml"), 
getResolveOptions());
         ConfigurationResolveReport defaultReport = 
report.getConfigurationReport("default");
-        Iterator iter = defaultReport.getModuleRevisionIds().iterator();
-        while (iter.hasNext()) {
-            ModuleRevisionId mrid = (ModuleRevisionId) iter.next();
+        for (ModuleRevisionId mrid : defaultReport.getModuleRevisionIds()) {
             if (mrid.getName().equals("mod1.1")) {
                 assertEquals("1.0", mrid.getRevision());
             } else if (mrid.getName().equals("mod1.2")) {
@@ -114,9 +111,7 @@ public class LatestConflictManagerTest {
             
LatestConflictManagerTest.class.getResource("ivy-latest-time-1.xml"),
             getResolveOptions());
         ConfigurationResolveReport defaultReport = 
report.getConfigurationReport("default");
-        Iterator iter = defaultReport.getModuleRevisionIds().iterator();
-        while (iter.hasNext()) {
-            ModuleRevisionId mrid = (ModuleRevisionId) iter.next();
+        for (ModuleRevisionId mrid : defaultReport.getModuleRevisionIds()) {
             if (mrid.getName().equals("mod1.1")) {
                 assertEquals("1.0", mrid.getRevision());
             } else if (mrid.getName().equals("mod1.2")) {
@@ -142,9 +137,7 @@ public class LatestConflictManagerTest {
             
LatestConflictManagerTest.class.getResource("ivy-latest-time-2.xml"),
             getResolveOptions());
         ConfigurationResolveReport defaultReport = 
report.getConfigurationReport("default");
-        Iterator iter = defaultReport.getModuleRevisionIds().iterator();
-        while (iter.hasNext()) {
-            ModuleRevisionId mrid = (ModuleRevisionId) iter.next();
+        for (ModuleRevisionId mrid : defaultReport.getModuleRevisionIds()) {
             if (mrid.getName().equals("mod1.1")) {
                 assertEquals("1.0", mrid.getRevision());
             } else if (mrid.getName().equals("mod1.2")) {
@@ -180,10 +173,7 @@ public class LatestConflictManagerTest {
             
LatestConflictManagerTest.class.getResource("ivy-latest-time-transitivity.xml"),
             getResolveOptions());
         ConfigurationResolveReport defaultReport = 
report.getConfigurationReport("default");
-        Iterator iter = defaultReport.getModuleRevisionIds().iterator();
-        while (iter.hasNext()) {
-            ModuleRevisionId mrid = (ModuleRevisionId) iter.next();
-
+        for (ModuleRevisionId mrid : defaultReport.getModuleRevisionIds()) {
             if (mrid.getName().equals("A")) {
                 assertEquals("A revision should be 1.0.0", "1.0.0", 
mrid.getRevision());
             } else if (mrid.getName().equals("D")) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/plugins/matcher/AbstractPatternMatcherTest.java
----------------------------------------------------------------------
diff --git 
a/test/java/org/apache/ivy/plugins/matcher/AbstractPatternMatcherTest.java 
b/test/java/org/apache/ivy/plugins/matcher/AbstractPatternMatcherTest.java
index b7f532f..62df8ec 100644
--- a/test/java/org/apache/ivy/plugins/matcher/AbstractPatternMatcherTest.java
+++ b/test/java/org/apache/ivy/plugins/matcher/AbstractPatternMatcherTest.java
@@ -52,20 +52,20 @@ public abstract class AbstractPatternMatcherTest {
 
         // test some exact patterns for this matcher
         String[] expressions = getExactExpressions();
-        for (int i = 0; i < expressions.length; i++) {
-            matcher = patternMatcher.getMatcher(expressions[i]);
-            assertTrue("Expression '" + expressions[i] + "' should be exact", 
matcher.isExact());
+        for (String expression : expressions) {
+            matcher = patternMatcher.getMatcher(expression);
+            assertTrue("Expression '" + expression + "' should be exact", 
matcher.isExact());
             matcher.matches("The words aren't what they were.");
-            assertTrue("Expression '" + expressions[i] + "' should be exact", 
matcher.isExact());
+            assertTrue("Expression '" + expression + "' should be exact", 
matcher.isExact());
         }
 
         // test some inexact patterns for this matcher
         expressions = getInexactExpressions();
-        for (int i = 0; i < expressions.length; i++) {
-            matcher = patternMatcher.getMatcher(expressions[i]);
-            assertFalse("Expression '" + expressions[i] + "' should be 
inexact", matcher.isExact());
+        for (String expression : expressions) {
+            matcher = patternMatcher.getMatcher(expression);
+            assertFalse("Expression '" + expression + "' should be inexact", 
matcher.isExact());
             matcher.matches("The words aren't what they were.");
-            assertFalse("Expression '" + expressions[i] + "' should be 
inexact", matcher.isExact());
+            assertFalse("Expression '" + expression + "' should be inexact", 
matcher.isExact());
         }
 
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java
----------------------------------------------------------------------
diff --git 
a/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java 
b/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java
index 68be597..5e687b9 100644
--- a/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java
+++ b/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java
@@ -301,9 +301,8 @@ public class XmlModuleUpdaterTest {
         assertEquals("Number of published artifacts incorrect", 4, 
artifacts.length);
 
         // test that the correct configuration has been removed
-        for (int i = 0; i < artifacts.length; i++) {
-            Artifact current = artifacts[i];
-            List currentConfs = Arrays.asList(current.getConfigurations());
+        for (Artifact current : artifacts) {
+            List<String> currentConfs = 
Arrays.asList(current.getConfigurations());
             assertTrue("myconf2 hasn't been removed for artifact " + 
current.getName(),
                 !currentConfs.contains("myconf2"));
         }
@@ -327,13 +326,14 @@ public class XmlModuleUpdaterTest {
         assertEquals("Number of dependencies is incorrect", 8, deps.length);
 
         // check that none of the dependencies contains myconf2
-        for (int i = 0; i < deps.length; i++) {
-            String name = deps[i].getDependencyId().getName();
+        for (DependencyDescriptor dep : deps) {
+            String name = dep.getDependencyId().getName();
             assertFalse("Dependency " + name + " shouldn't have myconf2 as 
module configuration",
-                
Arrays.asList(deps[i].getModuleConfigurations()).contains("myconf2"));
-            assertEquals("Dependency " + name
-                    + " shouldn't have a dependency artifact for configuration 
myconf2", 0,
-                deps[i].getDependencyArtifacts("myconf2").length);
+                
Arrays.asList(dep.getModuleConfigurations()).contains("myconf2"));
+            assertEquals(
+                "Dependency " + name
+                        + " shouldn't have a dependency artifact for 
configuration myconf2",
+                0, dep.getDependencyArtifacts("myconf2").length);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/plugins/repository/vfs/VfsRepositoryTest.java
----------------------------------------------------------------------
diff --git 
a/test/java/org/apache/ivy/plugins/repository/vfs/VfsRepositoryTest.java 
b/test/java/org/apache/ivy/plugins/repository/vfs/VfsRepositoryTest.java
index 2624d49..fe2fae4 100644
--- a/test/java/org/apache/ivy/plugins/repository/vfs/VfsRepositoryTest.java
+++ b/test/java/org/apache/ivy/plugins/repository/vfs/VfsRepositoryTest.java
@@ -19,7 +19,6 @@ package org.apache.ivy.plugins.repository.vfs;
 
 import java.io.File;
 import java.io.IOException;
-import java.util.Iterator;
 
 import org.apache.ivy.util.FileUtil;
 
@@ -80,9 +79,7 @@ public class VfsRepositoryTest {
         String destResource = VfsTestHelper.SCRATCH_DIR + "/" + testResource;
         String destFile = FileUtil.concat(VfsTestHelper.TEST_REPO_DIR, 
destResource);
 
-        Iterator vfsURIs = helper.createVFSUriSet(destResource).iterator();
-        while (vfsURIs.hasNext()) {
-            VfsURI vfsURI = (VfsURI) vfsURIs.next();
+        for (VfsURI vfsURI : helper.createVFSUriSet(destResource)) {
             if (scratchDir.exists()) {
                 FileUtil.forceDelete(scratchDir);
             }
@@ -110,10 +107,7 @@ public class VfsRepositoryTest {
         String destResource = VfsTestHelper.SCRATCH_DIR + "/" + testResource;
         File destFile = new File(FileUtil.concat(VfsTestHelper.TEST_REPO_DIR, 
destResource));
 
-        Iterator vfsURIs = helper.createVFSUriSet(destResource).iterator();
-        while (vfsURIs.hasNext()) {
-            VfsURI vfsURI = (VfsURI) vfsURIs.next();
-
+        for (VfsURI vfsURI : helper.createVFSUriSet(destResource)) {
             // remove existing scratch dir and populate it with an empty file
             // that we can overwrite. We do this so that we can test file 
sizes.
             // seeded file has length 0, while put file will have a length > 0
@@ -150,9 +144,7 @@ public class VfsRepositoryTest {
         destFile.getParentFile().mkdirs();
         destFile.createNewFile();
 
-        Iterator vfsURIs = helper.createVFSUriSet(destResource).iterator();
-        while (vfsURIs.hasNext()) {
-            VfsURI vfsURI = (VfsURI) vfsURIs.next();
+        for (VfsURI vfsURI : helper.createVFSUriSet(destResource)) {
             repo.put(new File(srcFile), vfsURI.toString(), false);
         }
     }
@@ -167,9 +159,7 @@ public class VfsRepositoryTest {
         String testResource = VfsTestHelper.TEST_IVY_XML;
         String testFile = FileUtil.concat(scratchDir.getAbsolutePath(), 
testResource);
 
-        Iterator vfsURIs = helper.createVFSUriSet(testResource).iterator();
-        while (vfsURIs.hasNext()) {
-            VfsURI vfsURI = (VfsURI) vfsURIs.next();
+        for (VfsURI vfsURI : helper.createVFSUriSet(testResource)) {
             if (scratchDir.exists()) {
                 FileUtil.forceDelete(scratchDir);
             }
@@ -195,10 +185,7 @@ public class VfsRepositoryTest {
         String testResource = VfsTestHelper.TEST_IVY_XML;
         File testFile = new File(FileUtil.concat(scratchDir.getAbsolutePath(), 
testResource));
 
-        Iterator vfsURIs = helper.createVFSUriSet(testResource).iterator();
-        while (vfsURIs.hasNext()) {
-            VfsURI vfsURI = (VfsURI) vfsURIs.next();
-
+        for (VfsURI vfsURI : helper.createVFSUriSet(testResource)) {
             // setup - remove existing scratch area and populate with a file 
to override
             if (scratchDir.exists()) {
                 FileUtil.forceDelete(scratchDir);
@@ -227,10 +214,7 @@ public class VfsRepositoryTest {
     public void testGetResourceValidExist() throws Exception {
         String testResource = VfsTestHelper.TEST_IVY_XML;
 
-        Iterator vfsURIs = helper.createVFSUriSet(testResource).iterator();
-
-        while (vfsURIs.hasNext()) {
-            VfsURI vfsURI = (VfsURI) vfsURIs.next();
+        for (VfsURI vfsURI : helper.createVFSUriSet(testResource)) {
             try {
                 assertNotNull(repo.getResource(vfsURI.toString()));
             } catch (IOException e) {
@@ -248,10 +232,7 @@ public class VfsRepositoryTest {
     public void testGetResourceValidNoExist() throws Exception {
         String testResource = VfsTestHelper.SCRATCH_DIR + "/nosuchfile.jar";
 
-        Iterator vfsURIs = helper.createVFSUriSet(testResource).iterator();
-        while (vfsURIs.hasNext()) {
-            VfsURI vfsURI = (VfsURI) vfsURIs.next();
-
+        for (VfsURI vfsURI : helper.createVFSUriSet(testResource)) {
             // make sure the declared resource does not exist
             if (scratchDir.exists()) {
                 FileUtil.forceDelete(scratchDir);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/plugins/repository/vfs/VfsResourceTest.java
----------------------------------------------------------------------
diff --git 
a/test/java/org/apache/ivy/plugins/repository/vfs/VfsResourceTest.java 
b/test/java/org/apache/ivy/plugins/repository/vfs/VfsResourceTest.java
index 13a311b..4801175 100644
--- a/test/java/org/apache/ivy/plugins/repository/vfs/VfsResourceTest.java
+++ b/test/java/org/apache/ivy/plugins/repository/vfs/VfsResourceTest.java
@@ -27,7 +27,6 @@ import java.net.URI;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
 
 import org.junit.After;
@@ -52,9 +51,7 @@ public class VfsResourceTest {
      */
     @Test
     public void testCreateResourceThatExists() throws Exception {
-        Iterator vfsURIs = 
helper.createVFSUriSet(VfsTestHelper.TEST_IVY_XML).iterator();
-        while (vfsURIs.hasNext()) {
-            VfsURI vfsURI = (VfsURI) vfsURIs.next();
+        for (VfsURI vfsURI : 
helper.createVFSUriSet(VfsTestHelper.TEST_IVY_XML)) {
             String resId = vfsURI.toString();
             VfsResource res = new VfsResource(resId, helper.fsManager);
             assertNotNull("Unexpected null value on VFS URI: " + resId, res);
@@ -93,9 +90,7 @@ public class VfsResourceTest {
      */
     @Test
     public void testCreateResourceThatDoesntExist() throws Exception {
-        Iterator vfsURIs = helper.createVFSUriSet("zzyyxx.zzyyxx").iterator();
-        while (vfsURIs.hasNext()) {
-            VfsURI vfsURI = (VfsURI) vfsURIs.next();
+        for (VfsURI vfsURI : helper.createVFSUriSet("zzyyxx.zzyyxx")) {
             String resId = vfsURI.toString();
             VfsResource res = new VfsResource(resId, helper.fsManager);
             assertNotNull("Unexpected null value on VFS URI: " + resId, res);
@@ -141,24 +136,19 @@ public class VfsResourceTest {
     @Test
     public void testListFolderChildren() throws Exception {
         final String testFolder = "2/mod10.1";
-        final List expectedFiles = Arrays.asList(new String[] {"ivy-1.0.xml", 
"ivy-1.1.xml",
-                "ivy-1.2.xml", "ivy-1.3.xml"});
+        final List<String> expectedFiles = Arrays
+                .asList(new String[] {"ivy-1.0.xml", "ivy-1.1.xml", 
"ivy-1.2.xml", "ivy-1.3.xml"});
 
-        Iterator baseVfsURIs = helper.createVFSUriSet(testFolder).iterator();
-        while (baseVfsURIs.hasNext()) {
-            VfsURI baseVfsURI = (VfsURI) baseVfsURIs.next();
-
-            List expected = new ArrayList();
-            for (int i = 0; i < expectedFiles.size(); i++) {
-                String resId = baseVfsURI.toString() + "/" + 
expectedFiles.get(i);
+        for (VfsURI baseVfsURI : helper.createVFSUriSet(testFolder)) {
+            List<String> expected = new ArrayList<String>();
+            for (String expectedFile : expectedFiles) {
+                String resId = baseVfsURI.toString() + "/" + expectedFile;
                 expected.add(resId);
             }
 
-            List actual = new ArrayList();
+            List<String> actual = new ArrayList<String>();
             VfsResource res = new VfsResource(baseVfsURI.toString(), 
helper.fsManager);
-            Iterator children = res.getChildren().iterator();
-            while (children.hasNext()) {
-                String resId = (String) children.next();
+            for (String resId : res.getChildren()) {
                 // remove entries ending in .svn
                 if (!resId.endsWith(".svn")) {
                     actual.add(resId);
@@ -178,13 +168,11 @@ public class VfsResourceTest {
      */
     @Test
     public void testListFileChildren() throws Exception {
-        Iterator testSet = 
helper.createVFSUriSet(VfsTestHelper.TEST_IVY_XML).iterator();
-        while (testSet.hasNext()) {
-            VfsURI vfsURI = (VfsURI) testSet.next();
+        for (VfsURI vfsURI : 
helper.createVFSUriSet(VfsTestHelper.TEST_IVY_XML)) {
             VfsResource res = new VfsResource(vfsURI.toString(), 
helper.fsManager);
-            List results = res.getChildren();
-            assertEquals("getChildren query on file provided results when it 
shouldn't have",
-                    0, results.size());
+            List<String> results = res.getChildren();
+            assertEquals("getChildren query on file provided results when it 
shouldn't have", 0,
+                results.size());
         }
     }
 
@@ -194,13 +182,11 @@ public class VfsResourceTest {
      */
     @Test
     public void testListImaginary() throws Exception {
-        Iterator testSet = helper.createVFSUriSet("idontexistzzxx").iterator();
-        while (testSet.hasNext()) {
-            VfsURI vfsURI = (VfsURI) testSet.next();
+        for (VfsURI vfsURI : helper.createVFSUriSet("idontexistzzxx")) {
             VfsResource res = new VfsResource(vfsURI.toString(), 
helper.fsManager);
-            List results = res.getChildren();
-            assertEquals("getChildren query on file provided results when it 
shouldn't have",
-                    0, results.size());
+            List<String> results = res.getChildren();
+            assertEquals("getChildren query on file provided results when it 
shouldn't have", 0,
+                results.size());
         }
     }
 }

Reply via email to