You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ja...@apache.org on 2017/07/18 05:02:18 UTC

[1/7] ant-ivy git commit: Add generics and Java 7 syntax to core

Repository: ant-ivy
Updated Branches:
  refs/heads/master 844100aed -> 692071797


http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/core/module/descriptor/IvyMakePomTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/module/descriptor/IvyMakePomTest.java b/test/java/org/apache/ivy/core/module/descriptor/IvyMakePomTest.java
index b372479..04c06e4 100644
--- a/test/java/org/apache/ivy/core/module/descriptor/IvyMakePomTest.java
+++ b/test/java/org/apache/ivy/core/module/descriptor/IvyMakePomTest.java
@@ -17,6 +17,17 @@
 
 package org.apache.ivy.core.module.descriptor;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.xpath.XPathConstants;
+
 import org.apache.ivy.TestHelper;
 import org.apache.ivy.ant.IvyMakePom;
 import org.apache.ivy.util.TestXmlHelper;
@@ -28,16 +39,6 @@ import org.junit.rules.TemporaryFolder;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-import javax.xml.xpath.XPathConstants;
-import java.io.File;
-import java.util.HashSet;
-import java.util.Set;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
 /**
  * Tests {@link IvyMakePom}
  */
@@ -106,6 +107,7 @@ public class IvyMakePomTest {
         private final String version;
         private final String scope;
         private final String classifier;
+        @SuppressWarnings("unused")
         private final boolean optional;
 
         private PomDependency(final String groupId, final String artifactId, final String version,
@@ -123,7 +125,6 @@ public class IvyMakePomTest {
             this.optional = optional;
         }
 
-
         static PomDependency parse(final Node dependencyNode) {
             if (dependencyNode == null) {
                 return null;

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/core/module/id/ModuleRevisionIdTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/module/id/ModuleRevisionIdTest.java b/test/java/org/apache/ivy/core/module/id/ModuleRevisionIdTest.java
index ca257c5..7d0b8b3 100644
--- a/test/java/org/apache/ivy/core/module/id/ModuleRevisionIdTest.java
+++ b/test/java/org/apache/ivy/core/module/id/ModuleRevisionIdTest.java
@@ -78,18 +78,18 @@ public class ModuleRevisionIdTest {
         testEncodeDecodeToString(ModuleRevisionId.newInstance("org", "name", "revision"));
         testEncodeDecodeToString(ModuleRevisionId.newInstance("org", "name", ""));
         testEncodeDecodeToString(ModuleRevisionId.newInstance("org.apache", "name-post", "1.0"));
-        testEncodeDecodeToString(ModuleRevisionId.newInstance("org/apache", "pre/name",
-            "1.0-dev8/2"));
-        Map extraAttributes = new HashMap();
+        testEncodeDecodeToString(
+            ModuleRevisionId.newInstance("org/apache", "pre/name", "1.0-dev8/2"));
+        Map<String, String> extraAttributes = new HashMap<>();
         extraAttributes.put("extra", "extravalue");
         extraAttributes.put("att/name", "att/value");
         extraAttributes.put("att.name", "att.value");
         extraAttributes.put("att<name", "att<value");
-        testEncodeDecodeToString(ModuleRevisionId.newInstance("org/apache", "pre/name",
-            "1.0-dev8/2", extraAttributes));
+        testEncodeDecodeToString(
+            ModuleRevisionId.newInstance("org/apache", "pre/name", "1.0-dev8/2", extraAttributes));
         extraAttributes.put("nullatt", null);
-        testEncodeDecodeToString(ModuleRevisionId.newInstance("org/apache", "pre/name",
-            "1.0-dev8/2", extraAttributes));
+        testEncodeDecodeToString(
+            ModuleRevisionId.newInstance("org/apache", "pre/name", "1.0-dev8/2", extraAttributes));
 
     }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/core/module/id/ModuleRulesTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/module/id/ModuleRulesTest.java b/test/java/org/apache/ivy/core/module/id/ModuleRulesTest.java
index 0968438..68be4d3 100644
--- a/test/java/org/apache/ivy/core/module/id/ModuleRulesTest.java
+++ b/test/java/org/apache/ivy/core/module/id/ModuleRulesTest.java
@@ -32,14 +32,14 @@ import org.junit.Before;
 import org.junit.Test;
 
 public class ModuleRulesTest {
-    private ModuleRules rules;
+    private ModuleRules<String> rules;
 
-    private Object[] rule;
+    private String[] rule;
 
     @Before
     public void setUp() {
-        rules = new ModuleRules();
-        rule = new Object[10];
+        rules = new ModuleRules<String>();
+        rule = new String[10];
         for (int i = 0; i < rule.length; i++) {
             rule[i] = "RULE_" + i;
         }
@@ -76,9 +76,9 @@ public class ModuleRulesTest {
 
     // test helpers
 
-    private Filter acceptNone() {
-        return new Filter() {
-            public boolean accept(Object o) {
+    private Filter<String> acceptNone() {
+        return new Filter<String>() {
+            public boolean accept(String o) {
                 return false;
             }
 
@@ -88,11 +88,11 @@ public class ModuleRulesTest {
         };
     }
 
-    private Filter acceptSecond() {
-        return new Filter() {
+    private Filter<String> acceptSecond() {
+        return new Filter<String>() {
             private int cpt;
 
-            public boolean accept(Object o) {
+            public boolean accept(String o) {
                 return ++cpt == 2;
             }
 
@@ -102,22 +102,22 @@ public class ModuleRulesTest {
         };
     }
 
-    private Filter acceptAll() {
-        return NoFilter.INSTANCE;
+    private Filter<String> acceptAll() {
+        return NoFilter.instance();
     }
 
-    private void assertRule(Object rule, String mrid) {
-        Object ruleFound = rules.getRule(ModuleRevisionId.parse(mrid));
+    private void assertRule(String rule, String mrid) {
+        String ruleFound = rules.getRule(ModuleRevisionId.parse(mrid));
         assertEquals("unexcepted rule for " + mrid, rule, ruleFound);
     }
 
-    private void assertRule(Object rule, String mrid, Filter filter) {
-        Object ruleFound = rules.getRule(ModuleRevisionId.parse(mrid), filter);
+    private void assertRule(String rule, String mrid, Filter<String> filter) {
+        String ruleFound = rules.getRule(ModuleRevisionId.parse(mrid), filter);
         assertEquals("unexcepted rule for " + mrid + " filtered by " + filter, rule, ruleFound);
     }
 
-    private void assertModuleIdRule(Object rule, String mid, Filter filter) {
-        Object ruleFound = rules.getRule(ModuleId.parse(mid), filter);
+    private void assertModuleIdRule(String rule, String mid, Filter<String> filter) {
+        String ruleFound = rules.getRule(ModuleId.parse(mid), filter);
         assertEquals("unexcepted rule for " + mid + " filtered by " + filter, rule, ruleFound);
     }
 
@@ -126,7 +126,7 @@ public class ModuleRulesTest {
     }
 
     public class MridMatcherBuilder {
-        private Map attributes = new HashMap();
+        private Map<String, String> attributes = new HashMap<>();
 
         private PatternMatcher matcher = ExactPatternMatcher.INSTANCE;
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/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 71b5ed2..cdc5d91 100644
--- a/test/java/org/apache/ivy/core/publish/PublishEventsTest.java
+++ b/test/java/org/apache/ivy/core/publish/PublishEventsTest.java
@@ -17,6 +17,13 @@
  */
 package org.apache.ivy.core.publish;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.Arrays;
@@ -37,13 +44,10 @@ import org.apache.ivy.core.module.id.ArtifactRevisionId;
 import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
 import org.apache.ivy.plugins.resolver.MockResolver;
 import org.apache.ivy.plugins.trigger.AbstractTrigger;
-
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.*;
-
 public class PublishEventsTest {
 
     // maps ArtifactRevisionId to PublishTestCase instance.
@@ -270,6 +274,13 @@ public class PublishEventsTest {
 
     /**
      * Assert that two Artifact instances refer to the same artifact and contain the same metadata.
+     *
+     * @param message
+     *            String
+     * @param expected
+     *            Artifact
+     * @param actual
+     *            Artifact
      */
     public static void assertSameArtifact(String message, Artifact expected, Artifact actual) {
         assertEquals(message + ": name", expected.getName(), actual.getName());

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java b/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java
index 12b92be..f51c06e 100644
--- a/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java
+++ b/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java
@@ -17,6 +17,12 @@
  */
 package org.apache.ivy.core.retrieve;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.File;
 import java.io.IOException;
 import java.net.URL;
@@ -24,6 +30,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import org.apache.ivy.Ivy;
 import org.apache.ivy.TestHelper;
@@ -36,6 +43,7 @@ import org.apache.ivy.core.event.retrieve.StartRetrieveArtifactEvent;
 import org.apache.ivy.core.event.retrieve.StartRetrieveEvent;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.report.ArtifactDownloadReport;
 import org.apache.ivy.core.report.ResolveReport;
 import org.apache.ivy.core.resolve.ResolveOptions;
 import org.apache.ivy.util.DefaultMessageLogger;
@@ -47,8 +55,6 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.*;
-
 public class RetrieveTest {
 
     private Ivy ivy;
@@ -295,8 +301,9 @@ public class RetrieveTest {
         ModuleRevisionId mrid = md.getModuleRevisionId();
         RetrieveOptions options = getRetrieveOptions();
         options.setConfs(new String[] {"A"});
-        Map artifactsToCopy = ivy.getRetrieveEngine().determineArtifactsToCopy(mrid,
-            "build/test/retrieve/[module]/[conf]/[artifact]-[revision].[ext]", options);
+        Map<ArtifactDownloadReport, Set<String>> artifactsToCopy = ivy.getRetrieveEngine()
+                .determineArtifactsToCopy(mrid,
+                    "build/test/retrieve/[module]/[conf]/[artifact]-[revision].[ext]", options);
         assertEquals(2, artifactsToCopy.size());
 
         options.setConfs(new String[] {"B"});

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java b/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java
index e3db042..2cf7a4f 100644
--- a/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java
+++ b/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java
@@ -91,7 +91,7 @@ public class XmlSettingsParserTest {
         assertEquals("libraries", defaultResolver.getName());
         assertTrue(defaultResolver instanceof FileSystemResolver);
         FileSystemResolver fsres = (FileSystemResolver) defaultResolver;
-        List ivyPatterns = fsres.getIvyPatterns();
+        List<String> ivyPatterns = fsres.getIvyPatterns();
         assertNotNull(ivyPatterns);
         assertEquals(1, ivyPatterns.size());
         assertLocationEquals("lib/[organisation]/[module]/ivys/ivy-[revision].xml",
@@ -105,7 +105,7 @@ public class XmlSettingsParserTest {
         assertNotNull(internal);
         assertTrue(internal instanceof ChainResolver);
         ChainResolver chain = (ChainResolver) internal;
-        List subresolvers = chain.getResolvers();
+        List<DependencyResolver> subresolvers = chain.getResolvers();
         assertNotNull(subresolvers);
         assertEquals(2, subresolvers.size());
         FileSystemResolver fsInt1 = (FileSystemResolver) subresolvers.get(0);
@@ -113,7 +113,7 @@ public class XmlSettingsParserTest {
         assertEquals(1, fsInt1.getIvyPatterns().size());
         assertLocationEquals("sharedrep/[organisation]/[module]/ivys/ivy-[revision].xml", fsInt1
                 .getIvyPatterns().get(0));
-        assertEquals("int2", ((DependencyResolver) subresolvers.get(1)).getName());
+        assertEquals("int2", subresolvers.get(1).getName());
 
         strategy = fsInt1.getLatestStrategy();
         assertNotNull(strategy);
@@ -145,12 +145,12 @@ public class XmlSettingsParserTest {
         assertNotNull(internal);
         assertTrue(internal instanceof ChainResolver);
         ChainResolver chain = (ChainResolver) internal;
-        List subresolvers = chain.getResolvers();
+        List<DependencyResolver> subresolvers = chain.getResolvers();
         assertNotNull(subresolvers);
         assertEquals(2, subresolvers.size());
 
-        assertEquals("mock1", ((DependencyResolver) subresolvers.get(0)).getName());
-        assertEquals("mock2", ((DependencyResolver) subresolvers.get(1)).getName());
+        assertEquals("mock1", subresolvers.get(0).getName());
+        assertEquals("mock2", subresolvers.get(1).getName());
         assertTrue(subresolvers.get(0) instanceof MockResolver);
         assertTrue(subresolvers.get(1) instanceof MockResolver);
     }
@@ -318,13 +318,13 @@ public class XmlSettingsParserTest {
         assertNotNull(internal);
         assertTrue(internal instanceof ChainResolver);
         ChainResolver chain = (ChainResolver) internal;
-        List subresolvers = chain.getResolvers();
+        List<DependencyResolver> subresolvers = chain.getResolvers();
         assertNotNull(subresolvers);
         assertEquals(2, subresolvers.size());
         FileSystemResolver fsInt1 = (FileSystemResolver) subresolvers.get(0);
         assertEquals("fs", fsInt1.getName());
 
-        List ivyPatterns = fsInt1.getIvyPatterns();
+        List<String> ivyPatterns = fsInt1.getIvyPatterns();
         assertNotNull(ivyPatterns);
         assertEquals(1, ivyPatterns.size());
         assertLocationEquals("sharedrep/[organisation]/[module]/ivys/ivy-[revision].xml",
@@ -357,13 +357,13 @@ public class XmlSettingsParserTest {
         assertNotNull(def);
         assertTrue(def instanceof ChainResolver);
         ChainResolver chain = (ChainResolver) def;
-        List subresolvers = chain.getResolvers();
+        List<DependencyResolver> subresolvers = chain.getResolvers();
         assertNotNull(subresolvers);
         assertEquals(2, subresolvers.size());
         FileSystemResolver fsInt1 = (FileSystemResolver) subresolvers.get(0);
         assertEquals("default-fs1", fsInt1.getName());
 
-        List ivyPatterns = fsInt1.getIvyPatterns();
+        List<String> ivyPatterns = fsInt1.getIvyPatterns();
         assertNotNull(ivyPatterns);
         assertEquals(1, ivyPatterns.size());
         assertLocationEquals(
@@ -413,10 +413,10 @@ public class XmlSettingsParserTest {
         assertNotNull(mychain);
         assertTrue(mychain instanceof ChainResolver);
         ChainResolver chain = (ChainResolver) mychain;
-        List subresolvers = chain.getResolvers();
+        List<DependencyResolver> subresolvers = chain.getResolvers();
         assertNotNull(subresolvers);
         assertEquals(1, subresolvers.size());
-        shared = (DependencyResolver) subresolvers.get(0);
+        shared = subresolvers.get(0);
         assertEquals("shared", shared.getName());
         assertTrue(shared instanceof FileSystemResolver);
     }
@@ -437,7 +437,7 @@ public class XmlSettingsParserTest {
         assertTrue(testResolver instanceof IBiblioResolver);
 
         ChainResolver chain = (ChainResolver) macrores;
-        List subresolvers = chain.getResolvers();
+        List<DependencyResolver> subresolvers = chain.getResolvers();
         assertNotNull(subresolvers);
         assertEquals(1, subresolvers.size());
         assertEquals(testResolver, subresolvers.get(0));
@@ -466,13 +466,13 @@ public class XmlSettingsParserTest {
         assertNotNull(def);
         assertTrue(def instanceof ChainResolver);
         ChainResolver chain = (ChainResolver) def;
-        List subresolvers = chain.getResolvers();
+        List<DependencyResolver> subresolvers = chain.getResolvers();
         assertNotNull(subresolvers);
         assertEquals(2, subresolvers.size());
         FileSystemResolver fsInt1 = (FileSystemResolver) subresolvers.get(0);
         assertEquals("default-fs1", fsInt1.getName());
 
-        List ivyPatterns = fsInt1.getIvyPatterns();
+        List<String> ivyPatterns = fsInt1.getIvyPatterns();
         assertNotNull(ivyPatterns);
         assertEquals(1, ivyPatterns.size());
         assertLocationEquals(
@@ -523,7 +523,7 @@ public class XmlSettingsParserTest {
                 .getResource("ivysettings-include-missing-file.xml"));
     }
 
-   @Test
+    @Test
     public void testIncludeSpecialCharInName() throws Exception {
         IvySettings settings = new IvySettings();
         XmlSettingsParser parser = new XmlSettingsParser(settings);
@@ -533,13 +533,13 @@ public class XmlSettingsParserTest {
         assertNotNull(def);
         assertTrue(def instanceof ChainResolver);
         ChainResolver chain = (ChainResolver) def;
-        List subresolvers = chain.getResolvers();
+        List<DependencyResolver> subresolvers = chain.getResolvers();
         assertNotNull(subresolvers);
         assertEquals(2, subresolvers.size());
         FileSystemResolver fsInt1 = (FileSystemResolver) subresolvers.get(0);
         assertEquals("default-fs1", fsInt1.getName());
 
-        List ivyPatterns = fsInt1.getIvyPatterns();
+        List<String> ivyPatterns = fsInt1.getIvyPatterns();
         assertNotNull(ivyPatterns);
         assertEquals(1, ivyPatterns.size());
         assertLocationEquals(

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/osgi/core/OsgiLatestStrategyTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/osgi/core/OsgiLatestStrategyTest.java b/test/java/org/apache/ivy/osgi/core/OsgiLatestStrategyTest.java
index c0f0a8e..e385f5d 100644
--- a/test/java/org/apache/ivy/osgi/core/OsgiLatestStrategyTest.java
+++ b/test/java/org/apache/ivy/osgi/core/OsgiLatestStrategyTest.java
@@ -17,6 +17,9 @@
  */
 package org.apache.ivy.osgi.core;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -26,9 +29,6 @@ import java.util.List;
 import org.apache.ivy.plugins.latest.ArtifactInfo;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
 public class OsgiLatestStrategyTest {
 
     @Test
@@ -53,7 +53,7 @@ public class OsgiLatestStrategyTest {
         ArtifactInfo[] shuffledRevs = shuffled.toArray(new ArtifactInfo[revs.length]);
 
         OsgiLatestStrategy latestRevisionStrategy = new OsgiLatestStrategy();
-        List sorted = latestRevisionStrategy.sort(shuffledRevs);
+        List<ArtifactInfo> sorted = latestRevisionStrategy.sort(shuffledRevs);
         assertEquals(Arrays.asList(revs), sorted);
     }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoaderTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoaderTest.java b/test/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoaderTest.java
index 6f2403e..c41c80a 100644
--- a/test/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoaderTest.java
+++ b/test/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoaderTest.java
@@ -34,12 +34,10 @@ import org.apache.ivy.osgi.repo.ModuleDescriptorWrapper;
 import org.apache.ivy.osgi.repo.RepoDescriptor;
 import org.apache.ivy.util.CacheCleaner;
 import org.apache.ivy.util.CollectionUtils;
-
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
-
 import org.xml.sax.SAXException;
 
 public class UpdateSiteLoaderTest {
@@ -68,9 +66,9 @@ public class UpdateSiteLoaderTest {
         RepoDescriptor site = loader.load(new URI(
                 "http://www.apache.org/dist/ant/ivyde/updatesite/"));
         assertTrue(site.getModules().hasNext());
-        for (Iterator it = site.getModules(); it.hasNext();) {
-            ModuleDescriptor md = ((ModuleDescriptorWrapper) it.next()).getModuleDescriptor();
-            String name = md.getModuleRevisionId().getName();
+        Iterator<ModuleDescriptorWrapper> it = site.getModules();
+        while (it.hasNext()) {
+            String name = it.next().getModuleDescriptor().getModuleRevisionId().getName();
             assertTrue(name, name.startsWith("org.apache.ivy"));
         }
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/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 3a9e113..9324461 100644
--- a/test/java/org/apache/ivy/plugins/conflict/LatestConflictManagerTest.java
+++ b/test/java/org/apache/ivy/plugins/conflict/LatestConflictManagerTest.java
@@ -17,6 +17,9 @@
  */
 package org.apache.ivy.plugins.conflict;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
 import java.io.File;
 import java.util.Iterator;
 import java.util.List;
@@ -32,9 +35,6 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
 public class LatestConflictManagerTest {
 
     private Ivy ivy;
@@ -60,11 +60,11 @@ public class LatestConflictManagerTest {
         ResolveReport report = ivy.resolve(
             LatestConflictManagerTest.class.getResource("ivy-388.xml"), getResolveOptions());
 
-        List deps = report.getDependencies();
-        Iterator dependencies = deps.iterator();
+        List<IvyNode> deps = report.getDependencies();
+        Iterator<IvyNode> dependencies = deps.iterator();
         String[] confs = report.getConfigurations();
         while (dependencies.hasNext()) {
-            IvyNode node = (IvyNode) dependencies.next();
+            IvyNode node = dependencies.next();
             for (String conf : confs) {
                 if (!node.isEvicted(conf)) {
                     boolean flag1 = report.getConfigurationReport(conf).getDependency(

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java b/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
index 44c77e8..3ed867b 100644
--- a/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
+++ b/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
@@ -318,7 +318,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
         assertEquals(1, dds.length);
         assertEquals(ModuleRevisionId.newInstance("commons-logging", "commons-logging", "1.0.4"),
             dds[0].getDependencyRevisionId());
-        Map extraAtt = Collections.singletonMap("classifier", "asl");
+        Map<String, String> extraAtt = Collections.singletonMap("classifier", "asl");
         assertEquals(1, dds[0].getAllDependencyArtifacts().length);
         assertEquals(extraAtt, dds[0].getAllDependencyArtifacts()[0].getExtraAttributes());
 
@@ -508,8 +508,8 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
         assertEquals(3, dds.length);
         assertEquals(ModuleRevisionId.newInstance("commons-logging", "commons-logging", "1.0.4"),
             dds[0].getDependencyRevisionId());
-        assertEquals(new HashSet(Arrays.asList(new String[] {"optional"})),
-            new HashSet(Arrays.asList(dds[0].getModuleConfigurations())));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"optional"})),
+            new HashSet<>(Arrays.asList(dds[0].getModuleConfigurations())));
         // I don't know what it should be. Ivy has no notion of optional dependencies
         // assertEquals(new HashSet(Arrays.asList(new String[] {"compile(*)", "runtime(*)",
         // "master(*)"})), new HashSet(Arrays.asList(dds[0]
@@ -517,21 +517,21 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
 
         assertEquals(ModuleRevisionId.newInstance("cglib", "cglib", "2.0.2"),
             dds[1].getDependencyRevisionId());
-        assertEquals(new HashSet(Arrays.asList(new String[] {"compile", "runtime"})), new HashSet(
-                Arrays.asList(dds[1].getModuleConfigurations())));
-        assertEquals(new HashSet(Arrays.asList(new String[] {"master(*)", "compile(*)"})),
-            new HashSet(Arrays.asList(dds[1].getDependencyConfigurations("compile"))));
-        assertEquals(new HashSet(Arrays.asList(new String[] {"runtime(*)"})),
-            new HashSet(Arrays.asList(dds[1].getDependencyConfigurations("runtime"))));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"compile", "runtime"})),
+            new HashSet<>(Arrays.asList(dds[1].getModuleConfigurations())));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"master(*)", "compile(*)"})),
+            new HashSet<>(Arrays.asList(dds[1].getDependencyConfigurations("compile"))));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"runtime(*)"})),
+            new HashSet<>(Arrays.asList(dds[1].getDependencyConfigurations("runtime"))));
 
         assertEquals(ModuleRevisionId.newInstance("cglib", "cglib-extra", "2.0.2"),
             dds[2].getDependencyRevisionId());
-        assertEquals(new HashSet(Arrays.asList(new String[] {"compile", "runtime"})), new HashSet(
-                Arrays.asList(dds[2].getModuleConfigurations())));
-        assertEquals(new HashSet(Arrays.asList(new String[] {"master(*)", "compile(*)"})),
-            new HashSet(Arrays.asList(dds[2].getDependencyConfigurations("compile"))));
-        assertEquals(new HashSet(Arrays.asList(new String[] {"runtime(*)"})),
-            new HashSet(Arrays.asList(dds[2].getDependencyConfigurations("runtime"))));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"compile", "runtime"})),
+            new HashSet<>(Arrays.asList(dds[2].getModuleConfigurations())));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"master(*)", "compile(*)"})),
+            new HashSet<>(Arrays.asList(dds[2].getDependencyConfigurations("compile"))));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"runtime(*)"})),
+            new HashSet<>(Arrays.asList(dds[2].getDependencyConfigurations("runtime"))));
     }
 
     @Test
@@ -548,29 +548,29 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
         assertEquals(3, dds.length);
         assertEquals(ModuleRevisionId.newInstance("odmg", "odmg", "3.0"),
             dds[0].getDependencyRevisionId());
-        assertEquals(new HashSet(Arrays.asList(new String[] {"runtime"})),
-            new HashSet(Arrays.asList(dds[0].getModuleConfigurations())));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"runtime"})),
+            new HashSet<>(Arrays.asList(dds[0].getModuleConfigurations())));
         assertEquals(
-            new HashSet(Arrays.asList(new String[] {"compile(*)", "runtime(*)", "master(*)"})),
-            new HashSet(Arrays.asList(dds[0].getDependencyConfigurations("runtime"))));
+            new HashSet<>(Arrays.asList(new String[] {"compile(*)", "runtime(*)", "master(*)"})),
+            new HashSet<>(Arrays.asList(dds[0].getDependencyConfigurations("runtime"))));
 
         assertEquals(ModuleRevisionId.newInstance("commons-logging", "commons-logging", "1.0.4"),
             dds[1].getDependencyRevisionId());
-        assertEquals(new HashSet(Arrays.asList(new String[] {"compile", "runtime"})), new HashSet(
-                Arrays.asList(dds[1].getModuleConfigurations())));
-        assertEquals(new HashSet(Arrays.asList(new String[] {"master(*)", "compile(*)"})),
-            new HashSet(Arrays.asList(dds[1].getDependencyConfigurations("compile"))));
-        assertEquals(new HashSet(Arrays.asList(new String[] {"runtime(*)"})),
-            new HashSet(Arrays.asList(dds[1].getDependencyConfigurations("runtime"))));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"compile", "runtime"})),
+            new HashSet<>(Arrays.asList(dds[1].getModuleConfigurations())));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"master(*)", "compile(*)"})),
+            new HashSet<>(Arrays.asList(dds[1].getDependencyConfigurations("compile"))));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"runtime(*)"})),
+            new HashSet<>(Arrays.asList(dds[1].getDependencyConfigurations("runtime"))));
 
         assertEquals(ModuleRevisionId.newInstance("cglib", "cglib", "2.0.2"),
             dds[2].getDependencyRevisionId());
-        assertEquals(new HashSet(Arrays.asList(new String[] {"compile", "runtime"})), new HashSet(
-                Arrays.asList(dds[2].getModuleConfigurations())));
-        assertEquals(new HashSet(Arrays.asList(new String[] {"master(*)", "compile(*)"})),
-            new HashSet(Arrays.asList(dds[2].getDependencyConfigurations("compile"))));
-        assertEquals(new HashSet(Arrays.asList(new String[] {"runtime(*)"})),
-            new HashSet(Arrays.asList(dds[2].getDependencyConfigurations("runtime"))));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"compile", "runtime"})),
+            new HashSet<>(Arrays.asList(dds[2].getModuleConfigurations())));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"master(*)", "compile(*)"})),
+            new HashSet<>(Arrays.asList(dds[2].getDependencyConfigurations("compile"))));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"runtime(*)"})),
+            new HashSet<>(Arrays.asList(dds[2].getDependencyConfigurations("runtime"))));
     }
 
     @Test
@@ -587,47 +587,51 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
         assertEquals(4, dds.length);
         assertEquals(ModuleRevisionId.newInstance("commons-logging", "commons-logging", "1.0.4"),
             dds[0].getDependencyRevisionId());
-        assertEquals(new HashSet(Arrays.asList(new String[] {"compile", "runtime"})), new HashSet(
-                Arrays.asList(dds[0].getModuleConfigurations())));
-        assertEquals(new HashSet(Arrays.asList(new String[] {"master(*)", "compile(*)"})),
-            new HashSet(Arrays.asList(dds[0].getDependencyConfigurations("compile"))));
-        assertEquals(new HashSet(Arrays.asList(new String[] {"runtime(*)"})),
-            new HashSet(Arrays.asList(dds[0].getDependencyConfigurations("runtime"))));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"compile", "runtime"})),
+            new HashSet<>(Arrays.asList(dds[0].getModuleConfigurations())));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"master(*)", "compile(*)"})),
+            new HashSet<>(Arrays.asList(dds[0].getDependencyConfigurations("compile"))));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"runtime(*)"})),
+            new HashSet<>(Arrays.asList(dds[0].getDependencyConfigurations("runtime"))));
         assertEquals(0, dds[0].getAllExcludeRules().length);
 
         assertEquals(ModuleRevisionId.newInstance("dom4j", "dom4j", "1.6"),
             dds[1].getDependencyRevisionId());
-        assertEquals(new HashSet(Arrays.asList(new String[] {"compile", "runtime"})), new HashSet(
-                Arrays.asList(dds[1].getModuleConfigurations())));
-        assertEquals(new HashSet(Arrays.asList(new String[] {"master(*)", "compile(*)"})),
-            new HashSet(Arrays.asList(dds[1].getDependencyConfigurations("compile"))));
-        assertEquals(new HashSet(Arrays.asList(new String[] {"runtime(*)"})),
-            new HashSet(Arrays.asList(dds[1].getDependencyConfigurations("runtime"))));
-        assertDependencyModulesExcludes(dds[1], new String[] {"compile"}, new String[] {
-                "jaxme-api", "jaxen"});
-        assertDependencyModulesExcludes(dds[1], new String[] {"runtime"}, new String[] {
-                "jaxme-api", "jaxen"});
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"compile", "runtime"})),
+            new HashSet<>(Arrays.asList(dds[1].getModuleConfigurations())));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"master(*)", "compile(*)"})),
+            new HashSet<>(Arrays.asList(dds[1].getDependencyConfigurations("compile"))));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"runtime(*)"})),
+            new HashSet<>(Arrays.asList(dds[1].getDependencyConfigurations("runtime"))));
+        assertDependencyModulesExcludes(dds[1], new String[] {"compile"},
+            new String[] {"jaxme-api", "jaxen"});
+        assertDependencyModulesExcludes(dds[1], new String[] {"runtime"},
+            new String[] {"jaxme-api", "jaxen"});
 
         assertEquals(ModuleRevisionId.newInstance("cglib", "cglib", "2.0.2"),
             dds[2].getDependencyRevisionId());
-        assertEquals(new HashSet(Arrays.asList(new String[] {"compile", "runtime"})), new HashSet(
-                Arrays.asList(dds[2].getModuleConfigurations())));
-        assertEquals(new HashSet(Arrays.asList(new String[] {"master(*)", "compile(*)"})),
-            new HashSet(Arrays.asList(dds[2].getDependencyConfigurations("compile"))));
-        assertEquals(new HashSet(Arrays.asList(new String[] {"runtime(*)"})),
-            new HashSet(Arrays.asList(dds[2].getDependencyConfigurations("runtime"))));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"compile", "runtime"})),
+            new HashSet<>(Arrays.asList(dds[2].getModuleConfigurations())));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"master(*)", "compile(*)"})),
+            new HashSet<>(Arrays.asList(dds[2].getDependencyConfigurations("compile"))));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"runtime(*)"})),
+            new HashSet<>(Arrays.asList(dds[2].getDependencyConfigurations("runtime"))));
         assertEquals(0, dds[2].getAllExcludeRules().length);
 
         // test for IVY-1531 (where the pom.xml can have a exclusion for groupid=* and artifactid=*, implying transitive=false, in ivy land)
         final DependencyDescriptor excludeAllTransitiveDepsDescriptor = dds[3];
-        assertEquals(ModuleRevisionId.newInstance("org.owasp.esapi", "esapi", "2.1.0"), excludeAllTransitiveDepsDescriptor.getDependencyRevisionId());
-        assertEquals(new HashSet(Arrays.asList(new String[] {"compile", "runtime"})), new HashSet(Arrays.asList(excludeAllTransitiveDepsDescriptor.getModuleConfigurations())));
-        assertEquals(new HashSet(Arrays.asList(new String[] {"master(*)", "compile(*)"})),
-                new HashSet(Arrays.asList(excludeAllTransitiveDepsDescriptor.getDependencyConfigurations("compile"))));
-        assertEquals(new HashSet(Arrays.asList(new String[] {"runtime(*)"})),
-                new HashSet(Arrays.asList(excludeAllTransitiveDepsDescriptor.getDependencyConfigurations("runtime"))));
-        assertEquals("No exclusion elements were expected to be present for " + excludeAllTransitiveDepsDescriptor, 0, excludeAllTransitiveDepsDescriptor.getAllExcludeRules().length);
-        assertFalse("Dependency  " + excludeAllTransitiveDepsDescriptor + " was expected to have transitive=false", excludeAllTransitiveDepsDescriptor.isTransitive());
+        assertEquals(ModuleRevisionId.newInstance("org.owasp.esapi", "esapi", "2.1.0"),
+            excludeAllTransitiveDepsDescriptor.getDependencyRevisionId());
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"compile", "runtime"})),
+            new HashSet<>(Arrays.asList(excludeAllTransitiveDepsDescriptor.getModuleConfigurations())));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"master(*)", "compile(*)"})),
+            new HashSet<>(Arrays.asList(excludeAllTransitiveDepsDescriptor.getDependencyConfigurations("compile"))));
+        assertEquals(new HashSet<>(Arrays.asList(new String[] {"runtime(*)"})),
+            new HashSet<>(Arrays.asList(excludeAllTransitiveDepsDescriptor.getDependencyConfigurations("runtime"))));
+        assertEquals("No exclusion elements were expected to be present for " + excludeAllTransitiveDepsDescriptor,
+            0, excludeAllTransitiveDepsDescriptor.getAllExcludeRules().length);
+        assertFalse("Dependency  " + excludeAllTransitiveDepsDescriptor + " was expected to have transitive=false",
+            excludeAllTransitiveDepsDescriptor.isTransitive());
     }
 
     @Test
@@ -864,8 +868,8 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
         // 2 are inherited from parent. Only the first one is important for this test
 
         assertEquals(ModuleRevisionId.newInstance("org.apache", "test-version-other", "5.76"),
-            dds[0].getDependencyRevisionId());// present in the pom using a property defined in the
-                                              // parent
+            dds[0].getDependencyRevisionId());
+        // present in the pom using a property defined in the parent
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java b/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java
index 8a55149..2291722 100644
--- a/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java
+++ b/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java
@@ -210,7 +210,6 @@ public class XmlModuleDescriptorParserTest extends AbstractModuleDescriptorParse
                 getClass().getResource("test-bad-version.xml"), true);
     }
 
-    @SuppressWarnings("deprecation")
     @Test
     public void testFull() throws Exception {
         ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings,
@@ -234,8 +233,11 @@ public class XmlModuleDescriptorParserTest extends AbstractModuleDescriptorParse
                 + "and myconf4 is not too bad too.", md.getDescription().replaceAll("\r\n", "\n")
                 .replace('\r', '\n'));
 
-        assertEquals(1, md.getExtraInfo().size());
-        assertEquals("56576", md.getExtraInfo().get("e:someExtra"));
+        assertEquals(1, md.getExtraInfos().size());
+        ExtraInfoHolder someExtraElement = md.getExtraInfos().get(0);
+        assertEquals("e:someExtra", someExtraElement.getName());
+        assertEquals("56576", someExtraElement.getContent());
+        assertEquals(0, someExtraElement.getAttributes().size());
 
         Configuration[] confs = md.getConfigurations();
         assertNotNull(confs);
@@ -505,24 +507,24 @@ public class XmlModuleDescriptorParserTest extends AbstractModuleDescriptorParse
             Arrays.asList(rules[1].getConfigurations()));
     }
 
-    @SuppressWarnings("deprecation")
     @Test
     public void testFullNoValidation() throws Exception {
         ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings,
             getClass().getResource("test.xml"), false);
         assertNotNull(md);
-        assertEquals(1, md.getExtraInfo().size());
-        assertEquals("56576", md.getExtraInfo().get("e:someExtra"));
+        assertEquals(1, md.getExtraInfos().size());
+        ExtraInfoHolder someExtraElement = md.getExtraInfos().get(0);
+        assertEquals("e:someExtra", someExtraElement.getName());
+        assertEquals("56576", someExtraElement.getContent());
+        assertEquals(0, someExtraElement.getAttributes().size());
+        assertEquals(0, someExtraElement.getNestedExtraInfoHolder().size());
     }
 
-    @SuppressWarnings("deprecation")
     @Test
     public void testExtraInfos() throws Exception {
         ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings,
             getClass().getResource("test-extrainfo.xml"), true);
         assertNotNull(md);
-        assertEquals(2, md.getExtraInfo().size());
-        assertEquals("56576", md.getExtraInfo().get("e:someExtra"));
         assertEquals(2, md.getExtraInfos().size());
         ExtraInfoHolder firstExtraInfoElement = md.getExtraInfos().get(0);
         assertEquals("e:someExtra", firstExtraInfoElement.getName());
@@ -538,14 +540,11 @@ public class XmlModuleDescriptorParserTest extends AbstractModuleDescriptorParse
         assertEquals(0, secondExtraInfoElement.getNestedExtraInfoHolder().size());
     }
 
-    @SuppressWarnings("deprecation")
     @Test
     public void testExtraInfosNested() throws Exception {
         ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings,
             getClass().getResource("test-extrainfo-nested.xml"), true);
         assertNotNull(md);
-        assertEquals(4, md.getExtraInfo().size());
-        assertEquals("56576", md.getExtraInfo().get("e:someExtra"));
         assertEquals(2, md.getExtraInfos().size());
         ExtraInfoHolder someExtraElement = md.getExtraInfos().get(0);
         assertEquals("e:someExtra", someExtraElement.getName());

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/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 5e687b9..ad3de6a 100644
--- a/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java
+++ b/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java
@@ -67,14 +67,14 @@ public class XmlModuleUpdaterTest {
         XmlModuleDescriptorUpdater.LINE_SEPARATOR = "\n";
         File dest = new File("build/updated-test.xml");
         dest.deleteOnExit();
-        Map resolvedRevisions = new HashMap();
+        Map<ModuleRevisionId, String> resolvedRevisions = new HashMap<>();
         resolvedRevisions.put(
             ModuleRevisionId.newInstance("yourorg", "yourmodule2", "branch1", "2+"), "2.5");
         resolvedRevisions.put(
             ModuleRevisionId.newInstance("yourorg", "yourmodule6", "trunk", "latest.integration"),
             "6.3");
 
-        Map resolvedBranches = new HashMap();
+        Map<ModuleRevisionId, String> resolvedBranches = new HashMap<>();
         resolvedBranches.put(ModuleRevisionId.newInstance("yourorg", "yourmodule3", "3.1"),
             "branch1");
         resolvedBranches.put(
@@ -126,14 +126,14 @@ public class XmlModuleUpdaterTest {
         XmlModuleDescriptorUpdater.LINE_SEPARATOR = "\n";
         File dest = new File("build/updated-test2.xml");
         dest.deleteOnExit();
-        Map resolvedRevisions = new HashMap();
+        Map<ModuleRevisionId, String> resolvedRevisions = new HashMap<>();
         resolvedRevisions.put(
             ModuleRevisionId.newInstance("yourorg", "yourmodule2", "branch1", "2+"), "2.5");
         resolvedRevisions.put(
             ModuleRevisionId.newInstance("yourorg", "yourmodule6", "trunk", "latest.integration"),
             "6.3");
 
-        Map resolvedBranches = new HashMap();
+        Map<ModuleRevisionId, String> resolvedBranches = new HashMap<>();
         resolvedBranches.put(ModuleRevisionId.newInstance("yourorg", "yourmodule3", "3.1"),
             "branch1");
         resolvedBranches.put(
@@ -366,11 +366,13 @@ public class XmlModuleUpdaterTest {
     }
 
     private UpdateOptions getUpdateOptions(String status, String revision) {
-        return getUpdateOptions(new IvySettings(), new HashMap(), status, revision, new Date());
+        return getUpdateOptions(new IvySettings(), new HashMap<ModuleRevisionId, String>(), status,
+            revision, new Date());
     }
 
-    private UpdateOptions getUpdateOptions(IvySettings settings, Map resolvedRevisions,
-            String status, String revision, Date pubdate) {
+    private UpdateOptions getUpdateOptions(IvySettings settings,
+            Map<ModuleRevisionId, String> resolvedRevisions, String status, String revision,
+            Date pubdate) {
         return new UpdateOptions().setSettings(settings).setResolvedRevisions(resolvedRevisions)
                 .setStatus(status).setRevision(revision).setPubdate(pubdate);
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/plugins/resolver/ChainResolverTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/resolver/ChainResolverTest.java b/test/java/org/apache/ivy/plugins/resolver/ChainResolverTest.java
index 27e9415..c04894c 100644
--- a/test/java/org/apache/ivy/plugins/resolver/ChainResolverTest.java
+++ b/test/java/org/apache/ivy/plugins/resolver/ChainResolverTest.java
@@ -17,6 +17,10 @@
  */
 package org.apache.ivy.plugins.resolver;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Date;
@@ -48,10 +52,6 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
 /**
  * Tests ChainResolver
  */
@@ -89,10 +89,10 @@ public class ChainResolverTest extends AbstractDependencyResolverTest {
     }
 
     private void assertResolversSizeAndNames(ChainResolver chain, int size) {
-        List resolvers = chain.getResolvers();
+        List<DependencyResolver> resolvers = chain.getResolvers();
         assertEquals(size, resolvers.size());
         for (int i = 0; i < resolvers.size(); i++) {
-            DependencyResolver r = (DependencyResolver) resolvers.get(i);
+            DependencyResolver r = resolvers.get(i);
             assertEquals(String.valueOf(i + 1), r.getName());
         }
     }
@@ -214,13 +214,13 @@ public class ChainResolverTest extends AbstractDependencyResolverTest {
                 MockResolver.buildMockResolver(settings, "2", true,
                     ModuleRevisionId.newInstance("org", "mod", "4"),
                     new GregorianCalendar(2005, 1, 22).getTime(), true),
-                    // latest -> but default
+                // latest -> but default
                 MockResolver.buildMockResolver(settings, "3", false, null),
                 MockResolver.buildMockResolver(settings, "4", false, null),
                 MockResolver.buildMockResolver(settings, "5", true,
                     ModuleRevisionId.newInstance("org", "mod", "4"),
                     new GregorianCalendar(2005, 1, 22).getTime()),
-                    // latest -> should be the one kept
+                // latest -> should be the one kept
                 MockResolver.buildMockResolver(settings, "6", false, null),
                 MockResolver.buildMockResolver(settings, "7", false, null)};
         for (MockResolver resolver : resolvers) {
@@ -298,12 +298,12 @@ public class ChainResolverTest extends AbstractDependencyResolverTest {
                 MockResolver.buildMockResolver(settings, "2", true,
                     ModuleRevisionId.newInstance("org", "mod", "4"),
                     new GregorianCalendar(2005, 1, 22).getTime(), true),
-                    // default
+                // default
                 MockResolver.buildMockResolver(settings, "3", false, null),
                 MockResolver.buildMockResolver(settings, "4", true,
                     ModuleRevisionId.newInstance("org", "mod", "4"),
                     new GregorianCalendar(2005, 1, 22).getTime()),
-                    // not default -> should be the one kept
+                // not default -> should be the one kept
                 MockResolver.buildMockResolver(settings, "5", false, null)};
         for (MockResolver resolver : resolvers) {
             chain.add(resolver);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/plugins/resolver/IBiblioResolverTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/resolver/IBiblioResolverTest.java b/test/java/org/apache/ivy/plugins/resolver/IBiblioResolverTest.java
index 743ff02..edf77a6 100644
--- a/test/java/org/apache/ivy/plugins/resolver/IBiblioResolverTest.java
+++ b/test/java/org/apache/ivy/plugins/resolver/IBiblioResolverTest.java
@@ -17,6 +17,12 @@
  */
 package org.apache.ivy.plugins.resolver;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -51,8 +57,6 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.*;
-
 /**
  *
  */
@@ -87,7 +91,7 @@ public class IBiblioResolverTest extends AbstractDependencyResolverTest {
         _settings.setVariable("ivy.ibiblio.default.artifact.pattern",
             "[module]/jars/[artifact]-[revision].jar");
         resolver.setSettings(_settings);
-        List l = resolver.getArtifactPatterns();
+        List<String> l = resolver.getArtifactPatterns();
         assertNotNull(l);
         assertEquals(1, l.size());
         assertEquals("http://www.ibiblio.org/mymaven/[module]/jars/[artifact]-[revision].jar",
@@ -104,7 +108,7 @@ public class IBiblioResolverTest extends AbstractDependencyResolverTest {
         _settings.load(IBiblioResolverTest.class.getResource("ibiblioresolverconf.xml"));
         IBiblioResolver resolver = (IBiblioResolver) _settings.getResolver("ibiblioA");
         assertNotNull(resolver);
-        List l = resolver.getArtifactPatterns();
+        List<String> l = resolver.getArtifactPatterns();
         assertNotNull(l);
         assertEquals(1, l.size());
         assertEquals("http://www.ibiblio.org/mymaven/[module]/[artifact]-[revision].jar", l.get(0));
@@ -114,8 +118,7 @@ public class IBiblioResolverTest extends AbstractDependencyResolverTest {
         l = resolver.getArtifactPatterns();
         assertNotNull(l);
         assertEquals(1, l.size());
-        assertEquals(
-            "http://www.ibiblio.org/mymaven/[organisation]/jars/[artifact]-[revision].jar",
+        assertEquals("http://www.ibiblio.org/mymaven/[organisation]/jars/[artifact]-[revision].jar",
             l.get(0));
 
         resolver = (IBiblioResolver) _settings.getResolver("ibiblioC");
@@ -203,6 +206,7 @@ public class IBiblioResolverTest extends AbstractDependencyResolverTest {
         assertEquals(DownloadStatus.NO, ar.getDownloadStatus());
     }
 
+    @SuppressWarnings({"rawtypes", "unchecked"})
     @Test
     public void testMaven2Listing() throws Exception {
         IBiblioResolver resolver = new IBiblioResolver();

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/plugins/resolver/IvyRepResolverTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/resolver/IvyRepResolverTest.java b/test/java/org/apache/ivy/plugins/resolver/IvyRepResolverTest.java
index aba3930..6091f5e 100644
--- a/test/java/org/apache/ivy/plugins/resolver/IvyRepResolverTest.java
+++ b/test/java/org/apache/ivy/plugins/resolver/IvyRepResolverTest.java
@@ -17,6 +17,9 @@
  */
 package org.apache.ivy.plugins.resolver;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
 import java.io.File;
 import java.util.List;
 
@@ -41,10 +44,8 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 
-import static org.junit.Assert.*;
-
 /**
- * 
+ *
  */
 public class IvyRepResolverTest extends AbstractDependencyResolverTest {
     private IvySettings _settings;
@@ -76,16 +77,15 @@ public class IvyRepResolverTest extends AbstractDependencyResolverTest {
         _settings.setVariable("ivy.ivyrep.default.ivy.root", "http://www.jayasoft.fr/myivyrep/");
         _settings.setVariable("ivy.ivyrep.default.ivy.pattern",
             "[organisation]/[module]/ivy-[revision].[ext]");
-        _settings
-                .setVariable("ivy.ivyrep.default.artifact.root", "http://www.ibiblio.org/mymaven/");
+        _settings.setVariable("ivy.ivyrep.default.artifact.root",
+            "http://www.ibiblio.org/mymaven/");
         _settings.setVariable("ivy.ivyrep.default.artifact.pattern",
             "[module]/jars/[artifact]-[revision].jar");
         resolver.setSettings(_settings);
-        List l = resolver.getIvyPatterns();
+        List<String> l = resolver.getIvyPatterns();
         assertNotNull(l);
         assertEquals(1, l.size());
-        assertEquals(
-            "http://www.jayasoft.fr/myivyrep/[organisation]/[module]/ivy-[revision].[ext]",
+        assertEquals("http://www.jayasoft.fr/myivyrep/[organisation]/[module]/ivy-[revision].[ext]",
             l.get(0));
         l = resolver.getArtifactPatterns();
         assertNotNull(l);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/util/CacheCleaner.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/util/CacheCleaner.java b/test/java/org/apache/ivy/util/CacheCleaner.java
index 00e4acc..6c7c916 100644
--- a/test/java/org/apache/ivy/util/CacheCleaner.java
+++ b/test/java/org/apache/ivy/util/CacheCleaner.java
@@ -24,7 +24,10 @@ public class CacheCleaner {
     /**
      * Delete the directory and all it contains. Previously, we used the ant delete task, but it
      * occasionally failed (access denied) on my machine for unknown reason.
-     **/
+     *
+     * @param toDelete
+     *            File
+     */
     public static void deleteDir(File toDelete) {
         FileUtil.forceDelete(toDelete);
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/util/ConfiguratorTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/util/ConfiguratorTest.java b/test/java/org/apache/ivy/util/ConfiguratorTest.java
index 9a2af55..5329985 100644
--- a/test/java/org/apache/ivy/util/ConfiguratorTest.java
+++ b/test/java/org/apache/ivy/util/ConfiguratorTest.java
@@ -17,16 +17,16 @@
  */
 package org.apache.ivy.util;
 
-import org.junit.Before;
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  *
@@ -109,7 +109,7 @@ public class ConfiguratorTest {
         }
     }
 
-    public static abstract class Housing {
+    public abstract static class Housing {
         private final List<Room> _rooms = new ArrayList<>();
 
         private boolean _isEmpty;

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/util/IvyPatternHelperTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/util/IvyPatternHelperTest.java b/test/java/org/apache/ivy/util/IvyPatternHelperTest.java
index 4593953..3efbde6 100644
--- a/test/java/org/apache/ivy/util/IvyPatternHelperTest.java
+++ b/test/java/org/apache/ivy/util/IvyPatternHelperTest.java
@@ -36,7 +36,7 @@ public class IvyPatternHelperTest {
     @Test(expected = Exception.class)
     public void testCyclicSubstitute() {
         String pattern = "${var}";
-        Map variables = new HashMap();
+        Map<String, String> variables = new HashMap<>();
         variables.put("var", "${othervar}");
         variables.put("othervar", "${var}");
 
@@ -45,7 +45,7 @@ public class IvyPatternHelperTest {
 
     @Test
     public void testOptionalSubstitute() {
-        Map tokens = new HashMap();
+        Map<String, String> tokens = new HashMap<>();
         tokens.put("token", "");
         tokens.put("othertoken", "myval");
         assertEquals("test-myval",

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/util/TestXmlHelper.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/util/TestXmlHelper.java b/test/java/org/apache/ivy/util/TestXmlHelper.java
index e0c191e..cea9e0b 100644
--- a/test/java/org/apache/ivy/util/TestXmlHelper.java
+++ b/test/java/org/apache/ivy/util/TestXmlHelper.java
@@ -17,14 +17,15 @@
 
 package org.apache.ivy.util;
 
-import org.w3c.dom.Document;
+import java.io.File;
 
 import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.xpath.XPathExpression;
 import javax.xml.xpath.XPathFactory;
-import java.io.File;
+
+import org.w3c.dom.Document;
 
 /**
  * An utility class to help with XML file parsing and XML content handling
@@ -38,7 +39,7 @@ public class TestXmlHelper {
      * @param xmlFile         The XML file to parse
      * @param xPathExpression The XPath expression to evaluate
      * @param returnType      The expected return type of the {@link XPathExpression#evaluate(Object, QName) evaluation}
-     * @return
+     * @return                The result
      * @throws Exception
      */
     public static Object evaluateXPathExpr(final File xmlFile, final XPathExpression xPathExpression, final QName returnType)
@@ -65,7 +66,7 @@ public class TestXmlHelper {
      * @param xmlFile         The XML file to parse
      * @param xpathExpression The XPath expression to evaluate
      * @param returnType      The expected return type of the {@link XPathExpression#evaluate(Object, QName) evaluation}
-     * @return
+     * @return                The result
      * @throws Exception
      */
     public static Object evaluateXPathExpr(final File xmlFile, final String xpathExpression, final QName returnType) throws Exception {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/util/url/ArtifactoryListingTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/util/url/ArtifactoryListingTest.java b/test/java/org/apache/ivy/util/url/ArtifactoryListingTest.java
index 5cee76c..dec8746 100644
--- a/test/java/org/apache/ivy/util/url/ArtifactoryListingTest.java
+++ b/test/java/org/apache/ivy/util/url/ArtifactoryListingTest.java
@@ -17,13 +17,13 @@
  */
 package org.apache.ivy.util.url;
 
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 
 import java.net.URL;
 import java.util.List;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import org.junit.Test;
 
 public class ArtifactoryListingTest {
     // remote.test
@@ -32,7 +32,7 @@ public class ArtifactoryListingTest {
     public void testWicketListing() throws Exception {
         ApacheURLLister lister = new ApacheURLLister();
 
-        List content = lister.listAll(new URL(
+        List<URL> content = lister.listAll(new URL(
                 "http://repo.jfrog.org/artifactory/libs-releases-local/org/apache/wicket/wicket/"));
         assertNotNull(content);
         assertEquals(5, content.size());


[4/7] ant-ivy git commit: Add generics and Java 7 syntax to core

Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/resolve/IvyNode.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/resolve/IvyNode.java b/src/java/org/apache/ivy/core/resolve/IvyNode.java
index a26146f..47bc3e1 100644
--- a/src/java/org/apache/ivy/core/resolve/IvyNode.java
+++ b/src/java/org/apache/ivy/core/resolve/IvyNode.java
@@ -82,7 +82,7 @@ public class IvyNode implements Comparable<IvyNode> {
     private ModuleRevisionId id;
 
     // set only when node has been built or updated from a DependencyDescriptor
-    private Map<IvyNode, DependencyDescriptor> dds = new HashMap<IvyNode, DependencyDescriptor>();
+    private Map<IvyNode, DependencyDescriptor> dds = new HashMap<>();
 
     // Set when data has been loaded only, or when constructed from a module descriptor
     private ModuleDescriptor md;
@@ -96,18 +96,18 @@ public class IvyNode implements Comparable<IvyNode> {
 
     private boolean searched = false;
 
-    private Collection<String> confsToFetch = new HashSet<String>();
+    private Collection<String> confsToFetch = new HashSet<>();
 
-    private Collection<String> fetchedConfigurations = new HashSet<String>();
+    private Collection<String> fetchedConfigurations = new HashSet<>();
 
-    private Collection<String> loadedRootModuleConfs = new HashSet<String>();
+    private Collection<String> loadedRootModuleConfs = new HashSet<>();
 
     // //////// USAGE DATA
 
     private IvyNodeUsage usage = new IvyNodeUsage(this);
 
     // usage information merged from evicted nodes this node is "replacing"
-    private Map<ModuleRevisionId, IvyNodeUsage> mergedUsages = new LinkedHashMap<ModuleRevisionId, IvyNodeUsage>();
+    private Map<ModuleRevisionId, IvyNodeUsage> mergedUsages = new LinkedHashMap<>();
 
     public IvyNode(ResolveData data, IvyNode parent, DependencyDescriptor dd) {
         id = dd.getDependencyRevisionId();
@@ -310,9 +310,9 @@ public class IvyNode implements Comparable<IvyNode> {
                 confs = md.getPublicConfigurationsNames();
             }
         }
-        Collection<IvyNode> deps = new HashSet<IvyNode>();
-        for (int i = 0; i < confs.length; i++) {
-            deps.addAll(getDependencies(rootModuleConf, confs[i], requestedConf));
+        Collection<IvyNode> deps = new HashSet<>();
+        for (String conf : confs) {
+            deps.addAll(getDependencies(rootModuleConf, conf, requestedConf));
         }
         return deps;
     }
@@ -336,10 +336,9 @@ public class IvyNode implements Comparable<IvyNode> {
             throw new IllegalStateException(
                     "impossible to get dependencies when data has not been loaded");
         }
-        DependencyDescriptor[] dds = md.getDependencies();
         // it's important to respect order => LinkedHashMap
-        Map<ModuleRevisionId, IvyNode> dependencies = new LinkedHashMap<ModuleRevisionId, IvyNode>();
-        for (DependencyDescriptor dependencyDescriptor : dds) {
+        Map<ModuleRevisionId, IvyNode> dependencies = new LinkedHashMap<>();
+        for (DependencyDescriptor dependencyDescriptor : md.getDependencies()) {
             DependencyDescriptor dd = data.mediate(dependencyDescriptor);
             String[] dependencyConfigurations = dd.getDependencyConfigurations(conf, requestedConf);
             if (dependencyConfigurations.length == 0) {
@@ -423,7 +422,7 @@ public class IvyNode implements Comparable<IvyNode> {
                 // a circular dependency, we cannot be conclusive here
                 return null;
             }
-            return Boolean.valueOf(c.doesCallersExclude(rootModuleConf, artifact, callersStack));
+            return c.doesCallersExclude(rootModuleConf, artifact, callersStack);
         }
         return Boolean.FALSE;
     }
@@ -513,7 +512,7 @@ public class IvyNode implements Comparable<IvyNode> {
             // there are exclusions in the configuration
             List<String> exclusions = Arrays.asList(conf.substring(2).split("\\!"));
 
-            List<String> ret = new ArrayList<String>(Arrays.asList(getDescriptor()
+            List<String> ret = new ArrayList<>(Arrays.asList(getDescriptor()
                     .getPublicConfigurationsNames()));
             ret.removeAll(exclusions);
 
@@ -530,7 +529,7 @@ public class IvyNode implements Comparable<IvyNode> {
      * @return array of configuration names
      */
     public String[] getRequiredConfigurations(IvyNode in, String inConf) {
-        Collection<String> req = new LinkedHashSet<String>();
+        Collection<String> req = new LinkedHashSet<>();
         addAllIfNotNull(req, usage.getRequiredConfigurations(in, inConf));
         for (IvyNodeUsage usage : mergedUsages.values()) {
             addAllIfNotNull(req, usage.getRequiredConfigurations(in, inConf));
@@ -550,7 +549,7 @@ public class IvyNode implements Comparable<IvyNode> {
      * @return array of configuration names
      */
     public String[] getRequiredConfigurations() {
-        Collection<String> required = new ArrayList<String>(confsToFetch.size()
+        Collection<String> required = new ArrayList<>(confsToFetch.size()
                 + fetchedConfigurations.size());
         required.addAll(fetchedConfigurations);
         required.addAll(confsToFetch);
@@ -578,7 +577,7 @@ public class IvyNode implements Comparable<IvyNode> {
      * @return array of configuration names
      */
     public String[] getConfigurations(String rootModuleConf) {
-        Set<String> depConfs = new LinkedHashSet<String>();
+        Set<String> depConfs = new LinkedHashSet<>();
         addAllIfNotNull(depConfs, usage.getConfigurations(rootModuleConf));
         for (IvyNodeUsage usage : mergedUsages.values()) {
             addAllIfNotNull(depConfs, usage.getConfigurations(rootModuleConf));
@@ -598,10 +597,9 @@ public class IvyNode implements Comparable<IvyNode> {
             // remove all given dependency configurations to the set + extended ones
             Configuration c = md.getConfiguration(conf);
             if (conf != null) {
-                String[] exts = c.getExtends();
-                for (int i = 0; i < exts.length; i++) {
-                    discardConf(rootModuleConf, exts[i]); // recursive remove of extended
-                    // configurations
+                // recursive remove of extended configurations
+                for (String ext : c.getExtends()) {
+                    discardConf(rootModuleConf, ext);
                 }
                 depConfs.remove(c.getName());
             } else {
@@ -643,7 +641,7 @@ public class IvyNode implements Comparable<IvyNode> {
      * @return {@link Set} of configuration names
      */
     public Set<String> getRootModuleConfigurationsSet() {
-        Set<String> confs = new LinkedHashSet<String>();
+        Set<String> confs = new LinkedHashSet<>();
         addAllIfNotNull(confs, usage.getRootModuleConfigurations());
         for (IvyNodeUsage usage : mergedUsages.values()) {
             addAllIfNotNull(confs, usage.getRootModuleConfigurations());
@@ -672,7 +670,7 @@ public class IvyNode implements Comparable<IvyNode> {
         if (conf.charAt(0) == '*') {
             return resolveSpecialConfigurations(new String[] {conf});
         }
-        if (conf.indexOf(',') != -1) {
+        if (conf.contains(",")) {
             String[] confs = conf.split(",");
             for (int i = 0; i < confs.length; i++) {
                 confs[i] = confs[i].trim();
@@ -749,7 +747,7 @@ public class IvyNode implements Comparable<IvyNode> {
     }
 
     private Collection<IvyNodeUsage> getAllUsages() {
-        Collection<IvyNodeUsage> usages = new ArrayList<IvyNodeUsage>();
+        Collection<IvyNodeUsage> usages = new ArrayList<>();
         usages.add(usage);
         usages.addAll(mergedUsages.values());
         return usages;
@@ -761,7 +759,7 @@ public class IvyNode implements Comparable<IvyNode> {
      * @return array of {@link Artifact}s
      */
     public Artifact[] getAllArtifacts() {
-        Set<Artifact> ret = new HashSet<Artifact>();
+        Set<Artifact> ret = new HashSet<>();
         for (String rootModuleConf : getRootModuleConfigurationsSet()) {
             ret.addAll(Arrays.asList(getArtifacts(rootModuleConf)));
         }
@@ -776,7 +774,7 @@ public class IvyNode implements Comparable<IvyNode> {
      * @return array of {@link Artifact}s
      */
     public Artifact[] getSelectedArtifacts(Filter<Artifact> artifactFilter) {
-        Collection<Artifact> ret = new HashSet<Artifact>();
+        Collection<Artifact> ret = new HashSet<>();
         for (String rootModuleConf : getRootModuleConfigurationsSet()) {
             if (!isEvicted(rootModuleConf) && !isBlacklisted(rootModuleConf)) {
                 ret.addAll(Arrays.asList(getArtifacts(rootModuleConf)));
@@ -807,7 +805,7 @@ public class IvyNode implements Comparable<IvyNode> {
                             + this);
         }
 
-        Set<Artifact> artifacts = new HashSet<Artifact>(); // the set we fill before returning
+        Set<Artifact> artifacts = new HashSet<>(); // the set we fill before returning
 
         // we check if we have dependencyArtifacts includes description for this rootModuleConf
         Set<DependencyArtifactDescriptor> dependencyArtifacts = usage
@@ -817,7 +815,7 @@ public class IvyNode implements Comparable<IvyNode> {
             addArtifactsFromOwnUsage(artifacts, dependencyArtifacts);
             addArtifactsFromMergedUsage(rootModuleConf, artifacts);
         } else {
-            Set<IncludeRule> includes = new LinkedHashSet<IncludeRule>();
+            Set<IncludeRule> includes = new LinkedHashSet<>();
             addAllIfNotNull(includes, usage.getDependencyIncludesSet(rootModuleConf));
             for (IvyNodeUsage usage : mergedUsages.values()) {
                 addAllIfNotNull(includes, usage.getDependencyIncludesSet(rootModuleConf));
@@ -826,19 +824,17 @@ public class IvyNode implements Comparable<IvyNode> {
             if ((dependencyArtifacts == null || dependencyArtifacts.isEmpty())
                     && (includes.isEmpty())) {
                 // no artifacts / includes: we get all artifacts as defined by the descriptor
-                for (int i = 0; i < confs.length; i++) {
-                    artifacts.addAll(Arrays.asList(md.getArtifacts(confs[i])));
+                for (String conf : confs) {
+                    artifacts.addAll(Arrays.asList(md.getArtifacts(conf)));
                 }
             } else {
-                // we have to get only artifacts listed as "includes"
-
+                // we have to get only artifacts listed as "includes";
                 // first we get all artifacts as defined by the module descriptor
                 // and classify them by artifact id
-                Map<ArtifactId, Artifact> allArtifacts = new HashMap<ArtifactId, Artifact>();
-                for (int i = 0; i < confs.length; i++) {
-                    Artifact[] arts = md.getArtifacts(confs[i]);
-                    for (int j = 0; j < arts.length; j++) {
-                        allArtifacts.put(arts[j].getId().getArtifactId(), arts[j]);
+                Map<ArtifactId, Artifact> allArtifacts = new HashMap<>();
+                for (String conf : confs) {
+                    for (Artifact art : md.getArtifacts(conf)) {
+                        allArtifacts.put(art.getId().getArtifactId(), art);
                     }
                 }
 
@@ -849,7 +845,8 @@ public class IvyNode implements Comparable<IvyNode> {
                 addArtifactsFromMergedUsage(rootModuleConf, artifacts);
 
                 // and now we filter according to include rules
-                for (Iterator<IncludeRule> it = includes.iterator(); it.hasNext();) {
+                Iterator<IncludeRule> it = includes.iterator();
+                while (it.hasNext()) {
                     IncludeRule dad = it.next();
                     Collection<Artifact> arts = findArtifactsMatching(dad, allArtifacts);
                     if (arts.isEmpty()) {
@@ -866,8 +863,9 @@ public class IvyNode implements Comparable<IvyNode> {
             }
         }
 
-        // now excludes artifacts that aren't accepted by any caller
-        for (Iterator<Artifact> iter = artifacts.iterator(); iter.hasNext();) {
+        // now exclude artifacts that aren't accepted by any caller
+        Iterator<Artifact> iter = artifacts.iterator();
+        while (iter.hasNext()) {
             Artifact artifact = iter.next();
             boolean excluded = callers.doesCallersExclude(rootModuleConf, artifact);
             if (excluded) {
@@ -892,7 +890,7 @@ public class IvyNode implements Comparable<IvyNode> {
                     .getDependencyArtifactsSet(rootModuleConf);
             if (mergedDependencyArtifacts != null) {
                 for (DependencyArtifactDescriptor dad : mergedDependencyArtifacts) {
-                    Map<String, String> extraAttributes = new HashMap<String, String>(
+                    Map<String, String> extraAttributes = new HashMap<>(
                             dad.getQualifiedExtraAttributes());
                     MDArtifact artifact = new MDArtifact(md, dad.getName(), dad.getType(),
                             dad.getExt(), dad.getUrl(), extraAttributes);
@@ -910,7 +908,7 @@ public class IvyNode implements Comparable<IvyNode> {
 
     private static Collection<Artifact> findArtifactsMatching(IncludeRule rule,
             Map<ArtifactId, Artifact> allArtifacts) {
-        Collection<Artifact> ret = new ArrayList<Artifact>();
+        Collection<Artifact> ret = new ArrayList<>();
         for (Entry<ArtifactId, Artifact> entry : allArtifacts.entrySet()) {
             if (MatcherHelper.matches(rule.getMatcher(), rule.getId(), entry.getKey())) {
                 ret.add(entry.getValue());
@@ -1243,7 +1241,7 @@ public class IvyNode implements Comparable<IvyNode> {
             Message.verbose("BLACKLISTING " + bdata);
         }
 
-        Stack<IvyNode> callerStack = new Stack<IvyNode>();
+        Stack<IvyNode> callerStack = new Stack<>();
         callerStack.push(this);
         clearEvictionDataInAllCallers(bdata.getRootModuleConf(), callerStack);
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java b/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java
index f9c6d57..558565b 100644
--- a/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java
+++ b/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java
@@ -39,7 +39,7 @@ public class IvyNodeCallers {
         private ModuleRevisionId mrid;
 
         // callerConf -> dependencyConfs
-        private Map<String, String[]> confs = new HashMap<String, String[]>();
+        private Map<String, String[]> confs = new HashMap<>();
 
         private DependencyDescriptor dd;
 
@@ -61,8 +61,8 @@ public class IvyNodeCallers {
             if (conf != null) {
                 String[] confExtends = conf.getExtends();
                 if (confExtends != null) {
-                    for (int i = 0; i < confExtends.length; i++) {
-                        addConfiguration(confExtends[i], dependencyConfs);
+                    for (String confExtend : confExtends) {
+                        addConfiguration(confExtend, dependencyConfs);
                     }
                 }
             }
@@ -71,7 +71,7 @@ public class IvyNodeCallers {
         private void updateConfs(String callerConf, String[] dependencyConfs) {
             String[] prevDepConfs = confs.get(callerConf);
             if (prevDepConfs != null) {
-                Set<String> newDepConfs = new HashSet<String>(Arrays.asList(prevDepConfs));
+                Set<String> newDepConfs = new HashSet<>(Arrays.asList(prevDepConfs));
                 newDepConfs.addAll(Arrays.asList(dependencyConfs));
                 confs.put(callerConf, newDepConfs.toArray(new String[newDepConfs.size()]));
             } else {
@@ -137,12 +137,12 @@ public class IvyNodeCallers {
     }
 
     // key in second map is used to easily get a caller by its mrid
-    private Map<String, Map<ModuleRevisionId, Caller>> callersByRootConf = new HashMap<String, Map<ModuleRevisionId, Caller>>();
+    private Map<String, Map<ModuleRevisionId, Caller>> callersByRootConf = new HashMap<>();
 
     // this map contains all the module ids calling this one (including transitively) as keys.
     // the mapped nodes (values) correspond to a direct caller from which the transitive caller
     // comes
-    private Map<ModuleId, IvyNode> allCallers = new HashMap<ModuleId, IvyNode>();
+    private Map<ModuleId, IvyNode> allCallers = new HashMap<>();
 
     private IvyNode node;
 
@@ -170,7 +170,7 @@ public class IvyNodeCallers {
         }
         Map<ModuleRevisionId, Caller> callers = callersByRootConf.get(rootModuleConf);
         if (callers == null) {
-            callers = new HashMap<ModuleRevisionId, Caller>();
+            callers = new HashMap<>();
             callersByRootConf.put(rootModuleConf, callers);
         }
         Caller caller = callers.get(mrid);
@@ -204,7 +204,7 @@ public class IvyNodeCallers {
     }
 
     public Caller[] getAllCallers() {
-        Set<Caller> all = new HashSet<Caller>();
+        Set<Caller> all = new HashSet<>();
         for (Map<ModuleRevisionId, Caller> callers : callersByRootConf.values()) {
             all.addAll(callers.values());
         }
@@ -212,7 +212,7 @@ public class IvyNodeCallers {
     }
 
     public Caller[] getAllRealCallers() {
-        Set<Caller> all = new HashSet<Caller>();
+        Set<Caller> all = new HashSet<>();
         for (Map<ModuleRevisionId, Caller> callers : callersByRootConf.values()) {
             for (Caller c : callers.values()) {
                 if (c.isRealCaller()) {
@@ -232,7 +232,7 @@ public class IvyNodeCallers {
         if (nodecallers != null) {
             Map<ModuleRevisionId, Caller> thiscallers = callersByRootConf.get(rootModuleConf);
             if (thiscallers == null) {
-                thiscallers = new HashMap<ModuleRevisionId, Caller>();
+                thiscallers = new HashMap<>();
                 callersByRootConf.put(rootModuleConf, thiscallers);
             }
             for (Caller caller : nodecallers.values()) {
@@ -270,14 +270,14 @@ public class IvyNodeCallers {
                 return false;
             }
             boolean allInconclusive = true;
-            for (int i = 0; i < callers.length; i++) {
-                if (!callers[i].canExclude()) {
+            for (Caller caller : callers) {
+                if (!caller.canExclude()) {
                     return false;
                 }
-                ModuleDescriptor md = callers[i].getModuleDescriptor();
+                ModuleDescriptor md = caller.getModuleDescriptor();
                 Boolean doesExclude = node.doesExclude(md, rootModuleConf,
-                    callers[i].getCallerConfigurations(), callers[i].getDependencyDescriptor(),
-                    artifact, callersStack);
+                        caller.getCallerConfigurations(), caller.getDependencyDescriptor(),
+                        artifact, callersStack);
                 if (doesExclude != null) {
                     if (!doesExclude) {
                         return false;

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/resolve/IvyNodeEviction.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/resolve/IvyNodeEviction.java b/src/java/org/apache/ivy/core/resolve/IvyNodeEviction.java
index 3524f21..abd135c 100644
--- a/src/java/org/apache/ivy/core/resolve/IvyNodeEviction.java
+++ b/src/java/org/apache/ivy/core/resolve/IvyNodeEviction.java
@@ -157,7 +157,9 @@ public class IvyNodeEviction {
 
         @Override
         public boolean equals(Object obj) {
-            return obj instanceof ModuleIdConf && getModuleId().equals(((ModuleIdConf) obj).getModuleId()) && getConf().equals(((ModuleIdConf) obj).getConf());
+            return obj instanceof ModuleIdConf
+                    && getModuleId().equals(((ModuleIdConf) obj).getModuleId())
+                    && getConf().equals(((ModuleIdConf) obj).getConf());
         }
 
         @Override
@@ -174,20 +176,20 @@ public class IvyNodeEviction {
     private IvyNode node;
 
     // map indicating for each dependency which node has been selected
-    private Map<ModuleIdConf, Set<IvyNode>> selectedDeps = new HashMap<ModuleIdConf, Set<IvyNode>>();
+    private Map<ModuleIdConf, Set<IvyNode>> selectedDeps = new HashMap<>();
 
     // map indicating for each dependency which nodes are in pending conflict (conflict detected but
     // not yet resolved)
-    private Map<ModuleIdConf, Set<IvyNode>> pendingConflicts = new HashMap<ModuleIdConf, Set<IvyNode>>();
+    private Map<ModuleIdConf, Set<IvyNode>> pendingConflicts = new HashMap<>();
 
     // map indicating for each dependency which node has been evicted
-    private Map<ModuleIdConf, Set<IvyNode>> evictedDeps = new HashMap<ModuleIdConf, Set<IvyNode>>();
+    private Map<ModuleIdConf, Set<IvyNode>> evictedDeps = new HashMap<>();
 
     // map indicating for each dependency which revision has been evicted
-    private Map<ModuleIdConf, Collection<ModuleRevisionId>> evictedRevs = new HashMap<ModuleIdConf, Collection<ModuleRevisionId>>();
+    private Map<ModuleIdConf, Collection<ModuleRevisionId>> evictedRevs = new HashMap<>();
 
     // indicates if the node is evicted in each root module conf
-    private Map<String, EvictionData> evicted = new HashMap<String, EvictionData>();
+    private Map<String, EvictionData> evicted = new HashMap<>();
 
     public IvyNodeEviction(IvyNode node) {
         if (node == null) {
@@ -203,7 +205,7 @@ public class IvyNodeEviction {
      */
     public Set<IvyNode> getResolvedNodes(ModuleId mid, String rootModuleConf) {
         Collection<IvyNode> resolved = selectedDeps.get(new ModuleIdConf(mid, rootModuleConf));
-        Set<IvyNode> ret = new HashSet<IvyNode>();
+        Set<IvyNode> ret = new HashSet<>();
         if (resolved != null) {
             for (IvyNode node : resolved) {
                 ret.add(node.getRealNode());
@@ -215,9 +217,9 @@ public class IvyNodeEviction {
     public Collection<ModuleRevisionId> getResolvedRevisions(ModuleId mid, String rootModuleConf) {
         Collection<IvyNode> resolved = selectedDeps.get(new ModuleIdConf(mid, rootModuleConf));
         if (resolved == null) {
-            return new HashSet<ModuleRevisionId>();
+            return new HashSet<>();
         } else {
-            Collection<ModuleRevisionId> resolvedRevs = new HashSet<ModuleRevisionId>();
+            Collection<ModuleRevisionId> resolvedRevs = new HashSet<>();
             for (IvyNode node : resolved) {
                 ModuleRevisionId resolvedId = node.getResolvedId();
                 resolvedRevs.add(node.getId());
@@ -237,12 +239,12 @@ public class IvyNodeEviction {
     public void setResolvedNodes(ModuleId moduleId, String rootModuleConf,
             Collection<IvyNode> resolved) {
         ModuleIdConf moduleIdConf = new ModuleIdConf(moduleId, rootModuleConf);
-        selectedDeps.put(moduleIdConf, new HashSet<IvyNode>(resolved));
+        selectedDeps.put(moduleIdConf, new HashSet<>(resolved));
     }
 
     public Collection<IvyNode> getEvictedNodes(ModuleId mid, String rootModuleConf) {
         Collection<IvyNode> resolved = evictedDeps.get(new ModuleIdConf(mid, rootModuleConf));
-        Set<IvyNode> ret = new HashSet<IvyNode>();
+        Set<IvyNode> ret = new HashSet<>();
         if (resolved != null) {
             for (IvyNode node : resolved) {
                 ret.add(node.getRealNode());
@@ -255,17 +257,17 @@ public class IvyNodeEviction {
         Collection<ModuleRevisionId> evicted = evictedRevs
                 .get(new ModuleIdConf(mid, rootModuleConf));
         if (evicted == null) {
-            return new HashSet<ModuleRevisionId>();
+            return new HashSet<>();
         } else {
-            return new HashSet<ModuleRevisionId>(evicted);
+            return new HashSet<>(evicted);
         }
     }
 
     public void setEvictedNodes(ModuleId moduleId, String rootModuleConf,
             Collection<IvyNode> evicted) {
         ModuleIdConf moduleIdConf = new ModuleIdConf(moduleId, rootModuleConf);
-        evictedDeps.put(moduleIdConf, new HashSet<IvyNode>(evicted));
-        Collection<ModuleRevisionId> evictedRevs = new HashSet<ModuleRevisionId>();
+        evictedDeps.put(moduleIdConf, new HashSet<>(evicted));
+        Collection<ModuleRevisionId> evictedRevs = new HashSet<>();
         for (IvyNode node : evicted) {
             evictedRevs.add(node.getId());
             evictedRevs.add(node.getResolvedId());
@@ -295,9 +297,8 @@ public class IvyNodeEviction {
         if (node.isRoot()) {
             return false;
         }
-        String[] rootModuleConfigurations = node.getRootModuleConfigurations();
-        for (int i = 0; i < rootModuleConfigurations.length; i++) {
-            if (!isEvicted(rootModuleConfigurations[i])) {
+        for (String rootModuleConfiguration : node.getRootModuleConfigurations()) {
+            if (!isEvicted(rootModuleConfiguration)) {
                 return false;
             }
         }
@@ -306,7 +307,8 @@ public class IvyNodeEviction {
 
     private void cleanEvicted() {
         // check if it was evicted by a node that we are now the real node for
-        for (Iterator<String> iter = evicted.keySet().iterator(); iter.hasNext();) {
+        Iterator<String> iter = evicted.keySet().iterator();
+        while (iter.hasNext()) {
             String rootModuleConf = iter.next();
             EvictionData ed = evicted.get(rootModuleConf);
             Collection<IvyNode> sel = ed.getSelected();
@@ -348,7 +350,7 @@ public class IvyNodeEviction {
             Collection<IvyNode> selected = ed.getSelected();
             if (selected != null) {
                 if (allEvictingNodes == null) {
-                    allEvictingNodes = new HashSet<IvyNode>();
+                    allEvictingNodes = new HashSet<>();
                 }
                 allEvictingNodes.addAll(selected);
             }
@@ -362,7 +364,7 @@ public class IvyNodeEviction {
             Collection<IvyNode> selected = ed.getSelected();
             if (selected != null) {
                 if (ret == null) {
-                    ret = new HashSet<String>();
+                    ret = new HashSet<>();
                 }
                 if (selected.size() == 1) {
                     ret.add(selected.iterator().next()
@@ -376,7 +378,7 @@ public class IvyNodeEviction {
     }
 
     public Collection<ConflictManager> getAllEvictingConflictManagers() {
-        Collection<ConflictManager> ret = new HashSet<ConflictManager>();
+        Collection<ConflictManager> ret = new HashSet<>();
         for (EvictionData ed : evicted.values()) {
             ret.add(ed.getConflictManager());
         }
@@ -409,7 +411,7 @@ public class IvyNodeEviction {
 
     public Collection<IvyNode> getPendingConflicts(String rootModuleConf, ModuleId mid) {
         Collection<IvyNode> resolved = pendingConflicts.get(new ModuleIdConf(mid, rootModuleConf));
-        Set<IvyNode> ret = new HashSet<IvyNode>();
+        Set<IvyNode> ret = new HashSet<>();
         if (resolved != null) {
             for (IvyNode node : resolved) {
                 ret.add(node.getRealNode());
@@ -421,7 +423,7 @@ public class IvyNodeEviction {
     public void setPendingConflicts(ModuleId moduleId, String rootModuleConf,
             Collection<IvyNode> conflicts) {
         ModuleIdConf moduleIdConf = new ModuleIdConf(moduleId, rootModuleConf);
-        pendingConflicts.put(moduleIdConf, new HashSet<IvyNode>(conflicts));
+        pendingConflicts.put(moduleIdConf, new HashSet<>(conflicts));
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/resolve/IvyNodeUsage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/resolve/IvyNodeUsage.java b/src/java/org/apache/ivy/core/resolve/IvyNodeUsage.java
index 0399f52..99bdf74 100644
--- a/src/java/org/apache/ivy/core/resolve/IvyNodeUsage.java
+++ b/src/java/org/apache/ivy/core/resolve/IvyNodeUsage.java
@@ -123,14 +123,14 @@ public class IvyNodeUsage {
     // used to know which configurations of the dependency are required
     // for each root module configuration
     // rootConfName -> confNames
-    private Map<String, Set<String>> rootModuleConfs = new HashMap<String, Set<String>>();
+    private Map<String, Set<String>> rootModuleConfs = new HashMap<>();
 
-    private Map<NodeConf, Set<String>> requiredConfs = new HashMap<NodeConf, Set<String>>();
+    private Map<NodeConf, Set<String>> requiredConfs = new HashMap<>();
 
-    private Map<String, Set<Depender>> dependers = new HashMap<String, Set<Depender>>();
+    private Map<String, Set<Depender>> dependers = new HashMap<>();
 
     // rootModuleConf -> black list
-    private Map<String, IvyNodeBlacklist> blacklisted = new HashMap<String, IvyNodeBlacklist>();
+    private Map<String, IvyNodeBlacklist> blacklisted = new HashMap<>();
 
     public IvyNodeUsage(IvyNode node) {
         this.node = node;
@@ -141,12 +141,12 @@ public class IvyNodeUsage {
     }
 
     protected void setRequiredConfs(IvyNode parent, String parentConf, Collection<String> confs) {
-        requiredConfs.put(new NodeConf(parent, parentConf), new HashSet<String>(confs));
+        requiredConfs.put(new NodeConf(parent, parentConf), new HashSet<>(confs));
     }
 
     /**
      * Returns the configurations of the dependency required in a given root module configuration.
-     * 
+     *
      * @param rootModuleConf ditto
      * @return Set&lt;String&gt;
      */
@@ -157,7 +157,7 @@ public class IvyNodeUsage {
     protected Set<String> addAndGetConfigurations(String rootModuleConf) {
         Set<String> depConfs = rootModuleConfs.get(rootModuleConf);
         if (depConfs == null) {
-            depConfs = new HashSet<String>();
+            depConfs = new HashSet<>();
             rootModuleConfs.put(rootModuleConf, depConfs);
         }
         return depConfs;
@@ -197,7 +197,7 @@ public class IvyNodeUsage {
             if (toupdate != null) {
                 toupdate.addAll(set);
             } else {
-                to.put(key, new HashSet<V>(set));
+                to.put(key, new HashSet<>(set));
             }
         }
     }
@@ -205,7 +205,7 @@ public class IvyNodeUsage {
     private <K, V> void addObjectsForConf(K rootModuleConf, V objectToAdd, Map<K, Set<V>> map) {
         Set<V> set = map.get(rootModuleConf);
         if (set == null) {
-            set = new HashSet<V>();
+            set = new HashSet<>();
             map.put(rootModuleConf, set);
         }
         set.add(objectToAdd);
@@ -224,7 +224,7 @@ public class IvyNodeUsage {
         if (dependersInConf == null) {
             return null;
         }
-        Set<DependencyArtifactDescriptor> dependencyArtifacts = new HashSet<DependencyArtifactDescriptor>();
+        Set<DependencyArtifactDescriptor> dependencyArtifacts = new HashSet<>();
         for (Depender depender : dependersInConf) {
             DependencyArtifactDescriptor[] dads = depender.dd
                     .getDependencyArtifacts(depender.dependerConf);
@@ -238,7 +238,7 @@ public class IvyNodeUsage {
         if (dependersInConf == null) {
             return null;
         }
-        Set<IncludeRule> dependencyIncludes = new HashSet<IncludeRule>();
+        Set<IncludeRule> dependencyIncludes = new HashSet<>();
         for (Depender depender : dependersInConf) {
             IncludeRule[] rules = depender.dd.getIncludeRules(depender.dependerConf);
             if (rules == null || rules.length == 0) {
@@ -264,10 +264,10 @@ public class IvyNodeUsage {
      * <p>
      * A blacklisted node should be considered as if it doesn't even exist on the repository.
      * </p>
-     * 
+     *
      * @param rootModuleConf
      *            the root module conf for which we'd like to know if the node is blacklisted
-     * 
+     *
      * @return true if this node is blacklisted int he given root module conf, false otherwise
      * @see #blacklist(IvyNodeBlacklist)
      */
@@ -278,7 +278,7 @@ public class IvyNodeUsage {
     /**
      * Returns the blacklist data of this node in the given root module conf, or <code>null</code>
      * if this node is not blacklisted in this root module conf.
-     * 
+     *
      * @param rootModuleConf
      *            the root module configuration to consider
      * @return the blacklist data if any
@@ -294,7 +294,7 @@ public class IvyNodeUsage {
     /**
      * Indicates if at least one depender has a transitive dependency descriptor for the given root
      * module conf.
-     * 
+     *
      * @param rootModuleConf
      *            the root module conf to consider
      * @return <code>true</code> if at least one depender has a transitive dependency descriptor for

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/resolve/ResolveData.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/resolve/ResolveData.java b/src/java/org/apache/ivy/core/resolve/ResolveData.java
index 74221f0..920e97d 100644
--- a/src/java/org/apache/ivy/core/resolve/ResolveData.java
+++ b/src/java/org/apache/ivy/core/resolve/ResolveData.java
@@ -82,7 +82,7 @@ public class ResolveData {
     }
 
     public Collection<IvyNode> getNodes() {
-        Collection<IvyNode> nodes = new ArrayList<IvyNode>();
+        Collection<IvyNode> nodes = new ArrayList<>();
         for (VisitData vdata : visitData.values()) {
             nodes.add(vdata.getNode());
         }
@@ -142,19 +142,7 @@ public class ResolveData {
     }
 
     private static boolean isEqual(Object obj1, Object obj2) {
-        if (obj1 == obj2) {
-            return true;
-        }
-
-        if (obj1 == null) {
-            return obj2 == null;
-        }
-
-        if (obj2 == null) {
-            return obj1 == null;
-        }
-
-        return obj1.equals(obj2);
+        return obj1 == obj2 || obj1 != null && obj2 != null && obj1.equals(obj2);
     }
 
     /**
@@ -256,11 +244,10 @@ public class ResolveData {
     }
 
     void blacklist(IvyNode node) {
-        for (Iterator<Entry<ModuleRevisionId, VisitData>> iter = visitData.entrySet().iterator(); iter
-                .hasNext();) {
+        Iterator<Entry<ModuleRevisionId, VisitData>> iter = visitData.entrySet().iterator();
+        while (iter.hasNext()) {
             Entry<ModuleRevisionId, VisitData> entry = iter.next();
-            VisitData vdata = entry.getValue();
-            if (vdata.getNode() == node && !node.getResolvedId().equals(entry.getKey())) {
+            if (entry.getValue().getNode() == node && !node.getResolvedId().equals(entry.getKey())) {
                 // this visit data was associated with the blacklisted node,
                 // we discard this association
                 iter.remove();
@@ -271,22 +258,22 @@ public class ResolveData {
     public boolean isBlacklisted(String rootModuleConf, ModuleRevisionId mrid) {
         IvyNode node = getNode(mrid);
 
-        // if (node == null) {
-        // // search again, now ignore the extra attributes
-        // // TODO: maybe we should search the node that has at least the
-        // // same attributes as mrid
-        // for (Iterator it = visitData.entrySet().iterator(); it.hasNext();) {
-        // Map.Entry entry = (Entry) it.next();
-        // ModuleRevisionId current = (ModuleRevisionId) entry.getKey();
-        // if (current.getModuleId().equals(mrid.getModuleId())
-        // && current.getRevision().equals(mrid.getRevision())) {
-        // VisitData data = (VisitData) entry.getValue();
-        // node = data.getNode();
-        // break;
-        // }
-        // }
-        // }
-        //
+        /*
+        if (node == null) {
+            // search again, now ignore the extra attributes
+            // TODO: maybe we should search the node that has at least the same attributes as mrid
+            for (Entry<ModuleRevisionId, VisitData> entry : visitData.entrySet()) {
+                ModuleRevisionId current = entry.getKey();
+                if (current.getModuleId().equals(mrid.getModuleId())
+                        && current.getRevision().equals(mrid.getRevision())) {
+                    VisitData data = entry.getValue();
+                    node = data.getNode();
+                    break;
+                }
+            }
+        }
+        */
+
         return node != null && node.isBlacklisted(rootModuleConf);
     }
 
@@ -297,7 +284,7 @@ public class ResolveData {
         VisitNode current = getCurrentVisitNode();
         if (current != null) {
             // mediating dd through dependers stack
-            List<VisitNode> dependers = new ArrayList<VisitNode>(current.getPath());
+            List<VisitNode> dependers = new ArrayList<>(current.getPath());
             // the returned path contains the currently visited node, we are only interested in
             // the dependers, so we remove the currently visited node from the end
             dependers.remove(dependers.size() - 1);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/resolve/ResolveEngine.java b/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
index 4258424..3d538ae 100644
--- a/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
+++ b/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
@@ -86,7 +86,7 @@ public class ResolveEngine {
 
     private SortEngine sortEngine;
 
-    private Set<String> fetchedSet = new HashSet<String>();
+    private Set<String> fetchedSet = new HashSet<>();
 
     private DependencyResolver dictatorResolver;
 
@@ -267,47 +267,47 @@ public class ResolveEngine {
                     .getResolvedModuleRevisionId());
             Properties props = new Properties();
             if (dependencies.length > 0) {
-                Map<ModuleId, ModuleRevisionId> forcedRevisions = new HashMap<ModuleId, ModuleRevisionId>();
-                for (int i = 0; i < dependencies.length; i++) {
-                    if (dependencies[i].getModuleRevision() != null
-                            && dependencies[i].getModuleRevision().isForce()) {
-                        forcedRevisions.put(dependencies[i].getModuleId(),
-                            dependencies[i].getResolvedId());
+                Map<ModuleId, ModuleRevisionId> forcedRevisions = new HashMap<>();
+                for (IvyNode dependency : dependencies) {
+                    if (dependency.getModuleRevision() != null
+                            && dependency.getModuleRevision().isForce()) {
+                        forcedRevisions.put(dependency.getModuleId(),
+                                dependency.getResolvedId());
                     }
                 }
 
                 IvyNode root = dependencies[0].getRoot();
 
-                Map<ModuleId, IvyNode> topLevelDeps = new HashMap<ModuleId, IvyNode>();
-                for (int i = 0; i < dependencies.length; i++) {
-                    if (!dependencies[i].hasProblem()) {
-                        DependencyDescriptor dd = dependencies[i].getDependencyDescriptor(root);
+                Map<ModuleId, IvyNode> topLevelDeps = new HashMap<>();
+                for (IvyNode dependency : dependencies) {
+                    if (!dependency.hasProblem()) {
+                        DependencyDescriptor dd = dependency.getDependencyDescriptor(root);
                         if (dd != null) {
-                            ModuleId orgMod = dependencies[i].getModuleId();
-                            topLevelDeps.put(orgMod, dependencies[i]);
+                            ModuleId orgMod = dependency.getModuleId();
+                            topLevelDeps.put(orgMod, dependency);
                         }
                     }
                 }
 
-                for (int i = 0; i < dependencies.length; i++) {
-                    if (!dependencies[i].hasProblem() && !dependencies[i].isCompletelyEvicted()) {
-                        DependencyDescriptor dd = dependencies[i].getDependencyDescriptor(root);
+                for (IvyNode dependency : dependencies) {
+                    if (!dependency.hasProblem() && !dependency.isCompletelyEvicted()) {
+                        DependencyDescriptor dd = dependency.getDependencyDescriptor(root);
                         if (dd == null) {
-                            ModuleId mid = dependencies[i].getModuleId();
+                            ModuleId mid = dependency.getModuleId();
                             IvyNode tlDep = topLevelDeps.get(mid);
                             if (tlDep != null) {
                                 dd = tlDep.getDependencyDescriptor(root);
                             }
                         }
                         if (dd != null) {
-                            ModuleRevisionId depResolvedId = dependencies[i].getResolvedId();
-                            ModuleDescriptor depDescriptor = dependencies[i].getDescriptor();
+                            ModuleRevisionId depResolvedId = dependency.getResolvedId();
+                            ModuleDescriptor depDescriptor = dependency.getDescriptor();
                             ModuleRevisionId depRevisionId = dd.getDependencyRevisionId();
-                            ModuleRevisionId forcedRevisionId = forcedRevisions.get(dependencies[i]
+                            ModuleRevisionId forcedRevisionId = forcedRevisions.get(dependency
                                     .getModuleId());
 
-                            if (dependencies[i].getModuleRevision() != null
-                                    && dependencies[i].getModuleRevision().isForce()
+                            if (dependency.getModuleRevision() != null
+                                    && dependency.getModuleRevision().isForce()
                                     && !depResolvedId.equals(depRevisionId)
                                     && !settings.getVersionMatcher().isDynamic(depRevisionId)) {
                                 // if we were forced to this revision and we
@@ -319,7 +319,7 @@ public class ResolveEngine {
 
                             if (depResolvedId == null) {
                                 throw new NullPointerException("getResolvedId() is null for "
-                                        + dependencies[i].toString());
+                                        + dependency.toString());
                             }
                             if (depRevisionId == null) {
                                 throw new NullPointerException("getDependencyRevisionId() "
@@ -391,49 +391,45 @@ public class ResolveEngine {
     public void downloadArtifacts(ResolveReport report, Filter<Artifact> artifactFilter,
             DownloadOptions options) {
         long start = System.currentTimeMillis();
-        IvyNode[] dependencies = report.getDependencies().toArray(
-            new IvyNode[report.getDependencies().size()]);
 
         eventManager.fireIvyEvent(new PrepareDownloadEvent(report.getArtifacts().toArray(
             new Artifact[report.getArtifacts().size()])));
 
         long totalSize = 0;
-        for (int i = 0; i < dependencies.length; i++) {
+        for (IvyNode dependency : report.getDependencies()) {
             checkInterrupted();
             // download artifacts required in all asked configurations
-            if (!dependencies[i].isCompletelyEvicted() && !dependencies[i].hasProblem()
-                    && dependencies[i].getModuleRevision() != null) {
-                DependencyResolver resolver = dependencies[i].getModuleRevision()
+            if (!dependency.isCompletelyEvicted() && !dependency.hasProblem()
+                    && dependency.getModuleRevision() != null) {
+                DependencyResolver resolver = dependency.getModuleRevision()
                         .getArtifactResolver();
-                Artifact[] selectedArtifacts = dependencies[i].getSelectedArtifacts(artifactFilter);
+                Artifact[] selectedArtifacts = dependency.getSelectedArtifacts(artifactFilter);
                 DownloadReport dReport = resolver.download(selectedArtifacts, options);
-                ArtifactDownloadReport[] adrs = dReport.getArtifactsReports();
-                for (int j = 0; j < adrs.length; j++) {
-                    if (adrs[j].getDownloadStatus() == DownloadStatus.FAILED) {
-                        if (adrs[j].getArtifact().getExtraAttribute("ivy:merged") != null) {
-                            Message.warn("\tmerged artifact not found: " + adrs[j].getArtifact()
+                for (ArtifactDownloadReport adr : dReport.getArtifactsReports()) {
+                    if (adr.getDownloadStatus() == DownloadStatus.FAILED) {
+                        if (adr.getArtifact().getExtraAttribute("ivy:merged") != null) {
+                            Message.warn("\tmerged artifact not found: " + adr.getArtifact()
                                     + ". It was required in "
-                                    + adrs[j].getArtifact().getExtraAttribute("ivy:merged"));
+                                    + adr.getArtifact().getExtraAttribute("ivy:merged"));
                         } else {
-                            Message.warn("\t" + adrs[j]);
-                            resolver.reportFailure(adrs[j].getArtifact());
+                            Message.warn("\t" + adr);
+                            resolver.reportFailure(adr.getArtifact());
                         }
-                    } else if (adrs[j].getDownloadStatus() == DownloadStatus.SUCCESSFUL) {
-                        totalSize += adrs[j].getSize();
+                    } else if (adr.getDownloadStatus() == DownloadStatus.SUCCESSFUL) {
+                        totalSize += adr.getSize();
                     }
                 }
                 // update concerned reports
-                String[] dconfs = dependencies[i].getRootModuleConfigurations();
-                for (int j = 0; j < dconfs.length; j++) {
+                for (String dconf : dependency.getRootModuleConfigurations()) {
                     // the report itself is responsible to take into account only
                     // artifacts required in its corresponding configuration
                     // (as described by the Dependency object)
-                    if (dependencies[i].isEvicted(dconfs[j])
-                            || dependencies[i].isBlacklisted(dconfs[j])) {
-                        report.getConfigurationReport(dconfs[j]).addDependency(dependencies[i]);
+                    if (dependency.isEvicted(dconf)
+                            || dependency.isBlacklisted(dconf)) {
+                        report.getConfigurationReport(dconf).addDependency(dependency);
                     } else {
-                        report.getConfigurationReport(dconfs[j]).addDependency(dependencies[i],
-                            dReport);
+                        report.getConfigurationReport(dconf).addDependency(dependency,
+                                dReport);
                     }
                 }
             }
@@ -554,15 +550,15 @@ public class ResolveEngine {
             throw new NullPointerException("module descriptor must not be null");
         }
         String[] confs = options.getConfs(md);
-        Collection<String> missingConfs = new ArrayList<String>();
-        for (int i = 0; i < confs.length; i++) {
-            if (confs[i] == null) {
+        Collection<String> missingConfs = new ArrayList<>();
+        for (String conf : confs) {
+            if (conf == null) {
                 throw new NullPointerException("null conf not allowed: confs where: "
                         + Arrays.asList(confs));
             }
 
-            if (md.getConfiguration(confs[i]) == null) {
-                missingConfs.add(" '" + confs[i] + "' ");
+            if (md.getConfiguration(conf) == null) {
+                missingConfs.add(" '" + conf + "' ");
             }
         }
         if (!missingConfs.isEmpty()) {
@@ -583,33 +579,33 @@ public class ResolveEngine {
             }
             IvyNode rootNode = new IvyNode(data, md);
 
-            for (int i = 0; i < confs.length; i++) {
-                Message.verbose("resolving dependencies for configuration '" + confs[i] + "'");
+            for (String conf : confs) {
+                Message.verbose("resolving dependencies for configuration '" + conf + "'");
                 // for each configuration we clear the cache of what's been fetched
                 fetchedSet.clear();
 
                 ConfigurationResolveReport confReport = null;
                 if (report != null) {
-                    confReport = report.getConfigurationReport(confs[i]);
+                    confReport = report.getConfigurationReport(conf);
                     if (confReport == null) {
-                        confReport = new ConfigurationResolveReport(this, md, confs[i], reportDate,
+                        confReport = new ConfigurationResolveReport(this, md, conf, reportDate,
                                 options);
-                        report.addReport(confs[i], confReport);
+                        report.addReport(conf, confReport);
                     }
                 }
                 // we reuse the same resolve data with a new report for each conf
                 data.setReport(confReport);
 
                 // update the root module conf we are about to fetch
-                VisitNode root = new VisitNode(data, rootNode, null, confs[i], null);
-                root.setRequestedConf(confs[i]);
-                rootNode.updateConfsToFetch(Collections.singleton(confs[i]));
+                VisitNode root = new VisitNode(data, rootNode, null, conf, null);
+                root.setRequestedConf(conf);
+                rootNode.updateConfsToFetch(Collections.singleton(conf));
 
                 // go fetch !
                 boolean fetched = false;
                 while (!fetched) {
                     try {
-                        fetchDependencies(root, confs[i], false);
+                        fetchDependencies(root, conf, false);
                         fetched = true;
                     } catch (RestartResolveProcess restart) {
                         Message.verbose("====================================================");
@@ -629,7 +625,7 @@ public class ResolveEngine {
             // prune and reverse sort fetched dependencies
             Collection<IvyNode> nodes = data.getNodes();
             // use a Set to avoid duplicates, linked to preserve order
-            Collection<IvyNode> dependencies = new LinkedHashSet<IvyNode>(nodes.size());
+            Collection<IvyNode> dependencies = new LinkedHashSet<>(nodes.size());
             for (IvyNode node : nodes) {
                 if (node != null && !node.isRoot() && !node.isCompletelyBlacklisted()) {
                     dependencies.add(node);
@@ -655,26 +651,26 @@ public class ResolveEngine {
         // can traverse the list and check only the direct parent and not all the ancestors
         for (IvyNode node : sortedDependencies) {
             if (!node.isCompletelyEvicted()) {
-                for (int i = 0; i < confs.length; i++) {
-                    IvyNodeCallers.Caller[] callers = node.getCallers(confs[i]);
+                for (String conf : confs) {
+                    IvyNodeCallers.Caller[] callers = node.getCallers(conf);
                     if (settings.debugConflictResolution()) {
                         Message.debug("checking if " + node.getId()
-                                + " is transitively evicted in " + confs[i]);
+                                + " is transitively evicted in " + conf);
                     }
                     boolean allEvicted = callers.length > 0;
-                    for (int j = 0; j < callers.length; j++) {
-                        if (callers[j].getModuleRevisionId().equals(md.getModuleRevisionId())) {
+                    for (IvyNodeCallers.Caller caller : callers) {
+                        if (caller.getModuleRevisionId().equals(md.getModuleRevisionId())) {
                             // the caller is the root module itself, it can't be evicted
                             allEvicted = false;
                             break;
                         } else {
-                            IvyNode callerNode = data.getNode(callers[j].getModuleRevisionId());
+                            IvyNode callerNode = data.getNode(caller.getModuleRevisionId());
                             if (callerNode == null) {
                                 Message.warn("ivy internal error: no node found for "
-                                        + callers[j].getModuleRevisionId() + ": looked in "
+                                        + caller.getModuleRevisionId() + ": looked in "
                                         + data.getNodeIds() + " and root module id was "
                                         + md.getModuleRevisionId());
-                            } else if (!callerNode.isEvicted(confs[i])) {
+                            } else if (!callerNode.isEvicted(conf)) {
                                 allEvicted = false;
                                 break;
                             } else {
@@ -687,7 +683,7 @@ public class ResolveEngine {
                     }
                     if (allEvicted) {
                         Message.verbose("all callers are evicted for " + node + ": evicting too");
-                        node.markEvicted(confs[i], null, null, null);
+                        node.markEvicted(conf, null, null, null);
                     } else {
                         if (settings.debugConflictResolution()) {
                             Message.debug(node.getId()
@@ -715,9 +711,8 @@ public class ResolveEngine {
         data.setCurrentVisitNode(node);
         DependencyDescriptor dd = node.getDependencyDescriptor();
         VersionMatcher versionMatcher = node.getNode().getData().getSettings().getVersionMatcher();
-        if (dd != null
-                && !(node.getRoot() == node.getParent() && versionMatcher.isDynamic(dd
-                        .getDependencyRevisionId()))) {
+        if (dd != null && !(node.getRoot() == node.getParent()
+                && versionMatcher.isDynamic(dd.getDependencyRevisionId()))) {
             /*
              * we don't resolve conflicts before loading data for direct dependencies on dynamic
              * revisions, so that direct dynamic revisions are always resolved, which is mandatory
@@ -732,18 +727,16 @@ public class ResolveEngine {
             // dependency to take the decision
             resolveConflict(node, conf);
             if (!node.isEvicted() && !node.isCircular()) {
-                String[] confs = node.getRealConfs(conf);
-                for (int i = 0; i < confs.length; i++) {
-                    doFetchDependencies(node, confs[i]);
+                for (String rconf : node.getRealConfs(conf)) {
+                    doFetchDependencies(node, rconf);
                 }
             }
         } else if (!node.hasProblem()) {
             // the node has not been loaded but hasn't problem: it was already loaded
             // => we just have to update its dependencies data
             if (!node.isEvicted() && !node.isCircular()) {
-                String[] confs = node.getRealConfs(conf);
-                for (int i = 0; i < confs.length; i++) {
-                    doFetchDependencies(node, confs[i]);
+                for (String rconf : node.getRealConfs(conf)) {
+                    doFetchDependencies(node, rconf);
                 }
             }
         }
@@ -797,31 +790,28 @@ public class ResolveEngine {
         if (extendedConfs.length > 0) {
             node.updateConfsToFetch(Arrays.asList(extendedConfs));
         }
-        for (int i = 0; i < extendedConfs.length; i++) {
-            fetchDependencies(node, extendedConfs[i], false);
+        for (String extendedConf : extendedConfs) {
+            fetchDependencies(node, extendedConf, false);
         }
 
         // now we can actually resolve this configuration dependencies
         if (!isDependenciesFetched(node.getNode(), conf) && node.isTransitive()) {
-            Collection<VisitNode> dependencies = node.getDependencies(conf);
-            for (VisitNode dep : dependencies) {
+            for (VisitNode dep : node.getDependencies(conf)) {
                 dep.useRealNode(); // the node may have been resolved to another real one while
                 // resolving other deps
-                String[] confs = dep.getRequiredConfigurations(node, conf);
-                for (int i = 0; i < confs.length; i++) {
-                    fetchDependencies(dep, confs[i], true);
+                for (String rconf : dep.getRequiredConfigurations(node, conf)) {
+                    fetchDependencies(dep, rconf, true);
                 }
                 if (!dep.isEvicted() && !dep.hasProblem()) {
                     // if there are still confs to fetch (usually because they have
                     // been updated when evicting another module), we fetch them now
-                    confs = dep.getConfsToFetch();
-                    for (int i = 0; i < confs.length; i++) {
+                    for (String fconf : dep.getConfsToFetch()) {
                         // shouldBeFixed=false to because some of those dependencies might
                         // be private when they were actually extending public conf.
                         // Should we keep two list of confs to fetch (private&public)?
                         // I don't think, visibility is already checked, and a change in the
                         // configuration between version might anyway have worse problems.
-                        fetchDependencies(dep, confs[i], false);
+                        fetchDependencies(dep, fconf, false);
                     }
                 }
             }
@@ -982,8 +972,8 @@ public class ResolveEngine {
             ancestor.getNode().setResolvedNodes(node.getModuleId(), node.getRootModuleConf(),
                 resolved);
 
-            Collection<IvyNode> evicted = new HashSet<IvyNode>(ancestor.getNode().getEvictedNodes(
-                node.getModuleId(), node.getRootModuleConf()));
+            Collection<IvyNode> evicted = new HashSet<>(ancestor.getNode().getEvictedNodes(
+                    node.getModuleId(), node.getRootModuleConf()));
             evicted.removeAll(resolved);
             evicted.addAll(toevict);
             ancestor.getNode().setEvictedNodes(node.getModuleId(), node.getRootModuleConf(),
@@ -1003,8 +993,8 @@ public class ResolveEngine {
 
             // it's time to update parent resolved and evicted with what was found
 
-            Collection<IvyNode> evicted = new HashSet<IvyNode>(ancestor.getNode().getEvictedNodes(
-                node.getModuleId(), node.getRootModuleConf()));
+            Collection<IvyNode> evicted = new HashSet<>(ancestor.getNode().getEvictedNodes(
+                    node.getModuleId(), node.getRootModuleConf()));
             toevict.removeAll(resolved);
             evicted.removeAll(resolved);
             evicted.addAll(toevict);
@@ -1091,7 +1081,7 @@ public class ResolveEngine {
      */
     private Collection<IvyNode> computeConflicts(VisitNode node, VisitNode ancestor, String conf,
             Collection<IvyNode> toevict, Collection<IvyNode> selectedNodes) {
-        Collection<IvyNode> conflicts = new LinkedHashSet<IvyNode>();
+        Collection<IvyNode> conflicts = new LinkedHashSet<>();
         conflicts.add(node.getNode());
         /*
          * We first try to remove all evicted nodes from the collection of selected nodes to update

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/resolve/ResolveOptions.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/resolve/ResolveOptions.java b/src/java/org/apache/ivy/core/resolve/ResolveOptions.java
index b434c05..77c5ee1 100644
--- a/src/java/org/apache/ivy/core/resolve/ResolveOptions.java
+++ b/src/java/org/apache/ivy/core/resolve/ResolveOptions.java
@@ -175,12 +175,7 @@ public class ResolveOptions extends LogOptions {
      * @see #getConfs(ModuleDescriptor)
      */
     public boolean useSpecialConfs() {
-        for (int i = 0; confs != null && i < confs.length; i++) {
-            if (confs[0].startsWith("*")) {
-                return true;
-            }
-        }
-        return false;
+        return confs != null && confs[0].startsWith("*");
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/resolve/VisitData.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/resolve/VisitData.java b/src/java/org/apache/ivy/core/resolve/VisitData.java
index 3beb877..fa66858 100644
--- a/src/java/org/apache/ivy/core/resolve/VisitData.java
+++ b/src/java/org/apache/ivy/core/resolve/VisitData.java
@@ -38,7 +38,7 @@ public class VisitData {
      * The associated visit nodes, per rootModuleConf Note that the value is a List, because a node
      * can be visited from several parents during the resolution process
      */
-    private Map<String, List<VisitNode>> visitNodes = new HashMap<String, List<VisitNode>>();
+    private Map<String, List<VisitNode>> visitNodes = new HashMap<>();
 
     public VisitData(IvyNode node) {
         this.node = node;
@@ -52,7 +52,7 @@ public class VisitData {
     public List<VisitNode> getVisitNodes(String rootModuleConf) {
         List<VisitNode> visits = visitNodes.get(rootModuleConf);
         if (visits == null) {
-            visits = new ArrayList<VisitNode>();
+            visits = new ArrayList<>();
             visitNodes.put(rootModuleConf, visits);
         }
         return visits;

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/resolve/VisitNode.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/resolve/VisitNode.java b/src/java/org/apache/ivy/core/resolve/VisitNode.java
index b5171b9..39497f1 100644
--- a/src/java/org/apache/ivy/core/resolve/VisitNode.java
+++ b/src/java/org/apache/ivy/core/resolve/VisitNode.java
@@ -164,7 +164,7 @@ public class VisitNode {
 
     private Collection<VisitNode> computePath() {
         if (parent != null) {
-            Collection<VisitNode> p = new LinkedHashSet<VisitNode>(parent.getPath());
+            Collection<VisitNode> p = new LinkedHashSet<>(parent.getPath());
             p.add(this);
             return p;
         } else {
@@ -196,7 +196,7 @@ public class VisitNode {
 
     public static VisitNode getRoot(VisitNode parent) {
         VisitNode root = parent;
-        Collection<VisitNode> path = new HashSet<VisitNode>();
+        Collection<VisitNode> path = new HashSet<>();
         path.add(root);
         while (root.getParent() != null && !root.getNode().isRoot()) {
             if (path.contains(root.getParent())) {
@@ -303,7 +303,7 @@ public class VisitNode {
 
     public Collection<VisitNode> getDependencies(String conf) {
         Collection<IvyNode> deps = node.getDependencies(rootModuleConf, conf, requestedConf);
-        Collection<VisitNode> ret = new ArrayList<VisitNode>(deps.size());
+        Collection<VisitNode> ret = new ArrayList<>(deps.size());
         for (IvyNode depNode : deps) {
             ret.add(traverseChild(conf, depNode));
         }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java b/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java
index 4822e89..9fcf80a 100644
--- a/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java
+++ b/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java
@@ -128,15 +128,15 @@ public class RetrieveEngine {
             report.setRetrieveRoot(fileRetrieveRoot);
             File ivyRetrieveRoot = destIvyPattern == null ? null : settings
                     .resolveFile(IvyPatternHelper.getTokenRoot(destIvyPattern));
-            Collection<File> targetArtifactsStructure = new HashSet<File>();
+            Collection<File> targetArtifactsStructure = new HashSet<>();
             // Set(File) set of all paths which should be present at then end of retrieve (useful
             // for sync)
-            Collection<File> targetIvysStructure = new HashSet<File>(); // same for ivy files
+            Collection<File> targetIvysStructure = new HashSet<>(); // same for ivy files
 
             if (options.isMakeSymlinksInMass()) {
                 // The HashMap is of "destToSrc" because src could go two places, but dest can only
                 // come from one
-                destToSrcMap = new HashMap<File, File>();
+                destToSrcMap = new HashMap<>();
             }
 
             // do retrieve
@@ -217,15 +217,13 @@ public class RetrieveEngine {
                 Collection<String> ignoreList = Arrays.asList(ignorableFilenames);
 
                 Collection<File> existingArtifacts = FileUtil.listAll(fileRetrieveRoot, ignoreList);
-                Collection<File> existingIvys = ivyRetrieveRoot == null ? null : FileUtil.listAll(
+                Collection<File> existingIvys = (ivyRetrieveRoot == null) ? null : FileUtil.listAll(
                     ivyRetrieveRoot, ignoreList);
 
                 if (fileRetrieveRoot.equals(ivyRetrieveRoot)) {
-                    Collection<File> target = targetArtifactsStructure;
-                    target.addAll(targetIvysStructure);
-                    Collection<File> existing = existingArtifacts;
-                    existing.addAll(existingIvys);
-                    sync(target, existing);
+                    targetArtifactsStructure.addAll(targetIvysStructure);
+                    existingArtifacts.addAll(existingIvys);
+                    sync(targetArtifactsStructure, existingArtifacts);
                 } else {
                     sync(targetArtifactsStructure, existingArtifacts);
                     if (existingIvys != null) {
@@ -269,9 +267,7 @@ public class RetrieveEngine {
             } catch (IOException e) {
                 throw e;
             } catch (Exception e) {
-                IOException ioex = new IOException(e.getMessage());
-                ioex.initCause(e);
-                throw ioex;
+                throw new IOException(e.getMessage(), e);
             }
         }
         return confs;
@@ -282,7 +278,7 @@ public class RetrieveEngine {
     }
 
     private void sync(Collection<File> target, Collection<File> existing) {
-        Collection<File> toRemove = new HashSet<File>();
+        Collection<File> toRemove = new HashSet<>();
         for (File file : existing) {
             toRemove.add(file.getAbsoluteFile());
         }
@@ -313,28 +309,25 @@ public class RetrieveEngine {
         // find what we must retrieve where
 
         // ArtifactDownloadReport source -> Set (String copyDestAbsolutePath)
-        final Map<ArtifactDownloadReport, Set<String>> artifactsToCopy = new HashMap<ArtifactDownloadReport, Set<String>>();
+        final Map<ArtifactDownloadReport, Set<String>> artifactsToCopy = new HashMap<>();
         // String copyDestAbsolutePath -> Set (ArtifactRevisionId source)
-        final Map<String, Set<ArtifactRevisionId>> conflictsMap = new HashMap<String, Set<ArtifactRevisionId>>();
+        final Map<String, Set<ArtifactRevisionId>> conflictsMap = new HashMap<>();
         // String copyDestAbsolutePath -> Set (ArtifactDownloadReport source)
-        final Map<String, Set<ArtifactDownloadReport>> conflictsReportsMap = new HashMap<String, Set<ArtifactDownloadReport>>();
+        final Map<String, Set<ArtifactDownloadReport>> conflictsReportsMap = new HashMap<>();
         // String copyDestAbsolutePath -> Set (String conf)
-        final Map<String, Set<String>> conflictsConfMap = new HashMap<String, Set<String>>();
+        final Map<String, Set<String>> conflictsConfMap = new HashMap<>();
 
         XmlReportParser parser = new XmlReportParser();
-        for (int i = 0; i < confs.length; i++) {
-            final String conf = confs[i];
-
+        for (final String conf : confs) {
             File report = cacheManager.getConfigurationResolveReportInCache(options.getResolveId(),
                 conf);
             parser.parse(report);
 
-            Collection<ArtifactDownloadReport> artifacts = new ArrayList<ArtifactDownloadReport>(
+            Collection<ArtifactDownloadReport> artifacts = new ArrayList<>(
                     Arrays.asList(parser.getArtifactReports()));
             if (destIvyPattern != null) {
-                ModuleRevisionId[] mrids = parser.getRealDependencyRevisionIds();
-                for (int j = 0; j < mrids.length; j++) {
-                    artifacts.add(parser.getMetadataArtifactReport(mrids[j]));
+                for (ModuleRevisionId rmrid : parser.getRealDependencyRevisionIds()) {
+                    artifacts.add(parser.getMetadataArtifactReport(rmrid));
                 }
             }
             final PackagingManager packagingManager = new PackagingManager();
@@ -356,8 +349,8 @@ public class RetrieveEngine {
                         unpackedArtifact = packagingManager.getUnpackedArtifact(artifact);
                     }
                     if (unpackedArtifact == null) {
-                        throw new RuntimeException("Could not determine unpacked artifact for " + artifact +
-                                " while determining artifacts to copy for module " + mrid);
+                        throw new RuntimeException("Could not determine unpacked artifact for " + artifact
+                                + " while determining artifacts to copy for module " + mrid);
                     }
                     ext = unpackedArtifact.getExt();
                 }
@@ -377,7 +370,7 @@ public class RetrieveEngine {
                     artifact.getQualifiedExtraAttributes());
                 Set<String> dest = artifactsToCopy.get(adr);
                 if (dest == null) {
-                    dest = new HashSet<String>();
+                    dest = new HashSet<>();
                     artifactsToCopy.put(adr, dest);
                 }
                 String copyDest = settings.resolveFile(destFileName).getAbsolutePath();
@@ -387,24 +380,24 @@ public class RetrieveEngine {
                     destinations = options.getMapper().mapFileName(copyDest);
                 }
 
-                for (int j = 0; j < destinations.length; j++) {
-                    dest.add(destinations[j]);
+                for (String destination : destinations) {
+                    dest.add(destination);
 
-                    Set<ArtifactRevisionId> conflicts = conflictsMap.get(destinations[j]);
+                    Set<ArtifactRevisionId> conflicts = conflictsMap.get(destination);
                     Set<ArtifactDownloadReport> conflictsReports = conflictsReportsMap
-                            .get(destinations[j]);
-                    Set<String> conflictsConf = conflictsConfMap.get(destinations[j]);
+                            .get(destination);
+                    Set<String> conflictsConf = conflictsConfMap.get(destination);
                     if (conflicts == null) {
-                        conflicts = new HashSet<ArtifactRevisionId>();
-                        conflictsMap.put(destinations[j], conflicts);
+                        conflicts = new HashSet<>();
+                        conflictsMap.put(destination, conflicts);
                     }
                     if (conflictsReports == null) {
-                        conflictsReports = new HashSet<ArtifactDownloadReport>();
-                        conflictsReportsMap.put(destinations[j], conflictsReports);
+                        conflictsReports = new HashSet<>();
+                        conflictsReportsMap.put(destination, conflictsReports);
                     }
                     if (conflictsConf == null) {
-                        conflictsConf = new HashSet<String>();
-                        conflictsConfMap.put(destinations[j], conflictsConf);
+                        conflictsConf = new HashSet<>();
+                        conflictsConfMap.put(destination, conflictsConf);
                     }
                     if (conflicts.add(artifact.getId())) {
                         conflictsReports.add(adr);
@@ -420,7 +413,7 @@ public class RetrieveEngine {
             Set<ArtifactRevisionId> artifacts = entry.getValue();
             Set<String> conflictsConfs = conflictsConfMap.get(copyDest);
             if (artifacts.size() > 1) {
-                List<ArtifactDownloadReport> artifactsList = new ArrayList<ArtifactDownloadReport>(
+                List<ArtifactDownloadReport> artifactsList = new ArrayList<>(
                         conflictsReportsMap.get(copyDest));
                 // conflicts battle is resolved by a sort using a conflict resolving policy
                 // comparator which consider as greater a winning artifact

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/retrieve/RetrieveOptions.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/retrieve/RetrieveOptions.java b/src/java/org/apache/ivy/core/retrieve/RetrieveOptions.java
index 7f27d56..6fa2399 100644
--- a/src/java/org/apache/ivy/core/retrieve/RetrieveOptions.java
+++ b/src/java/org/apache/ivy/core/retrieve/RetrieveOptions.java
@@ -18,6 +18,7 @@
 package org.apache.ivy.core.retrieve;
 
 import org.apache.ivy.core.LogOptions;
+import org.apache.ivy.core.module.descriptor.Artifact;
 import org.apache.ivy.util.filter.Filter;
 import org.apache.ivy.util.filter.FilterHelper;
 
@@ -55,7 +56,7 @@ public class RetrieveOptions extends LogOptions {
     /**
      * The filter to apply before retrieving artifacts.
      */
-    private Filter artifactFilter = FilterHelper.NO_FILTER;
+    private Filter<Artifact> artifactFilter = FilterHelper.NO_FILTER;
 
     /**
      * True if a synchronisation of the destination directory should be done, false if a simple copy
@@ -117,11 +118,11 @@ public class RetrieveOptions extends LogOptions {
         return this;
     }
 
-    public Filter getArtifactFilter() {
+    public Filter<Artifact> getArtifactFilter() {
         return artifactFilter;
     }
 
-    public RetrieveOptions setArtifactFilter(Filter artifactFilter) {
+    public RetrieveOptions setArtifactFilter(Filter<Artifact> artifactFilter) {
         this.artifactFilter = artifactFilter;
         return this;
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/retrieve/RetrieveReport.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/retrieve/RetrieveReport.java b/src/java/org/apache/ivy/core/retrieve/RetrieveReport.java
index 6dcb9fd..256678c 100644
--- a/src/java/org/apache/ivy/core/retrieve/RetrieveReport.java
+++ b/src/java/org/apache/ivy/core/retrieve/RetrieveReport.java
@@ -28,11 +28,11 @@ import org.apache.ivy.core.report.ArtifactDownloadReport;
 
 public class RetrieveReport {
 
-    private Collection<File> upToDateFiles = new HashSet<File>();
+    private Collection<File> upToDateFiles = new HashSet<>();
 
-    private Collection<File> copiedFiles = new HashSet<File>();
+    private Collection<File> copiedFiles = new HashSet<>();
 
-    private Map<File, ArtifactDownloadReport> downloadReport = new HashMap<File, ArtifactDownloadReport>();
+    private Map<File, ArtifactDownloadReport> downloadReport = new HashMap<>();
 
     private File retrieveRoot;
 
@@ -74,7 +74,7 @@ public class RetrieveReport {
      * @return Collection&lt;File&gt;
      */
     public Collection<File> getCopiedFiles() {
-        return new ArrayList<File>(copiedFiles);
+        return new ArrayList<>(copiedFiles);
     }
 
     /**
@@ -84,7 +84,7 @@ public class RetrieveReport {
      * @return Collection&lt;File&gt;
      */
     public Collection<File> getUpToDateFiles() {
-        return new ArrayList<File>(upToDateFiles);
+        return new ArrayList<>(upToDateFiles);
     }
 
     /**
@@ -94,7 +94,7 @@ public class RetrieveReport {
      * @return Collection&lt;File&gt;
      */
     public Collection<File> getRetrievedFiles() {
-        Collection<File> result = new ArrayList<File>(upToDateFiles.size() + copiedFiles.size());
+        Collection<File> result = new ArrayList<>(upToDateFiles.size() + copiedFiles.size());
         result.addAll(upToDateFiles);
         result.addAll(copiedFiles);
         return result;


[3/7] ant-ivy git commit: Add generics and Java 7 syntax to core

Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/search/SearchEngine.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/search/SearchEngine.java b/src/java/org/apache/ivy/core/search/SearchEngine.java
index 3fde263..9a508cd 100644
--- a/src/java/org/apache/ivy/core/search/SearchEngine.java
+++ b/src/java/org/apache/ivy/core/search/SearchEngine.java
@@ -57,13 +57,13 @@ public class SearchEngine {
      * @return String[]
      */
     public String[] listTokenValues(String token, Map<String, Object> otherTokenValues) {
-        Set<String> entries = new LinkedHashSet<String>();
+        Set<String> entries = new LinkedHashSet<>();
 
         for (DependencyResolver resolver : settings.getResolvers()) {
             Map<String, String>[] values = resolver.listTokenValues(new String[] {token},
                 otherTokenValues);
-            for (int i = 0; i < values.length; i++) {
-                entries.add(values[i].get(token));
+            for (Map<String, String> value : values) {
+                entries.add(value.get(token));
             }
         }
 
@@ -71,13 +71,13 @@ public class SearchEngine {
     }
 
     public OrganisationEntry[] listOrganisationEntries() {
-        Set<OrganisationEntry> entries = new HashSet<OrganisationEntry>();
+        Set<OrganisationEntry> entries = new HashSet<>();
 
         for (DependencyResolver resolver : settings.getResolvers()) {
             Map<String, String>[] orgs = resolver.listTokenValues(
                 new String[] {IvyPatternHelper.ORGANISATION_KEY}, new HashMap<String, Object>());
-            for (int i = 0; i < orgs.length; i++) {
-                String org = orgs[i].get(IvyPatternHelper.ORGANISATION_KEY);
+            for (Map<String, String> oe : orgs) {
+                String org = oe.get(IvyPatternHelper.ORGANISATION_KEY);
                 entries.add(new OrganisationEntry(resolver, org));
             }
         }
@@ -86,13 +86,13 @@ public class SearchEngine {
     }
 
     public String[] listOrganisations() {
-        Set<String> entries = new HashSet<String>();
+        Set<String> entries = new HashSet<>();
 
         for (DependencyResolver resolver : settings.getResolvers()) {
             Map<String, String>[] orgs = resolver.listTokenValues(
                 new String[] {IvyPatternHelper.ORGANISATION_KEY}, new HashMap<String, Object>());
-            for (int i = 0; i < orgs.length; i++) {
-                entries.add(orgs[i].get(IvyPatternHelper.ORGANISATION_KEY));
+            for (Map<String, String> org : orgs) {
+                entries.add(org.get(IvyPatternHelper.ORGANISATION_KEY));
             }
         }
 
@@ -100,16 +100,16 @@ public class SearchEngine {
     }
 
     public ModuleEntry[] listModuleEntries(OrganisationEntry org) {
-        Set<ModuleEntry> entries = new HashSet<ModuleEntry>();
+        Set<ModuleEntry> entries = new HashSet<>();
 
-        Map<String, Object> tokenValues = new HashMap<String, Object>();
+        Map<String, Object> tokenValues = new HashMap<>();
         tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, org.getOrganisation());
 
         for (DependencyResolver resolver : settings.getResolvers()) {
             Map<String, String>[] modules = resolver.listTokenValues(
                 new String[] {IvyPatternHelper.MODULE_KEY}, tokenValues);
-            for (int i = 0; i < modules.length; i++) {
-                String module = modules[i].get(IvyPatternHelper.MODULE_KEY);
+            for (Map<String, String> me : modules) {
+                String module = me.get(IvyPatternHelper.MODULE_KEY);
                 entries.add(new ModuleEntry(org, module));
             }
         }
@@ -118,16 +118,16 @@ public class SearchEngine {
     }
 
     public String[] listModules(String org) {
-        Set<String> entries = new HashSet<String>();
+        Set<String> entries = new HashSet<>();
 
-        Map<String, Object> tokenValues = new HashMap<String, Object>();
+        Map<String, Object> tokenValues = new HashMap<>();
         tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, org);
 
         for (DependencyResolver resolver : settings.getResolvers()) {
             Map<String, String>[] modules = resolver.listTokenValues(
                 new String[] {IvyPatternHelper.MODULE_KEY}, tokenValues);
-            for (int i = 0; i < modules.length; i++) {
-                entries.add(modules[i].get(IvyPatternHelper.MODULE_KEY));
+            for (Map<String, String> module : modules) {
+                entries.add(module.get(IvyPatternHelper.MODULE_KEY));
             }
         }
 
@@ -135,18 +135,17 @@ public class SearchEngine {
     }
 
     public RevisionEntry[] listRevisionEntries(ModuleEntry module) {
-        Set<RevisionEntry> entries = new HashSet<RevisionEntry>();
+        Set<RevisionEntry> entries = new HashSet<>();
 
-        Map<String, Object> tokenValues = new HashMap<String, Object>();
+        Map<String, Object> tokenValues = new HashMap<>();
         tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, module.getOrganisation());
         tokenValues.put(IvyPatternHelper.MODULE_KEY, module.getModule());
 
         for (DependencyResolver resolver : settings.getResolvers()) {
             Map<String, String>[] revisions = resolver.listTokenValues(
                 new String[] {IvyPatternHelper.REVISION_KEY}, tokenValues);
-            for (int i = 0; i < revisions.length; i++) {
-                String revision = revisions[i].get(IvyPatternHelper.REVISION_KEY);
-                entries.add(new RevisionEntry(module, revision));
+            for (Map<String, String> revision : revisions) {
+                entries.add(new RevisionEntry(module, revision.get(IvyPatternHelper.REVISION_KEY)));
             }
         }
 
@@ -154,17 +153,17 @@ public class SearchEngine {
     }
 
     public String[] listRevisions(String org, String module) {
-        Set<String> entries = new HashSet<String>();
+        Set<String> entries = new HashSet<>();
 
-        Map<String, Object> tokenValues = new HashMap<String, Object>();
+        Map<String, Object> tokenValues = new HashMap<>();
         tokenValues.put(IvyPatternHelper.ORGANISATION_KEY, org);
         tokenValues.put(IvyPatternHelper.MODULE_KEY, module);
 
         for (DependencyResolver resolver : settings.getResolvers()) {
             Map<String, String>[] revisions = resolver.listTokenValues(
                 new String[] {IvyPatternHelper.REVISION_KEY}, tokenValues);
-            for (int i = 0; i < revisions.length; i++) {
-                entries.add(revisions[i].get(IvyPatternHelper.REVISION_KEY));
+            for (Map<String, String> revision : revisions) {
+                entries.add(revision.get(IvyPatternHelper.REVISION_KEY));
             }
         }
 
@@ -183,9 +182,9 @@ public class SearchEngine {
      * @return ModuleId[]
      */
     public ModuleId[] listModules(ModuleId moduleCrit, PatternMatcher matcher) {
-        List<ModuleId> ret = new ArrayList<ModuleId>();
+        List<ModuleId> ret = new ArrayList<>();
 
-        Map<String, Object> criteria = new HashMap<String, Object>();
+        Map<String, Object> criteria = new HashMap<>();
         addMatcher(matcher, moduleCrit.getOrganisation(), criteria,
             IvyPatternHelper.ORGANISATION_KEY);
         addMatcher(matcher, moduleCrit.getName(), criteria, IvyPatternHelper.MODULE_KEY);
@@ -195,9 +194,9 @@ public class SearchEngine {
 
         for (DependencyResolver resolver : settings.getResolvers()) {
             Map<String, String>[] moduleIdAsMap = resolver.listTokenValues(tokensToList, criteria);
-            for (int i = 0; i < moduleIdAsMap.length; i++) {
-                String org = moduleIdAsMap[i].get(IvyPatternHelper.ORGANISATION_KEY);
-                String name = moduleIdAsMap[i].get(IvyPatternHelper.MODULE_KEY);
+            for (Map<String, String> moduleId : moduleIdAsMap) {
+                String org = moduleId.get(IvyPatternHelper.ORGANISATION_KEY);
+                String name = moduleId.get(IvyPatternHelper.MODULE_KEY);
                 ModuleId modId = ModuleId.newInstance(org, name);
                 ret.add(NameSpaceHelper.transform(modId, resolver.getNamespace()
                         .getToSystemTransformer()));
@@ -219,9 +218,9 @@ public class SearchEngine {
      * @return ModuleRevisionId[]
      */
     public ModuleRevisionId[] listModules(ModuleRevisionId moduleCrit, PatternMatcher matcher) {
-        List<ModuleRevisionId> ret = new ArrayList<ModuleRevisionId>();
+        List<ModuleRevisionId> ret = new ArrayList<>();
 
-        Map<String, Object> criteria = new HashMap<String, Object>();
+        Map<String, Object> criteria = new HashMap<>();
         for (Entry<String, String> entry : moduleCrit.getAttributes().entrySet()) {
             addMatcher(matcher, entry.getValue(), criteria, entry.getKey());
         }
@@ -231,21 +230,20 @@ public class SearchEngine {
 
         for (DependencyResolver resolver : settings.getResolvers()) {
             Map<String, String>[] moduleIdAsMap = resolver.listTokenValues(tokensToList, criteria);
-            for (int i = 0; i < moduleIdAsMap.length; i++) {
-                String org = moduleIdAsMap[i].get(IvyPatternHelper.ORGANISATION_KEY);
-                String name = moduleIdAsMap[i].get(IvyPatternHelper.MODULE_KEY);
-                String branch = moduleIdAsMap[i].get(IvyPatternHelper.BRANCH_KEY);
-                String rev = moduleIdAsMap[i].get(IvyPatternHelper.REVISION_KEY);
-
-                Map<String, String> foundExtraAtts = new HashMap<String, String>();
-                Set<String> qualAttributes = moduleCrit.getQualifiedExtraAttributes().keySet();
-                for (String qualifiedKey : qualAttributes) {
+            for (Map<String, String> moduleId : moduleIdAsMap) {
+                String org = moduleId.get(IvyPatternHelper.ORGANISATION_KEY);
+                String name = moduleId.get(IvyPatternHelper.MODULE_KEY);
+                String branch = moduleId.get(IvyPatternHelper.BRANCH_KEY);
+                String rev = moduleId.get(IvyPatternHelper.REVISION_KEY);
+
+                Map<String, String> foundExtraAtts = new HashMap<>();
+                for (String qualifiedKey : moduleCrit.getQualifiedExtraAttributes().keySet()) {
                     String value = null;
                     int colonIndex = qualifiedKey.indexOf(':');
                     if (colonIndex == -1) {
-                        value = moduleIdAsMap[i].get(qualifiedKey);
+                        value = moduleId.get(qualifiedKey);
                     } else {
-                        value = moduleIdAsMap[i].get(qualifiedKey.substring(colonIndex + 1));
+                        value = moduleId.get(qualifiedKey.substring(colonIndex + 1));
                     }
 
                     if (value != null) {
@@ -278,7 +276,7 @@ public class SearchEngine {
      */
     public ModuleRevisionId[] listModules(DependencyResolver resolver, ModuleRevisionId moduleCrit,
             PatternMatcher matcher) {
-        Map<String, Object> criteria = new HashMap<String, Object>();
+        Map<String, Object> criteria = new HashMap<>();
         for (Entry<String, String> entry : moduleCrit.getAttributes().entrySet()) {
             addMatcher(matcher, entry.getValue(), criteria, entry.getKey());
         }
@@ -287,23 +285,21 @@ public class SearchEngine {
                 .toArray(new String[moduleCrit.getAttributes().size()]);
 
         Map<String, String>[] moduleIdAsMap = resolver.listTokenValues(tokensToList, criteria);
-        Set<ModuleRevisionId> result = new LinkedHashSet<ModuleRevisionId>(); // we use a Set to
-                                                                              // remove duplicates
-        for (int i = 0; i < moduleIdAsMap.length; i++) {
-            String org = moduleIdAsMap[i].get(IvyPatternHelper.ORGANISATION_KEY);
-            String name = moduleIdAsMap[i].get(IvyPatternHelper.MODULE_KEY);
-            String branch = moduleIdAsMap[i].get(IvyPatternHelper.BRANCH_KEY);
-            String rev = moduleIdAsMap[i].get(IvyPatternHelper.REVISION_KEY);
-
-            Map<String, String> foundExtraAtts = new HashMap<String, String>();
-            Set<String> qualExtraAttributes = moduleCrit.getQualifiedExtraAttributes().keySet();
-            for (String qualifiedKey : qualExtraAttributes) {
+        Set<ModuleRevisionId> result = new LinkedHashSet<>(); // we use a Set to remove duplicates
+        for (Map<String, String> moduleId : moduleIdAsMap) {
+            String org = moduleId.get(IvyPatternHelper.ORGANISATION_KEY);
+            String name = moduleId.get(IvyPatternHelper.MODULE_KEY);
+            String branch = moduleId.get(IvyPatternHelper.BRANCH_KEY);
+            String rev = moduleId.get(IvyPatternHelper.REVISION_KEY);
+
+            Map<String, String> foundExtraAtts = new HashMap<>();
+            for (String qualifiedKey : moduleCrit.getQualifiedExtraAttributes().keySet()) {
                 String value = null;
                 int colonIndex = qualifiedKey.indexOf(':');
                 if (colonIndex == -1) {
-                    value = moduleIdAsMap[i].get(qualifiedKey);
+                    value = moduleId.get(qualifiedKey);
                 } else {
-                    value = moduleIdAsMap[i].get(qualifiedKey.substring(colonIndex + 1));
+                    value = moduleId.get(qualifiedKey.substring(colonIndex + 1));
                 }
 
                 if (value != null) {
@@ -335,16 +331,16 @@ public class SearchEngine {
 
     public Collection<ModuleRevisionId> findModuleRevisionIds(DependencyResolver resolver,
             ModuleRevisionId pattern, PatternMatcher matcher) {
-        Collection<ModuleRevisionId> mrids = new ArrayList<ModuleRevisionId>();
+        Collection<ModuleRevisionId> mrids = new ArrayList<>();
         String resolverName = resolver.getName();
 
         Message.verbose("looking for modules matching " + pattern + " using " + matcher.getName());
         Namespace fromNamespace = null;
         if (resolver instanceof AbstractResolver) {
-            fromNamespace = ((AbstractResolver) resolver).getNamespace();
+            fromNamespace = resolver.getNamespace();
         }
 
-        Collection<ModuleEntry> modules = new ArrayList<ModuleEntry>();
+        Collection<ModuleEntry> modules = new ArrayList<>();
 
         OrganisationEntry[] orgs = resolver.listOrganisations();
         if (orgs == null || orgs.length == 0) {
@@ -358,13 +354,11 @@ public class SearchEngine {
             modules.addAll(Arrays.asList(resolver.listModules(new OrganisationEntry(resolver, org))));
         } else {
             Matcher orgMatcher = matcher.getMatcher(pattern.getOrganisation());
-            for (int i = 0; i < orgs.length; i++) {
-                String org = orgs[i].getOrganisation();
-                String systemOrg = org;
-                if (fromNamespace != null) {
-                    systemOrg = NameSpaceHelper.transformOrganisation(org,
+            for (OrganisationEntry oe : orgs) {
+                String org = oe.getOrganisation();
+                String systemOrg = (fromNamespace == null) ? org
+                    : NameSpaceHelper.transformOrganisation(org,
                         fromNamespace.getToSystemTransformer());
-                }
                 if (orgMatcher.matches(systemOrg)) {
                     modules.addAll(Arrays.asList(resolver.listModules(new OrganisationEntry(
                             resolver, org))));
@@ -392,9 +386,7 @@ public class SearchEngine {
                         + resolverName);
 
                 boolean foundRevision = false;
-                for (int j = 0; j < rEntries.length; j++) {
-                    RevisionEntry rEntry = rEntries[j];
-
+                for (RevisionEntry rEntry : rEntries) {
                     ModuleRevisionId foundMrid = ModuleRevisionId.newInstance(
                         mEntry.getOrganisation(), mEntry.getModule(), rEntry.getRevision());
                     ModuleRevisionId systemMrid = foundMrid;

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/settings/IvySettings.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/settings/IvySettings.java b/src/java/org/apache/ivy/core/settings/IvySettings.java
index 342079d..adaa188 100644
--- a/src/java/org/apache/ivy/core/settings/IvySettings.java
+++ b/src/java/org/apache/ivy/core/settings/IvySettings.java
@@ -118,9 +118,9 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
         ResolveEngineSettings, RetrieveEngineSettings, RepositoryManagementEngineSettings {
     private static final long INTERRUPT_TIMEOUT = 2000;
 
-    private Map<String, Class<?>> typeDefs = new HashMap<String, Class<?>>();
+    private Map<String, Class<?>> typeDefs = new HashMap<>();
 
-    private Map<String, DependencyResolver> resolversMap = new HashMap<String, DependencyResolver>();
+    private Map<String, DependencyResolver> resolversMap = new HashMap<>();
 
     private DependencyResolver defaultResolver;
 
@@ -134,29 +134,29 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
 
     private boolean checkUpToDate = true;
 
-    private ModuleRules<ModuleSettings> moduleSettings = new ModuleRules<ModuleSettings>();
+    private ModuleRules<ModuleSettings> moduleSettings = new ModuleRules<>();
 
-    private Map<String, ConflictManager> conflictsManager = new HashMap<String, ConflictManager>();
+    private Map<String, ConflictManager> conflictsManager = new HashMap<>();
 
-    private Map<String, LatestStrategy> latestStrategies = new HashMap<String, LatestStrategy>();
+    private Map<String, LatestStrategy> latestStrategies = new HashMap<>();
 
-    private Map<String, LockStrategy> lockStrategies = new HashMap<String, LockStrategy>();
+    private Map<String, LockStrategy> lockStrategies = new HashMap<>();
 
-    private Map<String, Namespace> namespaces = new HashMap<String, Namespace>();
+    private Map<String, Namespace> namespaces = new HashMap<>();
 
-    private Map<String, PatternMatcher> matchers = new HashMap<String, PatternMatcher>();
+    private Map<String, PatternMatcher> matchers = new HashMap<>();
 
-    private Map<String, ReportOutputter> reportOutputters = new HashMap<String, ReportOutputter>();
+    private Map<String, ReportOutputter> reportOutputters = new HashMap<>();
 
-    private Map<String, VersionMatcher> versionMatchers = new HashMap<String, VersionMatcher>();
+    private Map<String, VersionMatcher> versionMatchers = new HashMap<>();
 
-    private Map<String, CircularDependencyStrategy> circularDependencyStrategies = new HashMap<String, CircularDependencyStrategy>();
+    private Map<String, CircularDependencyStrategy> circularDependencyStrategies = new HashMap<>();
 
-    private Map<String, RepositoryCacheManager> repositoryCacheManagers = new HashMap<String, RepositoryCacheManager>();
+    private Map<String, RepositoryCacheManager> repositoryCacheManagers = new HashMap<>();
 
-    private Map<String, SignatureGenerator> signatureGenerators = new HashMap<String, SignatureGenerator>();
+    private Map<String, SignatureGenerator> signatureGenerators = new HashMap<>();
 
-    private List<Trigger> triggers = new ArrayList<Trigger>();
+    private List<Trigger> triggers = new ArrayList<>();
 
     private IvyVariableContainer variableContainer = new IvyVariableContainerImpl();
 
@@ -174,7 +174,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
 
     private ResolutionCacheManager resolutionCacheManager = null;
 
-    private List<String> listingIgnore = new ArrayList<String>();
+    private List<String> listingIgnore = new ArrayList<>();
 
     private boolean repositoriesConfigured;
 
@@ -184,7 +184,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
 
     private File baseDir = new File(".").getAbsoluteFile();
 
-    private List<URL> classpathURLs = new ArrayList<URL>();
+    private List<URL> classpathURLs = new ArrayList<>();
 
     private ClassLoader classloader;
 
@@ -224,16 +224,14 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
 
         String ivyTypeDefs = System.getProperty("ivy.typedef.files");
         if (ivyTypeDefs != null) {
-            String[] files = ivyTypeDefs.split("\\,");
-            for (int i = 0; i < files.length; i++) {
+            for (String file : ivyTypeDefs.split("\\,")) {
                 try {
-                    typeDefs(
-                        new FileInputStream(Checks.checkAbsolute(files[i].trim(),
+                    typeDefs(new FileInputStream(Checks.checkAbsolute(file.trim(),
                             "ivy.typedef.files")), true);
                 } catch (FileNotFoundException e) {
-                    Message.warn("typedefs file not found: " + files[i].trim());
+                    Message.warn("typedefs file not found: " + file.trim());
                 } catch (IOException e) {
-                    Message.warn("problem with typedef file: " + files[i].trim(), e);
+                    Message.warn("problem with typedef file: " + file.trim(), e);
                 }
             }
         } else {
@@ -390,10 +388,8 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
         try {
             new XmlSettingsParser(this).parse(settingsFile.toURI().toURL());
         } catch (MalformedURLException e) {
-            IllegalArgumentException iae = new IllegalArgumentException(
-                    "given file cannot be transformed to url: " + settingsFile);
-            iae.initCause(e);
-            throw iae;
+            throw new IllegalArgumentException(
+                    "given file cannot be transformed to url: " + settingsFile, e);
         }
         setVariable("ivy.default.ivy.user.dir", getDefaultIvyUserDir().getAbsolutePath(), false);
         Message.verbose("settings loaded (" + (System.currentTimeMillis() - start) + "ms)");
@@ -484,10 +480,8 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
             setVariable("ivy.settings.dir.url", new File(settingsFile.getAbsolutePath())
                     .getParentFile().toURI().toURL().toExternalForm());
         } catch (MalformedURLException e) {
-            IllegalArgumentException iae = new IllegalArgumentException(
-                    "given file cannot be transformed to url: " + settingsFile);
-            iae.initCause(e);
-            throw iae;
+            throw new IllegalArgumentException(
+                    "given file cannot be transformed to url: " + settingsFile, e);
         }
     }
 
@@ -633,7 +627,7 @@ public class IvySettings implements SortEngineSettings, PublishEngineSettings, P
      *         substituted by their value
      */
     public synchronized Map<String, String> substitute(Map<String, String> strings) {
-        Map<String, String> substituted = new LinkedHashMap<String, String>();
+        Map<String, String> substituted = new LinkedHashMap<>();
         for (Entry<String, String> entry : strings.entrySet()) {
             substituted.put(entry.getKey(), substitute(entry.getValue()));
         }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java b/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
index 81d0f9a..f245b49 100644
--- a/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
+++ b/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
@@ -29,7 +29,6 @@ import java.text.ParseException;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -64,13 +63,13 @@ public class XmlSettingsParser extends DefaultHandler {
      * propagated to the wrapped instance.
      */
     private static final class IvyVariableContainerWrapper implements IvyVariableContainer {
-        private static final Collection SETTINGS_VARIABLES = Arrays.asList(new String[] {
-                "ivy.settings.dir", "ivy.settings.url", "ivy.settings.file", "ivy.conf.dir",
-                "ivy.conf.url", "ivy.conf.file"});
+        private static final Collection<String> SETTINGS_VARIABLES = Arrays.asList(
+            "ivy.settings.dir", "ivy.settings.url", "ivy.settings.file", "ivy.conf.dir",
+            "ivy.conf.url", "ivy.conf.file");
 
         private final IvyVariableContainer variables;
 
-        private Map localVariables = new HashMap();
+        private Map<String, String> localVariables = new HashMap<>();
 
         private IvyVariableContainerWrapper(IvyVariableContainer variables) {
             this.variables = variables;
@@ -92,7 +91,7 @@ public class XmlSettingsParser extends DefaultHandler {
 
         public String getVariable(String name) {
             if (localVariables.containsKey(name)) {
-                return (String) localVariables.get(name);
+                return localVariables.get(name);
             }
             return variables.getVariable(name);
         }
@@ -104,10 +103,9 @@ public class XmlSettingsParser extends DefaultHandler {
 
     private Configurator configurator;
 
-    private List configuratorTags = Arrays.asList(new String[] {"resolvers", "namespaces",
-            "parsers", "latest-strategies", "conflict-managers", "outputters", "version-matchers",
-            "statuses", "circular-dependency-strategies", "triggers", "lock-strategies", "caches",
-            "signers"});
+    private List<String> configuratorTags = Arrays.asList("resolvers", "namespaces", "parsers",
+        "latest-strategies", "conflict-managers", "outputters", "version-matchers", "statuses",
+        "circular-dependency-strategies", "triggers", "lock-strategies", "caches", "signers");
 
     private IvySettings ivy;
 
@@ -141,10 +139,9 @@ public class XmlSettingsParser extends DefaultHandler {
             }
         });
         // put every type definition from ivy to configurator
-        Map typeDefs = ivy.getTypeDefs();
-        for (Iterator iter = typeDefs.keySet().iterator(); iter.hasNext();) {
-            String name = (String) iter.next();
-            configurator.typeDef(name, (Class) typeDefs.get(name));
+        Map<String, Class<?>> typeDefs = ivy.getTypeDefs();
+        for (String name : typeDefs.keySet()) {
+            configurator.typeDef(name, typeDefs.get(name));
         }
 
         doParse(settings);
@@ -186,7 +183,7 @@ public class XmlSettingsParser extends DefaultHandler {
     public void startElement(String uri, String localName, String qName, Attributes att)
             throws SAXException {
         // we first copy attributes in a Map to be able to modify them
-        Map attributes = new HashMap();
+        Map<String, String> attributes = new HashMap<>();
         for (int i = 0; i < att.getLength(); i++) {
             attributes.put(att.getQName(i), ivy.substitute(att.getValue(i)));
         }
@@ -227,41 +224,35 @@ public class XmlSettingsParser extends DefaultHandler {
                 credentialsStarted(attributes);
             }
         } catch (ParseException ex) {
-            SAXException sax = new SAXException("problem in config file: " + ex.getMessage(), ex);
-            sax.initCause(ex);
-            throw sax;
+            throw new SAXException("problem in config file: " + ex.getMessage(), ex);
         } catch (IOException ex) {
-            SAXException sax = new SAXException("io problem while parsing config file: "
-                    + ex.getMessage(), ex);
-            sax.initCause(ex);
-            throw sax;
+            throw new SAXException("io problem while parsing config file: " + ex.getMessage(), ex);
         }
     }
 
-    private void credentialsStarted(Map attributes) {
-        String realm = (String) attributes.remove("realm");
-        String host = (String) attributes.remove("host");
-        String userName = (String) attributes.remove("username");
-        String passwd = (String) attributes.remove("passwd");
+    private void credentialsStarted(Map<String, String> attributes) {
+        String realm = attributes.remove("realm");
+        String host = attributes.remove("host");
+        String userName = attributes.remove("username");
+        String passwd = attributes.remove("passwd");
         CredentialsStore.INSTANCE.addCredentials(realm, host, userName, passwd);
     }
 
-    private void moduleStarted(Map attributes) {
+    private void moduleStarted(Map<String, String> attributes) {
         attributes.put(IvyPatternHelper.MODULE_KEY, attributes.remove("name"));
-        String resolver = (String) attributes.remove("resolver");
-        String branch = (String) attributes.remove("branch");
-        String cm = (String) attributes.remove("conflict-manager");
-        String resolveMode = (String) attributes.remove("resolveMode");
-        String matcher = (String) attributes.remove("matcher");
-        matcher = matcher == null ? PatternMatcher.EXACT_OR_REGEXP : matcher;
+        String resolver = attributes.remove("resolver");
+        String branch = attributes.remove("branch");
+        String cm = attributes.remove("conflict-manager");
+        String resolveMode = attributes.remove("resolveMode");
+        String matcher = attributes.remove("matcher");
+        matcher = (matcher == null) ? PatternMatcher.EXACT_OR_REGEXP : matcher;
         ivy.addModuleConfiguration(attributes, ivy.getMatcher(matcher), resolver, branch, cm,
             resolveMode);
     }
 
-    private void macrodefStarted(String qName, Map attributes) {
+    private void macrodefStarted(String qName, Map<String, String> attributes) {
         currentConfiguratorTag = qName;
-        Configurator.MacroDef macrodef = configurator
-                .startMacroDef((String) attributes.get("name"));
+        Configurator.MacroDef macrodef = configurator.startMacroDef(attributes.get("name"));
         macrodef.addAttribute("name", null);
     }
 
@@ -270,10 +261,10 @@ public class XmlSettingsParser extends DefaultHandler {
         configurator.setRoot(ivy);
     }
 
-    private void statusesStarted(String qName, Map attributes) {
+    private void statusesStarted(String qName, Map<String, String> attributes) {
         currentConfiguratorTag = qName;
         StatusManager m = new StatusManager();
-        String defaultStatus = (String) attributes.get("default");
+        String defaultStatus = attributes.get("default");
         if (defaultStatus != null) {
             m.setDefaultStatus(defaultStatus);
         }
@@ -281,91 +272,91 @@ public class XmlSettingsParser extends DefaultHandler {
         configurator.setRoot(m);
     }
 
-    private void versionMatchersStarted(String qName, Map attributes) {
+    private void versionMatchersStarted(String qName, Map<String, String> attributes) {
         anyConfiguratorStarted(qName);
         if ("true".equals(attributes.get("usedefaults"))) {
             ivy.configureDefaultVersionMatcher();
         }
     }
 
-    private void cachesStarted(String qName, Map attributes) {
+    private void cachesStarted(String qName, Map<String, String> attributes) {
         anyConfiguratorStarted(qName);
-        defaultLock = (String) attributes.get("lockStrategy");
-        defaultCacheManager = (String) attributes.get("default");
+        defaultLock = attributes.get("lockStrategy");
+        defaultCacheManager = attributes.get("default");
 
-        String cache = (String) attributes.get("defaultCacheDir");
+        String cache = attributes.get("defaultCacheDir");
         if (cache != null) {
             ivy.setDefaultCache(Checks.checkAbsolute(cache, "defaultCacheDir"));
         }
-        String up2d = (String) attributes.get("checkUpToDate");
+        String up2d = attributes.get("checkUpToDate");
         if (up2d != null) {
             Message.deprecated("'checkUpToDate' is deprecated, "
                     + "use the 'overwriteMode' on the 'ivy:retrieve' task instead (" + settings
                     + ")");
             ivy.setCheckUpToDate(Boolean.valueOf(up2d));
         }
-        String resolutionDir = (String) attributes.get("resolutionCacheDir");
+        String resolutionDir = attributes.get("resolutionCacheDir");
         if (resolutionDir != null) {
             ivy.setDefaultResolutionCacheBasedir(resolutionDir);
         }
-        String useOrigin = (String) attributes.get("useOrigin");
+        String useOrigin = attributes.get("useOrigin");
         if (useOrigin != null) {
             ivy.setDefaultUseOrigin(Boolean.valueOf(useOrigin));
         }
-        String cacheIvyPattern = (String) attributes.get("ivyPattern");
+        String cacheIvyPattern = attributes.get("ivyPattern");
         if (cacheIvyPattern != null) {
             ivy.setDefaultCacheIvyPattern(cacheIvyPattern);
         }
-        String cacheArtPattern = (String) attributes.get("artifactPattern");
+        String cacheArtPattern = attributes.get("artifactPattern");
         if (cacheArtPattern != null) {
             ivy.setDefaultCacheArtifactPattern(cacheArtPattern);
         }
-        String repositoryDir = (String) attributes.get("repositoryCacheDir");
+        String repositoryDir = attributes.get("repositoryCacheDir");
         if (repositoryDir != null) {
             ivy.setDefaultRepositoryCacheBasedir(repositoryDir);
         }
     }
 
-    private void settingsStarted(String qName, Map attributes) {
+    private void settingsStarted(String qName, Map<String, String> attributes) {
         if ("conf".equals(qName) && !deprecatedMessagePrinted) {
             Message.deprecated("'conf' is deprecated, use 'settings' instead (" + settings + ")");
         }
-        String cache = (String) attributes.get("defaultCache");
+        String cache = attributes.get("defaultCache");
         if (cache != null) {
             Message.deprecated("'defaultCache' is deprecated, "
                     + "use 'caches[@defaultCacheDir]' instead (" + settings + ")");
             ivy.setDefaultCache(Checks.checkAbsolute(cache, "defaultCache"));
         }
-        String defaultBranch = (String) attributes.get("defaultBranch");
+        String defaultBranch = attributes.get("defaultBranch");
         if (defaultBranch != null) {
             ivy.setDefaultBranch(defaultBranch);
         }
-        String defaultResolveMode = (String) attributes.get("defaultResolveMode");
+        String defaultResolveMode = attributes.get("defaultResolveMode");
         if (defaultResolveMode != null) {
             ivy.setDefaultResolveMode(defaultResolveMode);
         }
-        String validate = (String) attributes.get("validate");
+        String validate = attributes.get("validate");
         if (validate != null) {
             ivy.setValidate(Boolean.valueOf(validate));
         }
-        String up2d = (String) attributes.get("checkUpToDate");
+        String up2d = attributes.get("checkUpToDate");
         if (up2d != null) {
             Message.deprecated("'checkUpToDate' is deprecated, "
                     + "use the 'overwriteMode' on the 'ivy:retrieve' task instead (" + settings
                     + ")");
             ivy.setCheckUpToDate(Boolean.valueOf(up2d));
         }
-        String useRemoteConfig = (String) attributes.get("useRemoteConfig");
+        String useRemoteConfig = attributes.get("useRemoteConfig");
         if (useRemoteConfig != null) {
             ivy.setUseRemoteConfig(Boolean.valueOf(useRemoteConfig));
         }
-        String cacheIvyPattern = (String) attributes.get("cacheIvyPattern");
+        String cacheIvyPattern = attributes.get("cacheIvyPattern");
         if (cacheIvyPattern != null) {
             Message.deprecated("'cacheIvyPattern' is deprecated, use 'caches[@ivyPattern]' instead"
                     + " (" + settings + ")");
             ivy.setDefaultCacheIvyPattern(cacheIvyPattern);
         }
-        String cacheArtPattern = (String) attributes.get("cacheArtifactPattern");
+        String cacheArtPattern = attributes.get("cacheArtifactPattern");
         if (cacheArtPattern != null) {
             Message.deprecated("'cacheArtifactPattern' is deprecated, "
                     + "use 'caches[@artifactPattern]' instead (" + settings + ")");
@@ -373,31 +364,31 @@ public class XmlSettingsParser extends DefaultHandler {
         }
 
         // we do not set following defaults here since no instances has been registered yet
-        defaultResolver = (String) attributes.get("defaultResolver");
-        defaultCM = (String) attributes.get("defaultConflictManager");
-        defaultLatest = (String) attributes.get("defaultLatestStrategy");
-        defaultCircular = (String) attributes.get("circularDependencyStrategy");
+        defaultResolver = attributes.get("defaultResolver");
+        defaultCM = attributes.get("defaultConflictManager");
+        defaultLatest = attributes.get("defaultLatestStrategy");
+        defaultCircular = attributes.get("circularDependencyStrategy");
 
-        String requestMethod = (String) attributes.get("httpRequestMethod");
+        String requestMethod = attributes.get("httpRequestMethod");
         if ("head".equalsIgnoreCase(requestMethod)) {
             URLHandlerRegistry.getHttp().setRequestMethod(URLHandler.REQUEST_METHOD_HEAD);
         } else if ("get".equalsIgnoreCase(requestMethod)) {
             URLHandlerRegistry.getHttp().setRequestMethod(URLHandler.REQUEST_METHOD_GET);
         } else if ((requestMethod != null) && (requestMethod.trim().length() > 0)) {
-            throw new IllegalArgumentException("Invalid httpRequestMethod specified, must be "
-                    + "one of {'HEAD', 'GET'}");
+            throw new IllegalArgumentException(
+                    "Invalid httpRequestMethod specified, must be one of {'HEAD', 'GET'}");
         }
     }
 
-    private void includeStarted(Map attributes) throws IOException, ParseException {
+    private void includeStarted(Map<String, String> attributes) throws IOException, ParseException {
         final IvyVariableContainer variables = ivy.getVariableContainer();
         ivy.setVariableContainer(new IvyVariableContainerWrapper(variables));
         final boolean optionalInclude = "true".equals(attributes.get("optional"));
         try {
-            String propFilePath = (String) attributes.get("file");
+            String propFilePath = attributes.get("file");
             URL settingsURL = null;
             if (propFilePath == null) {
-                propFilePath = (String) attributes.get("url");
+                propFilePath = attributes.get("url");
                 if (propFilePath == null) {
                     throw new IllegalArgumentException(
                             "bad include tag: specify file or url to include");
@@ -495,11 +486,11 @@ public class XmlSettingsParser extends DefaultHandler {
         }
     }
 
-    private void propertiesStarted(Map attributes) throws IOException {
-        String propFilePath = (String) attributes.get("file");
-        String environmentPrefix = (String) attributes.get("environment");
+    private void propertiesStarted(Map<String, String> attributes) throws IOException {
+        String propFilePath = attributes.get("file");
+        String environmentPrefix = attributes.get("environment");
         if (propFilePath != null) {
-            String overrideStr = (String) attributes.get("override");
+            String overrideStr = attributes.get("override");
             boolean override = (overrideStr == null) || Boolean.valueOf(overrideStr);
             Message.verbose("loading properties: " + propFilePath);
             try {
@@ -516,12 +507,12 @@ public class XmlSettingsParser extends DefaultHandler {
         }
     }
 
-    private void propertyStarted(Map attributes) {
-        String name = (String) attributes.get("name");
-        String value = (String) attributes.get("value");
-        String override = (String) attributes.get("override");
-        String isSetVar = (String) attributes.get("ifset");
-        String unlessSetVar = (String) attributes.get("unlessset");
+    private void propertyStarted(Map<String, String> attributes) {
+        String name = attributes.get("name");
+        String value = attributes.get("value");
+        String override = attributes.get("override");
+        String isSetVar = attributes.get("ifset");
+        String unlessSetVar = attributes.get("unlessset");
         if (name == null) {
             throw new IllegalArgumentException("missing attribute name on property tag");
         }
@@ -532,18 +523,18 @@ public class XmlSettingsParser extends DefaultHandler {
             unlessSetVar);
     }
 
-    private void typedefStarted(Map attributes) {
-        String name = (String) attributes.get("name");
-        String className = (String) attributes.get("classname");
-        Class clazz = ivy.typeDef(name, className);
+    private void typedefStarted(Map<String, String> attributes) {
+        String name = attributes.get("name");
+        String className = attributes.get("classname");
+        Class<?> clazz = ivy.typeDef(name, className);
         configurator.typeDef(name, clazz);
     }
 
-    private void classpathStarted(Map attributes) throws IOException {
-        String urlStr = (String) attributes.get("url");
+    private void classpathStarted(Map<String, String> attributes) throws IOException {
+        String urlStr = attributes.get("url");
         URL url = null;
         if (urlStr == null) {
-            String file = (String) attributes.get("file");
+            String file = attributes.get("file");
             if (file == null) {
                 throw new IllegalArgumentException(
                         "either url or file should be given for classpath element");
@@ -556,12 +547,12 @@ public class XmlSettingsParser extends DefaultHandler {
         ivy.addClasspathURL(url);
     }
 
-    private void inConfiguratorStarted(String qName, Map attributes) {
+    private void inConfiguratorStarted(String qName, Map<String, String> attributes) {
         if ("macrodef".equals(currentConfiguratorTag) && configurator.getTypeDef(qName) != null) {
-            String name = (String) attributes.get("name");
+            String name = attributes.get("name");
             if (name == null) {
                 attributes.put("name", "@{name}");
-            } else if (name.indexOf("@{name}") != -1) {
+            } else if (name.contains("@{name}")) {
                 attributes.put("name", name);
             } else {
                 attributes.put("name", "@{name}-" + name);
@@ -572,7 +563,7 @@ public class XmlSettingsParser extends DefaultHandler {
                 throw new IllegalArgumentException("ref attribute should be the only one ! found "
                         + attributes.size() + " in " + qName);
             }
-            String name = (String) attributes.get("ref");
+            String name = attributes.get("ref");
             Object child = null;
             if ("resolvers".equals(currentConfiguratorTag) || "resolver".equals(qName)) {
                 child = ivy.getResolver(name);
@@ -599,9 +590,8 @@ public class XmlSettingsParser extends DefaultHandler {
             configurator.addChild(qName, child);
         } else {
             configurator.startCreateChild(qName);
-            for (Iterator iter = attributes.keySet().iterator(); iter.hasNext();) {
-                String attName = (String) iter.next();
-                configurator.setAttribute(attName, (String) attributes.get(attName));
+            for (String attName : attributes.keySet()) {
+                configurator.setAttribute(attName, attributes.get(attName));
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/sort/CollectionOfModulesToSort.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/sort/CollectionOfModulesToSort.java b/src/java/org/apache/ivy/core/sort/CollectionOfModulesToSort.java
index 93e228b..91e6249 100644
--- a/src/java/org/apache/ivy/core/sort/CollectionOfModulesToSort.java
+++ b/src/java/org/apache/ivy/core/sort/CollectionOfModulesToSort.java
@@ -59,8 +59,8 @@ class CollectionOfModulesToSort implements Iterable<ModuleInSort> {
             VersionMatcher matcher, NonMatchingVersionReporter nonMatchingVersionReporter) {
         this.versionMatcher = matcher;
         this.nonMatchingVersionReporter = nonMatchingVersionReporter;
-        this.modulesByModuleId = new HashMap<ModuleId, Collection<ModuleInSort>>();
-        moduleDescriptors = new ArrayList<ModuleInSort>(modulesToSort.size());
+        this.modulesByModuleId = new HashMap<>();
+        moduleDescriptors = new ArrayList<>(modulesToSort.size());
         for (ModuleDescriptor md : modulesToSort) {
             ModuleInSort mdInSort = new ModuleInSort(md);
             moduleDescriptors.add(mdInSort);
@@ -70,7 +70,7 @@ class CollectionOfModulesToSort implements Iterable<ModuleInSort> {
 
     private void addToModulesByModuleId(ModuleDescriptor md, ModuleInSort mdInSort) {
         ModuleId mdId = md.getModuleRevisionId().getModuleId();
-        List<ModuleInSort> mdInSortAsList = new LinkedList<ModuleInSort>();
+        List<ModuleInSort> mdInSortAsList = new LinkedList<>();
         mdInSortAsList.add(mdInSort);
         Collection<ModuleInSort> previousList = modulesByModuleId.put(mdId, mdInSortAsList);
         if (previousList != null) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/sort/ModuleDescriptorSorter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/sort/ModuleDescriptorSorter.java b/src/java/org/apache/ivy/core/sort/ModuleDescriptorSorter.java
index 330f302..be85820 100644
--- a/src/java/org/apache/ivy/core/sort/ModuleDescriptorSorter.java
+++ b/src/java/org/apache/ivy/core/sort/ModuleDescriptorSorter.java
@@ -42,7 +42,7 @@ public class ModuleDescriptorSorter {
 
     private final CollectionOfModulesToSort moduleDescriptors;
 
-    private final List<ModuleDescriptor> sorted = new LinkedList<ModuleDescriptor>();
+    private final List<ModuleDescriptor> sorted = new LinkedList<>();
 
     private final CircularDependencyStrategy circularDepStrategy;
 
@@ -93,8 +93,8 @@ public class ModuleDescriptorSorter {
         Message.debug("Sort dependencies of : " + current.toString()
                 + " / Number of dependencies = " + descriptors.length);
         current.setCaller(caller);
-        for (int i = 0; i < descriptors.length; i++) {
-            ModuleInSort child = moduleDescriptors.getModuleDescriptorDependency(descriptors[i]);
+        for (DependencyDescriptor descriptor : descriptors) {
+            ModuleInSort child = moduleDescriptors.getModuleDescriptorDependency(descriptor);
             if (child != null) {
                 sortModuleDescriptorsHelp(child, current);
             }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/sort/ModuleInSort.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/sort/ModuleInSort.java b/src/java/org/apache/ivy/core/sort/ModuleInSort.java
index 6e30b25..2ac1a20 100644
--- a/src/java/org/apache/ivy/core/sort/ModuleInSort.java
+++ b/src/java/org/apache/ivy/core/sort/ModuleInSort.java
@@ -53,7 +53,7 @@ class ModuleInSort {
 
     private boolean isSorted = false;
 
-    private List<ModuleInSort> loopElements = new LinkedList<ModuleInSort>();
+    private List<ModuleInSort> loopElements = new LinkedList<>();
 
     private boolean isLoopIntermediateElement = false;
 
@@ -113,12 +113,14 @@ class ModuleInSort {
      */
     public boolean checkLoop(ModuleInSort futurCaller, CircularDependencyStrategy depStrategy) {
         if (caller != null) {
-            LinkedList<ModuleRevisionId> elemOfLoop = new LinkedList<ModuleRevisionId>();
+            LinkedList<ModuleRevisionId> elemOfLoop = new LinkedList<>();
             elemOfLoop.add(this.module.getModuleRevisionId());
-            for (ModuleInSort stackEl = futurCaller; stackEl != this; stackEl = stackEl.caller) {
+            ModuleInSort stackEl = futurCaller;
+            while (stackEl != this) {
                 elemOfLoop.add(stackEl.module.getModuleRevisionId());
                 stackEl.isLoopIntermediateElement = true;
                 loopElements.add(stackEl);
+                stackEl = stackEl.caller;
             }
             elemOfLoop.add(this.module.getModuleRevisionId());
             ModuleRevisionId[] mrids = elemOfLoop.toArray(new ModuleRevisionId[elemOfLoop.size()]);
@@ -166,7 +168,7 @@ class ModuleInSort {
     }
 
     /** Log a warning saying that a loop is detected */
-    public static void logLoopWarning(List loopElement) {
+    public static void logLoopWarning(List<ModuleDescriptor> loopElement) {
         Message.warn("circular dependency detected during sort: "
                 + CircularDependencyHelper.formatMessageFromDescriptors(loopElement));
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/sort/SortEngine.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/sort/SortEngine.java b/src/java/org/apache/ivy/core/sort/SortEngine.java
index d4ddbbc..4aa547f 100644
--- a/src/java/org/apache/ivy/core/sort/SortEngine.java
+++ b/src/java/org/apache/ivy/core/sort/SortEngine.java
@@ -63,15 +63,15 @@ public class SortEngine {
          * corresponding dependency
          */
 
-        Map<ModuleDescriptor, List<IvyNode>> dependenciesMap = new LinkedHashMap<ModuleDescriptor, List<IvyNode>>();
-        List<IvyNode> nulls = new ArrayList<IvyNode>();
+        Map<ModuleDescriptor, List<IvyNode>> dependenciesMap = new LinkedHashMap<>();
+        List<IvyNode> nulls = new ArrayList<>();
         for (IvyNode node : nodes) {
             if (node.getDescriptor() == null) {
                 nulls.add(node);
             } else {
                 List<IvyNode> n = dependenciesMap.get(node.getDescriptor());
                 if (n == null) {
-                    n = new ArrayList<IvyNode>();
+                    n = new ArrayList<>();
                     dependenciesMap.put(node.getDescriptor(), n);
                 }
                 n.add(node);
@@ -79,11 +79,10 @@ public class SortEngine {
         }
         List<ModuleDescriptor> list = sortModuleDescriptors(dependenciesMap.keySet(), options);
         final double adjustFactor = 1.3;
-        List<IvyNode> ret = new ArrayList<IvyNode>(
+        List<IvyNode> ret = new ArrayList<>(
                 (int) (list.size() * adjustFactor + nulls.size()));
         // attempt to adjust the size to avoid too much list resizing
-        for (int i = 0; i < list.size(); i++) {
-            ModuleDescriptor md = list.get(i);
+        for (ModuleDescriptor md : list) {
             List<IvyNode> n = dependenciesMap.get(md);
             ret.addAll(n);
         }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/osgi/core/ManifestHeaderValue.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/core/ManifestHeaderValue.java b/src/java/org/apache/ivy/osgi/core/ManifestHeaderValue.java
index 08af4c6..5bff0e0 100644
--- a/src/java/org/apache/ivy/osgi/core/ManifestHeaderValue.java
+++ b/src/java/org/apache/ivy/osgi/core/ManifestHeaderValue.java
@@ -143,7 +143,7 @@ public class ManifestHeaderValue {
         /**
          * Do the parsing
          *
-         * @throws ParseException
+         * @throws ParseException if something goes wrong
          */
         void parse() throws ParseException {
             do {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/osgi/core/ManifestParser.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/core/ManifestParser.java b/src/java/org/apache/ivy/osgi/core/ManifestParser.java
index 4806f33..5ccf3d7 100644
--- a/src/java/org/apache/ivy/osgi/core/ManifestParser.java
+++ b/src/java/org/apache/ivy/osgi/core/ManifestParser.java
@@ -257,7 +257,7 @@ public class ManifestParser {
         return new VersionRange(v);
     }
 
-    private static Version versionOf(String v) throws ParseException {
+    private static Version versionOf(String v) {
         if (v == null) {
             return null;
         }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/osgi/filter/OSGiFilterParser.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/filter/OSGiFilterParser.java b/src/java/org/apache/ivy/osgi/filter/OSGiFilterParser.java
index 5221752..0123bcb 100644
--- a/src/java/org/apache/ivy/osgi/filter/OSGiFilterParser.java
+++ b/src/java/org/apache/ivy/osgi/filter/OSGiFilterParser.java
@@ -65,7 +65,7 @@ public class OSGiFilterParser {
          *
          * @return OSGiFilter
          *
-         * @throws ParseException
+         * @throws ParseException if something goes wrong
          */
         OSGiFilter parse() throws ParseException {
             return parseFilter();

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/osgi/obr/xml/RequirementAdapter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/obr/xml/RequirementAdapter.java b/src/java/org/apache/ivy/osgi/obr/xml/RequirementAdapter.java
index 0c20f1f..f453cf2 100644
--- a/src/java/org/apache/ivy/osgi/obr/xml/RequirementAdapter.java
+++ b/src/java/org/apache/ivy/osgi/obr/xml/RequirementAdapter.java
@@ -50,7 +50,7 @@ public class RequirementAdapter {
         adapter.adapt(info, requirement.isOptional());
     }
 
-    private void extractFilter(OSGiFilter filter) throws UnsupportedFilterException, ParseException {
+    private void extractFilter(OSGiFilter filter) throws UnsupportedFilterException {
         if (filter instanceof AndFilter) {
             AndFilter andFilter = (AndFilter) filter;
             for (OSGiFilter subFilter : andFilter.getSubFilters()) {
@@ -93,7 +93,7 @@ public class RequirementAdapter {
     }
 
     private void parseCompareFilter(CompareFilter compareFilter, boolean not)
-            throws UnsupportedFilterException, ParseException {
+            throws UnsupportedFilterException {
         String att = compareFilter.getLeftValue();
         if (BundleInfo.PACKAGE_TYPE.equals(att) || BundleInfo.BUNDLE_TYPE.equals(att)
                 || BundleInfo.EXECUTION_ENVIRONMENT_TYPE.equals(att) || "symbolicname".equals(att)

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/osgi/p2/P2ArtifactParser.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/p2/P2ArtifactParser.java b/src/java/org/apache/ivy/osgi/p2/P2ArtifactParser.java
index c027989..9e037f3 100644
--- a/src/java/org/apache/ivy/osgi/p2/P2ArtifactParser.java
+++ b/src/java/org/apache/ivy/osgi/p2/P2ArtifactParser.java
@@ -52,7 +52,7 @@ public class P2ArtifactParser implements XMLInputParser {
         this.repoUrl = repoUrl;
     }
 
-    public void parse(InputStream in) throws ParseException, IOException, SAXException {
+    public void parse(InputStream in) throws IOException, ParseException, SAXException {
         RepositoryHandler handler = new RepositoryHandler(p2Descriptor, repoUrl);
         try {
             XMLHelper.parse(in, null, handler, null);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/osgi/p2/P2CompositeParser.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/p2/P2CompositeParser.java b/src/java/org/apache/ivy/osgi/p2/P2CompositeParser.java
index 3819d6c..dfac018 100644
--- a/src/java/org/apache/ivy/osgi/p2/P2CompositeParser.java
+++ b/src/java/org/apache/ivy/osgi/p2/P2CompositeParser.java
@@ -41,7 +41,7 @@ public class P2CompositeParser implements XMLInputParser {
         return childLocations;
     }
 
-    public void parse(InputStream in) throws ParseException, IOException, SAXException {
+    public void parse(InputStream in) throws IOException, ParseException, SAXException {
         RepositoryHandler handler = new RepositoryHandler();
         try {
             XMLHelper.parse(in, null, handler, null);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java b/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java
index eedb4aa..44b7a2a 100644
--- a/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java
+++ b/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java
@@ -56,7 +56,7 @@ public class P2MetadataParser implements XMLInputParser {
         this.logLevel = logLevel;
     }
 
-    public void parse(InputStream in) throws ParseException, IOException, SAXException {
+    public void parse(InputStream in) throws IOException, ParseException, SAXException {
         RepositoryHandler handler = new RepositoryHandler(p2Descriptor);
         try {
             XMLHelper.parse(in, null, handler, null);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/osgi/p2/XMLInputParser.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/p2/XMLInputParser.java b/src/java/org/apache/ivy/osgi/p2/XMLInputParser.java
index 6170726..dfe16df 100644
--- a/src/java/org/apache/ivy/osgi/p2/XMLInputParser.java
+++ b/src/java/org/apache/ivy/osgi/p2/XMLInputParser.java
@@ -25,6 +25,6 @@ import org.xml.sax.SAXException;
 
 public interface XMLInputParser {
 
-    void parse(InputStream in) throws ParseException, IOException, SAXException;
+    void parse(InputStream in) throws IOException, ParseException, SAXException;
 
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java b/src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java
index 02589b5..08e762c 100644
--- a/src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java
+++ b/src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java
@@ -27,7 +27,6 @@ import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -389,11 +388,12 @@ public abstract class AbstractOSGiResolver extends BasicResolver {
             capabilityValues.addAll(moduleByCapabilityValue.keySet());
         } else {
             for (Entry<String, Set<ModuleDescriptor>> entry : moduleByCapabilityValue.entrySet()) {
-                Iterator<ModuleDescriptor> itModules = entry.getValue().iterator();
                 boolean moduleMatchRev = false;
-                while (!moduleMatchRev && itModules.hasNext()) {
-                    ModuleDescriptor md = itModules.next();
+                for (ModuleDescriptor md : entry.getValue()) {
                     moduleMatchRev = rev.equals(md.getRevision());
+                    if (moduleMatchRev) {
+                        break;
+                    }
                 }
                 if (moduleMatchRev) {
                     // at least one module matched, the capability value is ok to add
@@ -403,6 +403,7 @@ public abstract class AbstractOSGiResolver extends BasicResolver {
         }
     }
 
+    @SuppressWarnings("unchecked")
     @Override
     public Map<String, String>[] listTokenValues(String[] tokens, Map<String, Object> criteria) {
         Set<String> tokenSet = new HashSet<>(Arrays.asList(tokens));

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java b/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java
index 7889a1e..8890a90 100644
--- a/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java
+++ b/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java
@@ -150,14 +150,11 @@ public class EditableRepoDescriptor extends RepoDescriptor {
 
     @Override
     public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
+        if (!(obj instanceof EditableRepoDescriptor)) {
             return false;
         }
-        if (getClass() != obj.getClass()) {
-            return false;
+        if (this == obj) {
+            return true;
         }
         EditableRepoDescriptor other = (EditableRepoDescriptor) obj;
         if (modules == null) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/osgi/repo/ModuleDescriptorWrapper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/repo/ModuleDescriptorWrapper.java b/src/java/org/apache/ivy/osgi/repo/ModuleDescriptorWrapper.java
index 7efcb03..c6e42ab 100644
--- a/src/java/org/apache/ivy/osgi/repo/ModuleDescriptorWrapper.java
+++ b/src/java/org/apache/ivy/osgi/repo/ModuleDescriptorWrapper.java
@@ -85,7 +85,7 @@ public class ModuleDescriptorWrapper {
 
     @Override
     public boolean equals(Object obj) {
-        return !(obj == null || !(obj instanceof ModuleDescriptorWrapper))
+        return obj instanceof ModuleDescriptorWrapper
                 && bundleInfo.equals(((ModuleDescriptorWrapper) obj).bundleInfo);
     }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoader.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoader.java b/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoader.java
index c63b437..dd0c227 100644
--- a/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoader.java
+++ b/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoader.java
@@ -222,7 +222,7 @@ public class UpdateSiteLoader {
         return true;
     }
 
-    private UpdateSite loadSite(URI repoUri) throws IOException, ParseException, SAXException {
+    private UpdateSite loadSite(URI repoUri) throws IOException, SAXException {
         URI siteUri = normalizeSiteUri(repoUri, null);
         URL u = siteUri.resolve("site.xml").toURL();
 
@@ -262,7 +262,7 @@ public class UpdateSiteLoader {
     }
 
     private UpdateSiteDescriptor loadFromDigest(UpdateSite site) throws IOException,
-            ParseException, SAXException {
+            SAXException {
         URI digestBaseUri = site.getDigestUri();
         if (digestBaseUri == null) {
             digestBaseUri = site.getUri();
@@ -287,8 +287,7 @@ public class UpdateSiteLoader {
         }
     }
 
-    private UpdateSiteDescriptor loadFromSite(UpdateSite site) throws IOException, ParseException,
-            SAXException {
+    private UpdateSiteDescriptor loadFromSite(UpdateSite site) throws IOException, SAXException {
         UpdateSiteDescriptor repoDescriptor = new UpdateSiteDescriptor(site.getUri(),
                 ExecutionEnvironmentProfileProvider.getInstance());
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/osgi/util/ParseUtil.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/util/ParseUtil.java b/src/java/org/apache/ivy/osgi/util/ParseUtil.java
index 62a0a1c..7839906 100644
--- a/src/java/org/apache/ivy/osgi/util/ParseUtil.java
+++ b/src/java/org/apache/ivy/osgi/util/ParseUtil.java
@@ -50,9 +50,7 @@ public class ParseUtil {
 
         int expecting = (CHAR | DELIMITER | STARTQUOTE);
 
-        for (int i = 0; i < value.length(); i++) {
-            final char c = value.charAt(i);
-
+        for (final char c : value.toCharArray()) {
             final boolean isDelimiter = (delim.indexOf(c) >= 0);
             final boolean isQuote = (c == '"');
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/osgi/util/VersionComparator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/util/VersionComparator.java b/src/java/org/apache/ivy/osgi/util/VersionComparator.java
index 8872431..c3559b0 100644
--- a/src/java/org/apache/ivy/osgi/util/VersionComparator.java
+++ b/src/java/org/apache/ivy/osgi/util/VersionComparator.java
@@ -33,7 +33,7 @@ public class VersionComparator implements Comparator<Version> {
 
     public int compare(Version objA, Version objB) {
         final int val = objA.compareTo(objB);
-        return (reverse ? -val : val);
+        return reverse ? -val : val;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/circular/CircularDependencyHelper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/circular/CircularDependencyHelper.java b/src/java/org/apache/ivy/plugins/circular/CircularDependencyHelper.java
index 0c99d98..634ab92 100644
--- a/src/java/org/apache/ivy/plugins/circular/CircularDependencyHelper.java
+++ b/src/java/org/apache/ivy/plugins/circular/CircularDependencyHelper.java
@@ -17,7 +17,9 @@
  */
 package org.apache.ivy.plugins.circular;
 
+import java.util.Arrays;
 import java.util.HashSet;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
 
@@ -28,7 +30,6 @@ public final class CircularDependencyHelper {
 
     /** CircularDependencyHelper is not designed to be an instance */
     private CircularDependencyHelper() {
-
     }
 
     /**
@@ -56,7 +57,7 @@ public final class CircularDependencyHelper {
     }
 
     public static String formatMessage(final ModuleDescriptor[] descriptors) {
-        return formatMessage(toMrids(descriptors));
+        return formatMessageFromDescriptors(Arrays.asList(descriptors));
     }
 
     /**
@@ -65,21 +66,11 @@ public final class CircularDependencyHelper {
      * @return String
      */
     public static String formatMessageFromDescriptors(List<ModuleDescriptor> loopElements) {
-        ModuleRevisionId[] mrids = new ModuleRevisionId[loopElements.size()];
-        int pos = 0;
-        for (ModuleDescriptor descriptor: loopElements) {
-            mrids[pos] = descriptor.getModuleRevisionId();
-            pos++;
-        }
-        return formatMessage(mrids);
-    }
-
-    public static ModuleRevisionId[] toMrids(ModuleDescriptor[] descriptors) {
-        ModuleRevisionId[] mrids = new ModuleRevisionId[descriptors.length];
-        for (int i = 0; i < descriptors.length; i++) {
-            mrids[i] = descriptors[i].getModuleRevisionId();
+        List<ModuleRevisionId> mrids = new LinkedList<>();
+        for (ModuleDescriptor descriptor : loopElements) {
+            mrids.add(descriptor.getModuleRevisionId());
         }
-        return mrids;
+        return formatMessage(mrids.toArray(new ModuleRevisionId[mrids.size()]));
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManager.java b/src/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManager.java
index 73f4951..f0676d6 100644
--- a/src/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManager.java
+++ b/src/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManager.java
@@ -191,13 +191,13 @@ public class LatestCompatibleConflictManager extends LatestConflictManager {
             settings.getVersionMatcher(), parent, selected, evicted, callerStack);
         if (toBlacklist != null) {
             final StringBuilder blacklisted = new StringBuilder();
-            for (Iterator<IvyNodeBlacklist> iterator = toBlacklist.iterator(); iterator.hasNext();) {
-                IvyNodeBlacklist blacklist = iterator.next();
-                blacklist.getBlacklistedNode().blacklist(blacklist);
-                blacklisted.append(blacklist.getBlacklistedNode());
-                if (iterator.hasNext()) {
+            for (IvyNodeBlacklist blacklist : toBlacklist) {
+                if (blacklisted.length() > 0) {
                     blacklisted.append(" ");
                 }
+                IvyNode blacklistedNode = blacklist.getBlacklistedNode();
+                blacklistedNode.blacklist(blacklist);
+                blacklisted.append(blacklistedNode);
             }
 
             String rootModuleConf = parent.getData().getReport().getConfiguration();

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/conflict/LatestConflictManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/conflict/LatestConflictManager.java b/src/java/org/apache/ivy/plugins/conflict/LatestConflictManager.java
index 2237acf..143d92a 100644
--- a/src/java/org/apache/ivy/plugins/conflict/LatestConflictManager.java
+++ b/src/java/org/apache/ivy/plugins/conflict/LatestConflictManager.java
@@ -101,7 +101,7 @@ public class LatestConflictManager extends AbstractConflictManager {
             }
         }
 
-        ArrayList<IvyNode> unevicted = new ArrayList<>();
+        List<IvyNode> unevicted = new ArrayList<>();
         for (IvyNode node : conflicts) {
             if (!node.isCompletelyEvicted()) {
                 unevicted.add(node);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/latest/AbstractLatestStrategy.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/latest/AbstractLatestStrategy.java b/src/java/org/apache/ivy/plugins/latest/AbstractLatestStrategy.java
index dbd24dc..0812b56 100644
--- a/src/java/org/apache/ivy/plugins/latest/AbstractLatestStrategy.java
+++ b/src/java/org/apache/ivy/plugins/latest/AbstractLatestStrategy.java
@@ -42,7 +42,8 @@ public abstract class AbstractLatestStrategy implements LatestStrategy {
 
         // the latest revision comes last, use a ListIterator to iterate the
         // sorted list in the reverse direction.
-        for (ListIterator<ArtifactInfo> iter = l.listIterator(l.size()); iter.hasPrevious();) {
+        ListIterator<ArtifactInfo> iter = l.listIterator(l.size());
+        while (iter.hasPrevious()) {
             ArtifactInfo info = iter.previous();
             if (date == null || info.getLastModified() < date.getTime()) {
                 return info;

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/lock/DeleteOnExitHook.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/lock/DeleteOnExitHook.java b/src/java/org/apache/ivy/plugins/lock/DeleteOnExitHook.java
index c77d536..5f6c18a 100644
--- a/src/java/org/apache/ivy/plugins/lock/DeleteOnExitHook.java
+++ b/src/java/org/apache/ivy/plugins/lock/DeleteOnExitHook.java
@@ -20,6 +20,7 @@ package org.apache.ivy.plugins.lock;
 import java.io.File;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
+import java.util.Set;
 
 final class DeleteOnExitHook {
 
@@ -31,7 +32,7 @@ final class DeleteOnExitHook {
         });
     }
 
-    private static final LinkedHashSet<File> files = new LinkedHashSet<>();
+    private static final Set<File> files = new LinkedHashSet<>();
 
     private DeleteOnExitHook() {
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java b/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java
index 91f721b..3d6fbb3 100644
--- a/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java
+++ b/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java
@@ -401,7 +401,7 @@ public class PomReader {
             if (exclusionsElement == null) {
                 return Collections.emptyList();
             }
-            LinkedList<ModuleId> exclusions = new LinkedList<>();
+            List<ModuleId> exclusions = new LinkedList<>();
             NodeList children = exclusionsElement.getChildNodes();
             for (int i = 0, sz = children.getLength(); i < sz; i++) {
                 Node node = children.item(i);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java b/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
index cc640a8..4911c99 100644
--- a/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
+++ b/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
@@ -167,9 +167,9 @@ public class XmlModuleDescriptorParser extends AbstractModuleDescriptorParser {
                         .setPubdate(md.getResolvedPublicationDate()).setUpdateBranch(false)
                         .setNamespace(ns));
         } catch (SAXException e) {
-            ParseException ex = new ParseException("exception occurred while parsing " + res, 0);
-            ex.initCause(e);
-            throw ex;
+            ParseException pe = new ParseException("exception occurred while parsing " + res, 0);
+            pe.initCause(e);
+            throw pe;
         } finally {
             if (is != null) {
                 is.close();
@@ -381,10 +381,8 @@ public class XmlModuleDescriptorParser extends AbstractModuleDescriptorParser {
                 if (ex instanceof SAXException) {
                     throw (SAXException) ex;
                 }
-                SAXException sax = new SAXException("Problem occurred while parsing ivy file: "
+                throw new SAXException("Problem occurred while parsing ivy file: "
                         + ex.getMessage(), ex);
-                sax.initCause(ex);
-                throw sax;
             }
         }
 
@@ -574,7 +572,7 @@ public class XmlModuleDescriptorParser extends AbstractModuleDescriptorParser {
 
         private static Map<String, String> mergeValues(Map<String, String> inherited,
                 Map<String, String> overrides) {
-            LinkedHashMap<String, String> dup = new LinkedHashMap<>(inherited.size()
+            Map<String, String> dup = new LinkedHashMap<>(inherited.size()
                     + overrides.size());
             dup.putAll(inherited);
             dup.putAll(overrides);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java b/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
index c3ea1dd..7d09011 100644
--- a/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
+++ b/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
@@ -412,11 +412,13 @@ public final class XmlModuleDescriptorUpdater {
                     // replace inline revision with resolved parent revision
                     ModuleDescriptor merged = options.getMergedDescriptor();
                     if (merged != null) {
-                        ExtendsDescriptor[] parents = merged.getInheritedDescriptors();
-                        for (int j = 0; value == null && j < parents.length; ++j) {
-                            ModuleRevisionId resolvedId = parents[j].getResolvedParentRevisionId();
+                        for (ExtendsDescriptor parent : merged.getInheritedDescriptors()) {
+                            ModuleRevisionId resolvedId = parent.getResolvedParentRevisionId();
                             if (parentId.equals(resolvedId.getModuleId())) {
                                 value = resolvedId.getRevision();
+                                if (value != null) {
+                                    break;
+                                }
                             }
                         }
                     }
@@ -441,10 +443,9 @@ public final class XmlModuleDescriptorUpdater {
                 buffers.peek().setPrint(true);
                 String extend = substitute(settings, attributes.getValue("extends"));
                 if (extend != null) {
-                    for (StringTokenizer tok = new StringTokenizer(extend, ", "); tok
-                            .hasMoreTokens();) {
-                        String current = tok.nextToken();
-                        if (confs.contains(current)) {
+                    StringTokenizer tok = new StringTokenizer(extend, ", ");
+                    while (tok.hasMoreTokens()) {
+                        if (confs.contains(tok.nextToken())) {
                             throw new IllegalArgumentException(
                                     "Cannot exclude a configuration which is extended.");
                         }
@@ -618,7 +619,7 @@ public final class XmlModuleDescriptorUpdater {
                         settings.substitute(attributes.getValue("url")));
                 } else {
                     // TODO : settings can be null, but I don't why.
-                    // Check if the next code is correct in that case
+                    // Check if the following code is correct in that case
                     String fileName = attributes.getValue("file");
                     if (fileName == null) {
                         String urlStr = attributes.getValue("url");
@@ -655,10 +656,9 @@ public final class XmlModuleDescriptorUpdater {
                                 }
                                 String extend = substitute(settings, attributes.getValue("extends"));
                                 if (extend != null) {
-                                    for (StringTokenizer tok = new StringTokenizer(extend, ", "); tok
-                                            .hasMoreTokens();) {
-                                        String current = tok.nextToken();
-                                        if (confs.contains(current)) {
+                                    StringTokenizer tok = new StringTokenizer(extend, ", ");
+                                    while (tok.hasMoreTokens()) {
+                                        if (confs.contains(tok.nextToken())) {
                                             throw new IllegalArgumentException("Cannot exclude a "
                                                     + "configuration which is extended.");
                                         }
@@ -806,13 +806,12 @@ public final class XmlModuleDescriptorUpdater {
             return XMLHelper.escape(result);
         }
 
-        private String removeConfigurationsFromMapping(String mapping, List confsToRemove) {
+        private String removeConfigurationsFromMapping(String mapping, List<String> confsToRemove) {
             StringBuilder newMapping = new StringBuilder();
             String mappingSep = "";
-            for (StringTokenizer tokenizer = new StringTokenizer(mapping, ";"); tokenizer
-                    .hasMoreTokens();) {
-                String current = tokenizer.nextToken();
-                String[] ops = current.split("->");
+            StringTokenizer tokenizer = new StringTokenizer(mapping, ";");
+            while (tokenizer.hasMoreTokens()) {
+                String[] ops = tokenizer.nextToken().split("->");
                 List<String> confsToWrite = new ArrayList<>();
                 for (String lh : ops[0].split(",")) {
                     if (!confs.contains(lh.trim())) {
@@ -821,37 +820,31 @@ public final class XmlModuleDescriptorUpdater {
                 }
                 if (!confsToWrite.isEmpty()) {
                     newMapping.append(mappingSep);
-
                     String sep = "";
                     for (String confToWrite : confsToWrite) {
-                        newMapping.append(sep);
-                        newMapping.append(confToWrite);
+                        newMapping.append(sep).append(confToWrite);
                         sep = ",";
                     }
                     if (ops.length == 2) {
-                        newMapping.append("->");
-                        newMapping.append(ops[1]);
+                        newMapping.append("->").append(ops[1]);
                     }
                     mappingSep = ";";
                 }
             }
-
             return newMapping.toString();
         }
 
-        private String removeConfigurationsFromList(String list, List confsToRemove) {
+        private String removeConfigurationsFromList(String list, List<String> confsToRemove) {
             StringBuilder newList = new StringBuilder();
             String listSep = "";
-            for (StringTokenizer tokenizer = new StringTokenizer(list, ","); tokenizer
-                    .hasMoreTokens();) {
+            StringTokenizer tokenizer = new StringTokenizer(list, ",");
+            while (tokenizer.hasMoreTokens()) {
                 String current = tokenizer.nextToken();
                 if (!confsToRemove.contains(current.trim())) {
-                    newList.append(listSep);
-                    newList.append(current);
+                    newList.append(listSep).append(current);
                     listSep = ",";
                 }
             }
-
             return newList.toString();
         }
 
@@ -966,15 +959,12 @@ public final class XmlModuleDescriptorUpdater {
 
             for (Map.Entry<ModuleRevisionId, List<InheritableItem>> entry : inheritedItems
                     .entrySet()) {
-                ModuleRevisionId parent = entry.getKey();
-                List<InheritableItem> list = entry.getValue();
-
                 if (justOpen != null) {
                     out.println(">");
                     justOpen = null; // helps endElement() decide how to write close tags
                 }
-                writeInheritanceComment(itemName, parent);
-                for (InheritableItem item : list) {
+                writeInheritanceComment(itemName, entry.getKey());
+                for (InheritableItem item : entry.getValue()) {
                     out.print(getIndent());
                     printer.print(merged, item, out);
                 }
@@ -1091,8 +1081,8 @@ public final class XmlModuleDescriptorUpdater {
                     && !(mergedConfigurations && mergedDependencies)) {
 
                 // calculate the position of the element in ivy-module
-                int position = moduleElement == null ? MODULE_ELEMENTS.size() : MODULE_ELEMENTS
-                        .indexOf(moduleElement);
+                int position = (moduleElement == null) ? MODULE_ELEMENTS.size()
+                        : MODULE_ELEMENTS.indexOf(moduleElement);
 
                 ModuleDescriptor merged = options.getMergedDescriptor();
 


[5/7] ant-ivy git commit: Add generics and Java 7 syntax to core

Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java b/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
index 85b9c74..2d2b97b 100644
--- a/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
+++ b/src/java/org/apache/ivy/core/module/descriptor/DefaultModuleDescriptor.java
@@ -67,30 +67,30 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
         DefaultModuleDescriptor moduleDescriptor = new DefaultModuleDescriptor(
                 ModuleRevisionId.newInstance(mrid.getOrganisation(), mrid.getName() + "-caller",
                     "working"), "integration", null, true);
-        for (int i = 0; i < confs.length; i++) {
-            moduleDescriptor.addConfiguration(new Configuration(confs[i]));
+        for (String conf : confs) {
+            moduleDescriptor.addConfiguration(new Configuration(conf));
         }
         moduleDescriptor.setLastModified(System.currentTimeMillis());
         DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(moduleDescriptor, mrid,
                 true, changing, transitive);
-        for (int j = 0; j < confs.length; j++) {
-            dd.addDependencyConfiguration(confs[j], confs[j]);
+        for (String conf : confs) {
+            dd.addDependencyConfiguration(conf, conf);
         }
         moduleDescriptor.addDependency(dd);
 
         return moduleDescriptor;
     }
 
-    public static DefaultModuleDescriptor newCallerInstance(ModuleRevisionId[] mrid,
+    public static DefaultModuleDescriptor newCallerInstance(ModuleRevisionId[] mrids,
             boolean transitive, boolean changing) {
         DefaultModuleDescriptor moduleDescriptor = new DefaultModuleDescriptor(
                 ModuleRevisionId.newInstance("caller", "all-caller", "working"), "integration",
                 null, true);
         moduleDescriptor.addConfiguration(new Configuration(DEFAULT_CONFIGURATION));
         moduleDescriptor.setLastModified(System.currentTimeMillis());
-        for (int i = 0; i < mrid.length; i++) {
+        for (ModuleRevisionId mrid : mrids) {
             DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(moduleDescriptor,
-                    mrid[i], true, changing, transitive);
+                    mrid, true, changing, transitive);
             dd.addDependencyConfiguration(DEFAULT_CONFIGURATION, "*");
             moduleDescriptor.addDependency(dd);
         }
@@ -104,15 +104,14 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
                 null, true);
         moduleDescriptor.addConfiguration(new Configuration(DEFAULT_CONFIGURATION));
         if (artifacts != null && artifacts.length > 0) {
-            for (int i = 0; i < artifacts.length; i++) {
+            for (DependencyArtifactDescriptor artifact : artifacts) {
                 moduleDescriptor.addArtifact(DEFAULT_CONFIGURATION,
-                    new MDArtifact(moduleDescriptor, artifacts[i].getName(),
-                            artifacts[i].getType(), artifacts[i].getExt(), artifacts[i].getUrl(),
-                            artifacts[i].getExtraAttributes()));
+                    new MDArtifact(moduleDescriptor, artifact.getName(), artifact.getType(),
+                            artifact.getExt(), artifact.getUrl(), artifact.getExtraAttributes()));
             }
         } else {
-            moduleDescriptor.addArtifact(DEFAULT_CONFIGURATION, new MDArtifact(moduleDescriptor,
-                    mrid.getName(), "jar", "jar"));
+            moduleDescriptor.addArtifact(DEFAULT_CONFIGURATION,
+                new MDArtifact(moduleDescriptor, mrid.getName(), "jar", "jar"));
         }
         moduleDescriptor.setLastModified(System.currentTimeMillis());
         return moduleDescriptor;
@@ -131,7 +130,7 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
     /**
      * Transforms the given module descriptor of the given namespace and return a new module
      * descriptor in the system namespace. <i>Note that dependency exclude rules are not converted
-     * in system namespace, because they aren't transformable (the name space hasn't the ability to
+     * in system namespace, because they aren't transformable (the namespace lacks the ability to
      * convert regular expressions)</i>
      *
      * @param md ModuleDescriptor
@@ -150,9 +149,8 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
         nmd.publicationDate = md.getPublicationDate();
         nmd.resolvedPublicationDate = md.getResolvedPublicationDate();
 
-        ExtendsDescriptor[] ed = md.getInheritedDescriptors();
-        for (int i = 0; i < ed.length; ++i) {
-            ModuleDescriptor parentMd = ed[i].getParentMd();
+        for (ExtendsDescriptor ed : md.getInheritedDescriptors()) {
+            ModuleDescriptor parentMd = ed.getParentMd();
             DefaultModuleDescriptor parentNmd = new DefaultModuleDescriptor(parentMd.getParser(),
                     parentMd.getResource());
             parentNmd.revId = t.transform(parentMd.getModuleRevisionId());
@@ -161,28 +159,26 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
             parentNmd.publicationDate = parentMd.getPublicationDate();
             parentNmd.resolvedPublicationDate = parentMd.getResolvedPublicationDate();
 
-            nmd.inheritedDescriptors.add(new DefaultExtendsDescriptor(parentNmd, ed[i]
-                    .getLocation(), ed[i].getExtendsTypes()));
+            nmd.inheritedDescriptors.add(new DefaultExtendsDescriptor(parentNmd, ed.getLocation(),
+                    ed.getExtendsTypes()));
         }
 
-        DependencyDescriptor[] dd = md.getDependencies();
-        for (int i = 0; i < dd.length; i++) {
-            nmd.dependencies.add(NameSpaceHelper.toSystem(dd[i], ns));
+        for (DependencyDescriptor dd : md.getDependencies()) {
+            nmd.dependencies.add(NameSpaceHelper.toSystem(dd, ns));
         }
-        Configuration[] confs = md.getConfigurations();
-        for (int i = 0; i < confs.length; i++) {
-            nmd.configurations.put(confs[i].getName(), confs[i]);
-            Artifact[] arts = md.getArtifacts(confs[i].getName());
-            for (int j = 0; j < arts.length; j++) {
-                nmd.addArtifact(confs[i].getName(), NameSpaceHelper.transform(arts[j], t));
+
+        for (Configuration conf : md.getConfigurations()) {
+            final String confName = conf.getName();
+            nmd.configurations.put(confName, conf);
+            for (Artifact art : md.getArtifacts(confName)) {
+                nmd.addArtifact(confName, NameSpaceHelper.transform(art, t));
             }
         }
         nmd.setDefault(md.isDefault());
         if (md instanceof DefaultModuleDescriptor) {
             DefaultModuleDescriptor dmd = (DefaultModuleDescriptor) md;
-            nmd.conflictManagers = (ModuleRules) dmd.conflictManagers.clone();
-            nmd.dependencyDescriptorMediators = (ModuleRules) dmd.dependencyDescriptorMediators
-                    .clone();
+            nmd.conflictManagers = dmd.conflictManagers.clone();
+            nmd.dependencyDescriptorMediators = dmd.dependencyDescriptorMediators.clone();
         } else {
             Message.warn("transformed module descriptor is not a default module descriptor: "
                     + "impossible to copy conflict manager and version mediation configuration: "
@@ -209,24 +205,24 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
 
     private Date resolvedPublicationDate;
 
-    private List<DependencyDescriptor> dependencies = new ArrayList<DependencyDescriptor>();
+    private List<DependencyDescriptor> dependencies = new ArrayList<>();
 
-    private Map<String, Configuration> configurations = new LinkedHashMap<String, Configuration>();
+    private Map<String, Configuration> configurations = new LinkedHashMap<>();
 
-    private Map<String, Collection<Artifact>> artifactsByConf = new HashMap<String, Collection<Artifact>>();
+    private Map<String, Collection<Artifact>> artifactsByConf = new HashMap<>();
 
-    private Collection<Artifact> artifacts = new LinkedHashSet<Artifact>();
+    private Collection<Artifact> artifacts = new LinkedHashSet<>();
 
     // all artifacts could also be found in the artifactsByConf map, but here we can
     // preserve the order
 
     private boolean isDefault = false;
 
-    private ModuleRules conflictManagers = new ModuleRules();
+    private ModuleRules<ConflictManager> conflictManagers = new ModuleRules<>();
 
-    private ModuleRules dependencyDescriptorMediators = new ModuleRules();
+    private ModuleRules<DependencyDescriptorMediator> dependencyDescriptorMediators = new ModuleRules<>();
 
-    private List<License> licenses = new ArrayList<License>();
+    private List<License> licenses = new ArrayList<>();
 
     private String homePage;
 
@@ -246,15 +242,15 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
 
     private Resource resource;
 
-    private List<ExcludeRule> excludeRules = new ArrayList<ExcludeRule>();
+    private List<ExcludeRule> excludeRules = new ArrayList<>();
 
     private Artifact metadataArtifact;
 
-    private List<ExtendsDescriptor> inheritedDescriptors = new ArrayList<ExtendsDescriptor>();
+    private List<ExtendsDescriptor> inheritedDescriptors = new ArrayList<>();
 
-    private Map<String, String> extraAttributesNamespaces = new LinkedHashMap<String, String>();
+    private Map<String, String> extraAttributesNamespaces = new LinkedHashMap<>();
 
-    private List<ExtraInfoHolder> extraInfos = new ArrayList<ExtraInfoHolder>();
+    private List<ExtraInfoHolder> extraInfos = new ArrayList<>();
 
     public DefaultModuleDescriptor(ModuleRevisionId id, String status, Date pubDate) {
         this(id, status, pubDate, false);
@@ -378,14 +374,13 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
         }
         if (c instanceof ConfigurationGroup) {
             ConfigurationGroup group = (ConfigurationGroup) c;
-            String[] members = group.getMembersConfigurationNames();
-            for (int i = 0; i < members.length; i++) {
-                addArtifact(members[i], artifact);
+            for (String member : group.getMembersConfigurationNames()) {
+                addArtifact(member, artifact);
             }
         } else {
             Collection<Artifact> artifacts = artifactsByConf.get(conf);
             if (artifacts == null) {
-                artifacts = new ArrayList<Artifact>();
+                artifacts = new ArrayList<>();
                 artifactsByConf.put(conf, artifacts);
             }
             artifacts.add(artifact);
@@ -418,7 +413,7 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
     }
 
     public String[] getPublicConfigurationsNames() {
-        List<String> ret = new ArrayList<String>();
+        List<String> ret = new ArrayList<>();
         for (Configuration conf : configurations.values()) {
             if (conf.getVisibility() == Configuration.Visibility.PUBLIC) {
                 ret.add(conf.getName());
@@ -442,7 +437,7 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
                 String attValue = m.group(2);
 
                 // this is a conf group, let's search for its members
-                Map<String, Configuration> members = new LinkedHashMap<String, Configuration>();
+                Map<String, Configuration> members = new LinkedHashMap<>();
                 for (Configuration conf : configurations.values()) {
                     if (attValue.equals(conf.getAttribute(attName))) {
                         members.put(conf.getName(), conf);
@@ -456,15 +451,15 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
             if (confs.length <= 1) {
                 return null;
             }
-            Map<String, Configuration> intersectedConfs = new LinkedHashMap<String, Configuration>();
-            for (int i = 0; i < confs.length; i++) {
-                Configuration c = configurations.get(confs[i]);
+            Map<String, Configuration> intersectedConfs = new LinkedHashMap<>();
+            for (String conf : confs) {
+                Configuration c = configurations.get(conf);
                 if (c == null) {
-                    Message.verbose("missing configuration '" + confs[i] + "' from intersection "
+                    Message.verbose("missing configuration '" + conf + "' from intersection "
                             + confName + " in " + this);
                     return null;
                 }
-                intersectedConfs.put(confs[i], c);
+                intersectedConfs.put(conf, c);
             }
             return new ConfigurationIntersection(confName, intersectedConfs);
         }
@@ -479,10 +474,9 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
         Collection<Artifact> artifacts = artifactsByConf.get(conf);
         if (c instanceof ConfigurationIntersection) {
             ConfigurationIntersection intersection = (ConfigurationIntersection) c;
-            String[] intersected = intersection.getIntersectedConfigurationNames();
-            Set<Artifact> intersectedArtifacts = new LinkedHashSet<Artifact>();
-            for (int j = 0; j < intersected.length; j++) {
-                Collection<Artifact> arts = getArtifactsIncludingExtending(intersected[j]);
+            Set<Artifact> intersectedArtifacts = new LinkedHashSet<>();
+            for (String intersect : intersection.getIntersectedConfigurationNames()) {
+                Collection<Artifact> arts = getArtifactsIncludingExtending(intersect);
                 if (intersectedArtifacts.isEmpty()) {
                     intersectedArtifacts.addAll(arts);
                 } else {
@@ -495,10 +489,9 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
             return intersectedArtifacts.toArray(new Artifact[intersectedArtifacts.size()]);
         } else if (c instanceof ConfigurationGroup) {
             ConfigurationGroup group = (ConfigurationGroup) c;
-            String[] members = group.getMembersConfigurationNames();
-            Set<Artifact> groupArtifacts = new LinkedHashSet<Artifact>();
-            for (int i = 0; i < members.length; i++) {
-                groupArtifacts.addAll(getArtifactsIncludingExtending(members[i]));
+            Set<Artifact> groupArtifacts = new LinkedHashSet<>();
+            for (String member : group.getMembersConfigurationNames()) {
+                groupArtifacts.addAll(getArtifactsIncludingExtending(member));
             }
             if (artifacts != null) {
                 groupArtifacts.addAll(artifacts);
@@ -516,7 +509,7 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
     private Collection<Artifact> getArtifactsIncludingExtending(String conf) {
         Collection<Configuration> extendingConfs = Configuration.findConfigurationExtending(conf,
             getConfigurations());
-        Set<Artifact> artifacts = new LinkedHashSet<Artifact>();
+        Set<Artifact> artifacts = new LinkedHashSet<>();
         Collection<Artifact> arts = artifactsByConf.get(conf);
         if (arts != null) {
             artifacts.addAll(arts);
@@ -572,10 +565,7 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
         if (this == obj) {
             return true;
         }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
+        if (!(obj instanceof DefaultModuleDescriptor)) {
             return false;
         }
         DefaultModuleDescriptor other = (DefaultModuleDescriptor) obj;
@@ -614,7 +604,7 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
     }
 
     public ConflictManager getConflictManager(ModuleId moduleId) {
-        return (ConflictManager) conflictManagers.getRule(moduleId);
+        return conflictManagers.getRule(moduleId);
     }
 
     public void addDependencyDescriptorMediator(ModuleId moduleId, PatternMatcher matcher,
@@ -624,15 +614,14 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
     }
 
     public DependencyDescriptor mediate(DependencyDescriptor dd) {
-        Object[] mediators = dependencyDescriptorMediators.getRules(dd.getDependencyId());
-        for (int i = 0; i < mediators.length; i++) {
-            dd = ((DependencyDescriptorMediator) mediators[i]).mediate(dd);
+        for (DependencyDescriptorMediator mediator : dependencyDescriptorMediators.getRules(dd.getDependencyId())) {
+            dd = mediator.mediate(dd);
         }
         return dd;
     }
 
-    public ModuleRules getAllDependencyDescriptorMediators() {
-        return (ModuleRules) dependencyDescriptorMediators.clone();
+    public ModuleRules<DependencyDescriptorMediator> getAllDependencyDescriptorMediators() {
+        return dependencyDescriptorMediators.clone();
     }
 
     public void addLicense(License license) {
@@ -689,12 +678,11 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
      * configurations existence and cycles are checked
      */
     public void check() {
-        Stack<String> confs = new Stack<String>();
+        Stack<String> confs = new Stack<>();
         for (Configuration conf : configurations.values()) {
-            String[] ext = conf.getExtends();
-            for (int i = 0; i < ext.length; i++) {
+            for (String ext : conf.getExtends()) {
                 confs.push(conf.getName());
-                checkConf(confs, ext[i].trim());
+                checkConf(confs, ext.trim());
                 confs.pop();
             }
         }
@@ -703,7 +691,7 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
     private void checkConf(Stack<String> confs, String confName) {
         int index = confs.indexOf(confName);
         if (index != -1) {
-            StringBuffer cycle = new StringBuffer();
+            StringBuilder cycle = new StringBuilder();
             for (; index < confs.size(); index++) {
                 cycle.append(confs.get(index)).append(" => ");
             }
@@ -716,10 +704,9 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
             throw new IllegalStateException("unknown configuration '" + confName
                     + "'. It is extended by " + confs.get(confs.size() - 1));
         }
-        String[] ext = conf.getExtends();
-        for (int i = 0; i < ext.length; i++) {
+        for (String ext : conf.getExtends()) {
             confs.push(conf.getName());
-            checkConf(confs, ext[i].trim());
+            checkConf(confs, ext.trim());
             confs.pop();
         }
     }
@@ -797,9 +784,8 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
             artifactId = NameSpaceHelper
                     .transform(artifactId, namespace.getFromSystemTransformer());
         }
-        ExcludeRule[] rules = getExcludeRules(moduleConfigurations);
-        for (int i = 0; i < rules.length; i++) {
-            if (MatcherHelper.matches(rules[i].getMatcher(), rules[i].getId(), artifactId)) {
+        for (ExcludeRule rule : getExcludeRules(moduleConfigurations)) {
+            if (MatcherHelper.matches(rule.getMatcher(), rule.getId(), artifactId)) {
                 return true;
             }
         }
@@ -811,7 +797,7 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
     }
 
     public ExcludeRule[] getExcludeRules(String[] moduleConfigurations) {
-        Set<ExcludeRule> rules = new LinkedHashSet<ExcludeRule>();
+        Set<ExcludeRule> rules = new LinkedHashSet<>();
         for (ExcludeRule rule : excludeRules) {
             String[] ruleConfs = rule.getConfigurations();
             if (containsAny(ruleConfs, moduleConfigurations)) {
@@ -822,7 +808,7 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
     }
 
     private boolean containsAny(String[] arr1, String[] arr2) {
-        return new ArrayList<String>(Arrays.asList(arr1)).removeAll(Arrays.asList(arr2));
+        return new ArrayList<>(Arrays.asList(arr1)).removeAll(Arrays.asList(arr2));
     }
 
     public Map<String, String> getExtraAttributesNamespaces() {
@@ -840,7 +826,7 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
 
     @Deprecated
     public Map<String, String> getExtraInfo() {
-        Map<String, String> map = new HashMap<String, String>();
+        Map<String, String> map = new HashMap<>();
         for (ExtraInfoHolder extraInfo : extraInfos) {
             populateExtraInfoMap(map, extraInfo);
         }
@@ -877,6 +863,5 @@ public class DefaultModuleDescriptor implements ModuleDescriptor {
             }
         }
         return null;
-
     }
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/module/descriptor/ExtraInfoHolder.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/module/descriptor/ExtraInfoHolder.java b/src/java/org/apache/ivy/core/module/descriptor/ExtraInfoHolder.java
index 1422378..7a7cfe4 100644
--- a/src/java/org/apache/ivy/core/module/descriptor/ExtraInfoHolder.java
+++ b/src/java/org/apache/ivy/core/module/descriptor/ExtraInfoHolder.java
@@ -26,11 +26,11 @@ public class ExtraInfoHolder {
 
     private String name;
 
-    private Map<String, String> attributes = new LinkedHashMap<String, String>();
+    private Map<String, String> attributes = new LinkedHashMap<>();
 
     private String content;
 
-    private List<ExtraInfoHolder> nestedExtraInfoHolder = new ArrayList<ExtraInfoHolder>();
+    private List<ExtraInfoHolder> nestedExtraInfoHolder = new ArrayList<>();
 
     public ExtraInfoHolder() {
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/module/descriptor/MDArtifact.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/module/descriptor/MDArtifact.java b/src/java/org/apache/ivy/core/module/descriptor/MDArtifact.java
index 0efabbd..ecd511b 100644
--- a/src/java/org/apache/ivy/core/module/descriptor/MDArtifact.java
+++ b/src/java/org/apache/ivy/core/module/descriptor/MDArtifact.java
@@ -43,9 +43,9 @@ public class MDArtifact extends AbstractArtifact {
 
     private String ext;
 
-    private List/* <String> */confs = new ArrayList();
+    private final List<String> confs = new ArrayList<>();
 
-    private Map extraAttributes = null;
+    private Map<String, String> extraAttributes = null;
 
     private URL url;
 
@@ -61,7 +61,7 @@ public class MDArtifact extends AbstractArtifact {
     }
 
     public MDArtifact(ModuleDescriptor md, String name, String type, String ext, URL url,
-            Map extraAttributes) {
+            Map<String, String> extraAttributes) {
         if (md == null) {
             throw new NullPointerException("null module descriptor not allowed");
         }
@@ -109,7 +109,7 @@ public class MDArtifact extends AbstractArtifact {
     }
 
     public String[] getConfigurations() {
-        return (String[]) confs.toArray(new String[confs.size()]);
+        return confs.toArray(new String[confs.size()]);
     }
 
     public void addConfiguration(String conf) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/module/descriptor/ModuleDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/module/descriptor/ModuleDescriptor.java b/src/java/org/apache/ivy/core/module/descriptor/ModuleDescriptor.java
index 03694aa..da92131 100644
--- a/src/java/org/apache/ivy/core/module/descriptor/ModuleDescriptor.java
+++ b/src/java/org/apache/ivy/core/module/descriptor/ModuleDescriptor.java
@@ -212,7 +212,7 @@ public interface ModuleDescriptor extends ExtendableItem, ArtifactInfo,
      * @return all the {@link DependencyDescriptorMediator}s used by this
      * {@link ModuleDescriptor}, as an instance of {@link ModuleRules}.
      */
-    public ModuleRules/* <DependencyDescriptorMediator> */getAllDependencyDescriptorMediators();
+    public ModuleRules<DependencyDescriptorMediator> getAllDependencyDescriptorMediators();
 
     /**
      * @return the list of xml namespaces used by extra attributes, as Map from prefix to namespace

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/module/id/ArtifactRevisionId.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/module/id/ArtifactRevisionId.java b/src/java/org/apache/ivy/core/module/id/ArtifactRevisionId.java
index 3c10cc4..c55b0f0 100644
--- a/src/java/org/apache/ivy/core/module/id/ArtifactRevisionId.java
+++ b/src/java/org/apache/ivy/core/module/id/ArtifactRevisionId.java
@@ -34,7 +34,7 @@ public class ArtifactRevisionId extends UnmodifiableExtendableItem {
     }
 
     public static ArtifactRevisionId newInstance(ModuleRevisionId mrid, String name, String type,
-            String ext, Map extraAttributes) {
+            String ext, Map<String, String> extraAttributes) {
         return new ArtifactRevisionId(new ArtifactId(mrid.getModuleId(), name, type, ext), mrid,
                 extraAttributes);
     }
@@ -47,7 +47,8 @@ public class ArtifactRevisionId extends UnmodifiableExtendableItem {
         this(artifactId, mrid, null);
     }
 
-    public ArtifactRevisionId(ArtifactId artfId, ModuleRevisionId mdlRevId, Map extraAttributes) {
+    public ArtifactRevisionId(ArtifactId artfId, ModuleRevisionId mdlRevId,
+                              Map<String, String> extraAttributes) {
         super(null, extraAttributes);
         artifactId = artfId;
         mrid = mdlRevId;

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/module/id/MatcherLookup.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/module/id/MatcherLookup.java b/src/java/org/apache/ivy/core/module/id/MatcherLookup.java
index 56c0ca7..5d223ae 100644
--- a/src/java/org/apache/ivy/core/module/id/MatcherLookup.java
+++ b/src/java/org/apache/ivy/core/module/id/MatcherLookup.java
@@ -57,9 +57,9 @@ public class MatcherLookup {
 
     private static final String DEFAULT = "{org:" + "default" + ", module:" + "default" + "}";
 
-    private Map<String, List<MapMatcher>> lookup = new HashMap<String, List<MapMatcher>>();
+    private Map<String, List<MapMatcher>> lookup = new HashMap<>();
 
-    private List<MapMatcher> non_exact_matchers = new ArrayList<MapMatcher>();
+    private List<MapMatcher> nonExactMatchers = new ArrayList<>();
 
     /**
      * Add matcher.
@@ -73,16 +73,16 @@ public class MatcherLookup {
      */
     public void add(MapMatcher matcher) {
         if (!(matcher.getPatternMatcher() instanceof ExactPatternMatcher)) {
-            non_exact_matchers.add(matcher);
+            nonExactMatchers.add(matcher);
             return;
         }
         String key = key(matcher.getAttributes());
-        List<MapMatcher> exact_matchers = lookup.get(key);
-        if (exact_matchers == null) {
-            exact_matchers = new ArrayList<MapMatcher>();
-            lookup.put(key, exact_matchers);
+        List<MapMatcher> exactMatchers = lookup.get(key);
+        if (exactMatchers == null) {
+            exactMatchers = new ArrayList<>();
+            lookup.put(key, exactMatchers);
         }
-        exact_matchers.add(matcher);
+        exactMatchers.add(matcher);
     }
 
     /**
@@ -92,30 +92,30 @@ public class MatcherLookup {
      * @return a list of matchers that can apply to module withs specified attributes
      */
     public List<MapMatcher> get(Map<String, String> attrs) {
-        List<MapMatcher> matchers = new ArrayList<MapMatcher>();
-        // Step 1: find matchers from non_exact_matchers list
-        if (!non_exact_matchers.isEmpty()) {
-            for (MapMatcher matcher : non_exact_matchers) {
+        List<MapMatcher> matchers = new ArrayList<>();
+        // Step 1: find matchers from nonExactMatchers list
+        if (!nonExactMatchers.isEmpty()) {
+            for (MapMatcher matcher : nonExactMatchers) {
                 if (matcher.matches(attrs)) {
                     matchers.add(matcher);
                 }
             }
         }
-        // Step 2: find matchers from exact_matchers list of key
+        // Step 2: find matchers from exactMatchers list of key
         String key = key(attrs);
-        List<MapMatcher> exact_matchers = lookup.get(key);
-        if (exact_matchers != null) {
-            for (MapMatcher matcher : exact_matchers) {
+        List<MapMatcher> exactMatchers = lookup.get(key);
+        if (exactMatchers != null) {
+            for (MapMatcher matcher : exactMatchers) {
                 if (matcher.matches(attrs)) {
                     matchers.add(matcher);
                 }
             }
         }
-        // Step 3: (iff key != DEFAULT) find matchers from exact_matchers of DEFAULT
+        // Step 3: (iff key != DEFAULT) find matchers from exactMatchers of DEFAULT
         if (!DEFAULT.equals(key)) {
-            List<MapMatcher> default_exact_matchers = lookup.get(DEFAULT);
-            if (default_exact_matchers != null) {
-                for (MapMatcher matcher : default_exact_matchers) {
+            List<MapMatcher> defaultExactMatchers = lookup.get(DEFAULT);
+            if (defaultExactMatchers != null) {
+                for (MapMatcher matcher : defaultExactMatchers) {
                     if (matcher.matches(attrs)) {
                         matchers.add(matcher);
                     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/module/id/ModuleId.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/module/id/ModuleId.java b/src/java/org/apache/ivy/core/module/id/ModuleId.java
index b2866b6..1c605f1 100644
--- a/src/java/org/apache/ivy/core/module/id/ModuleId.java
+++ b/src/java/org/apache/ivy/core/module/id/ModuleId.java
@@ -35,7 +35,7 @@ public class ModuleId implements Comparable<ModuleId> {
 
     static final String ENCODE_SEPARATOR = ":#@#:";
 
-    private static final Map<ModuleId, WeakReference<ModuleId>> CACHE = new WeakHashMap<ModuleId, WeakReference<ModuleId>>();
+    private static final Map<ModuleId, WeakReference<ModuleId>> CACHE = new WeakHashMap<>();
 
     /**
      * Returns a ModuleId for the given organization and module name.
@@ -72,7 +72,7 @@ public class ModuleId implements Comparable<ModuleId> {
             }
             if (r == null) {
                 r = moduleId;
-                CACHE.put(r, new WeakReference<ModuleId>(r));
+                CACHE.put(r, new WeakReference<>(r));
             }
         }
 
@@ -85,7 +85,7 @@ public class ModuleId implements Comparable<ModuleId> {
 
     private int hash;
 
-    private Map<String, String> attributes = new HashMap<String, String>();
+    private Map<String, String> attributes = new HashMap<>();
 
     /**
      * Constructor.
@@ -129,11 +129,9 @@ public class ModuleId implements Comparable<ModuleId> {
             return false;
         }
         ModuleId other = (ModuleId) obj;
-        if (other.organisation == null) {
-            return organisation == null && other.name.equals(name);
-        } else {
-            return other.organisation.equals(organisation) && other.name.equals(name);
-        }
+        return (other.organisation == null)
+                ? organisation == null && other.name.equals(name)
+                : other.organisation.equals(organisation) && other.name.equals(name);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/module/id/ModuleRevisionId.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/module/id/ModuleRevisionId.java b/src/java/org/apache/ivy/core/module/id/ModuleRevisionId.java
index a31d50a..9579159 100644
--- a/src/java/org/apache/ivy/core/module/id/ModuleRevisionId.java
+++ b/src/java/org/apache/ivy/core/module/id/ModuleRevisionId.java
@@ -47,7 +47,7 @@ public class ModuleRevisionId extends UnmodifiableExtendableItem {
 
     private static final String REV_STRICT_CHARS_PATTERN = "[a-zA-Z0-9\\-/\\._+=,\\[\\]\\{\\}\\(\\):@]";
 
-    private static final Map<ModuleRevisionId, WeakReference<ModuleRevisionId>> CACHE = new WeakHashMap<ModuleRevisionId, WeakReference<ModuleRevisionId>>();
+    private static final Map<ModuleRevisionId, WeakReference<ModuleRevisionId>> CACHE = new WeakHashMap<>();
 
     /**
      * Pattern to use to matched mrid text representation.
@@ -157,7 +157,7 @@ public class ModuleRevisionId extends UnmodifiableExtendableItem {
             }
             if (r == null) {
                 r = moduleRevisionId;
-                CACHE.put(r, new WeakReference<ModuleRevisionId>(r));
+                CACHE.put(r, new WeakReference<>(r));
             }
         }
 
@@ -259,8 +259,8 @@ public class ModuleRevisionId extends UnmodifiableExtendableItem {
     }
 
     public String encodeToString() {
-        StringBuffer buf = new StringBuffer();
-        Map<String, String> attributes = new HashMap<String, String>(getAttributes());
+        StringBuilder buf = new StringBuilder();
+        Map<String, String> attributes = new HashMap<>(getAttributes());
         attributes.keySet().removeAll(getExtraAttributes().keySet());
         attributes.putAll(getQualifiedExtraAttributes());
 
@@ -280,7 +280,7 @@ public class ModuleRevisionId extends UnmodifiableExtendableItem {
             throw new IllegalArgumentException("badly encoded module revision id: '" + encoded
                     + "'");
         }
-        Map<String, String> attributes = new HashMap<String, String>();
+        Map<String, String> attributes = new HashMap<>();
         for (int i = 0; i < parts.length; i += 2) {
             String attName = parts[i];
             if (!attName.startsWith(ENCODE_PREFIX)) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/module/id/ModuleRules.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/module/id/ModuleRules.java b/src/java/org/apache/ivy/core/module/id/ModuleRules.java
index 128dff4..19b3d67 100644
--- a/src/java/org/apache/ivy/core/module/id/ModuleRules.java
+++ b/src/java/org/apache/ivy/core/module/id/ModuleRules.java
@@ -53,9 +53,9 @@ import org.apache.ivy.util.filter.NoFilter;
  */
 public class ModuleRules<T> {
 
-    private Map<MapMatcher, T> rules = new LinkedHashMap<MapMatcher, T>();
+    private Map<MapMatcher, T> rules = new LinkedHashMap<>();
 
-    private MatcherLookup matcher_lookup = new MatcherLookup();
+    private MatcherLookup matcherLookup = new MatcherLookup();
 
     /**
      * Constructs an empty ModuleRules.
@@ -64,9 +64,9 @@ public class ModuleRules<T> {
     }
 
     private ModuleRules(Map<MapMatcher, T> rules) {
-        this.rules = new LinkedHashMap<MapMatcher, T>(rules);
+        this.rules = new LinkedHashMap<>(rules);
         for (MapMatcher matcher : rules.keySet()) {
-            matcher_lookup.add(matcher);
+            matcherLookup.add(matcher);
         }
     }
 
@@ -83,7 +83,7 @@ public class ModuleRules<T> {
         Checks.checkNotNull(rule, "rule");
 
         rules.put(condition, rule);
-        matcher_lookup.add(condition);
+        matcherLookup.add(condition);
     }
 
     /**
@@ -108,7 +108,7 @@ public class ModuleRules<T> {
      *            the {@link ModuleId} to search the rule for. Must not be <code>null</code>.
      * @return an array of rule objects matching the given {@link ModuleId}.
      */
-    public T[] getRules(ModuleId mid) {
+    public List<T> getRules(ModuleId mid) {
         return getRules(mid.getAttributes(), NoFilter.<T> instance());
     }
 
@@ -172,7 +172,7 @@ public class ModuleRules<T> {
     }
 
     private T getRule(Map<String, String> moduleAttributes, Filter<T> filter) {
-        List<MapMatcher> matchers = matcher_lookup.get(moduleAttributes);
+        List<MapMatcher> matchers = matcherLookup.get(moduleAttributes);
         for (MapMatcher midm : matchers) {
             T rule = rules.get(midm);
             if (filter.accept(rule)) {
@@ -195,23 +195,23 @@ public class ModuleRules<T> {
      *            {@link ModuleRevisionId}. Must not be <code>null</code>.
      * @return an array of rule objects matching the given {@link ModuleRevisionId}.
      */
-    public T[] getRules(ModuleRevisionId mrid, Filter<T> filter) {
+    public List<T> getRules(ModuleRevisionId mrid, Filter<T> filter) {
         Checks.checkNotNull(mrid, "mrid");
         Checks.checkNotNull(filter, "filter");
         Map<String, String> moduleAttributes = mrid.getAttributes();
         return getRules(moduleAttributes, filter);
     }
 
-    private T[] getRules(Map<String, String> moduleAttributes, Filter<T> filter) {
-        List<MapMatcher> matchers = matcher_lookup.get(moduleAttributes);
-        List<T> matchingRules = new ArrayList<T>();
+    private List<T> getRules(Map<String, String> moduleAttributes, Filter<T> filter) {
+        List<MapMatcher> matchers = matcherLookup.get(moduleAttributes);
+        List<T> matchingRules = new ArrayList<>();
         for (MapMatcher midm : matchers) {
             T rule = rules.get(midm);
             if (filter.accept(rule)) {
                 matchingRules.add(rule);
             }
         }
-        return matchingRules.toArray((T[]) new Object[0]);
+        return matchingRules;
     }
 
     /**
@@ -245,8 +245,7 @@ public class ModuleRules<T> {
         return Collections.unmodifiableMap(rules);
     }
 
-    @Override
-    public Object clone() {
-        return new ModuleRules<T>(rules);
+    public ModuleRules<T> clone() {
+        return new ModuleRules<>(rules);
     }
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/module/status/StatusManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/module/status/StatusManager.java b/src/java/org/apache/ivy/core/module/status/StatusManager.java
index 0e355d7..ba57a0e 100644
--- a/src/java/org/apache/ivy/core/module/status/StatusManager.java
+++ b/src/java/org/apache/ivy/core/module/status/StatusManager.java
@@ -20,9 +20,7 @@ package org.apache.ivy.core.module.status;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
-import java.util.ListIterator;
 import java.util.Map;
 
 import org.apache.ivy.core.IvyContext;
@@ -42,7 +40,7 @@ public class StatusManager {
         return IvyContext.getContext().getSettings().getStatusManager();
     }
 
-    private List<Status> status = new ArrayList<Status>();
+    private final List<Status> statuses = new ArrayList<>();
 
     private String defaultStatus;
 
@@ -54,7 +52,7 @@ public class StatusManager {
     private String deliveryStatusListString;
 
     public StatusManager(Status[] status, String defaultStatus) {
-        this.status.addAll(Arrays.asList(status));
+        this.statuses.addAll(Arrays.asList(status));
         this.defaultStatus = defaultStatus;
 
         computeMaps();
@@ -64,7 +62,7 @@ public class StatusManager {
     }
 
     public void addStatus(Status status) {
-        this.status.add(status);
+        this.statuses.add(status);
     }
 
     public void setDefaultStatus(String defaultStatus) {
@@ -72,22 +70,20 @@ public class StatusManager {
     }
 
     public List<Status> getStatuses() {
-        return status;
+        return statuses;
     }
 
     private void computeMaps() {
-        if (status.isEmpty()) {
-            throw new IllegalStateException("badly configured statuses: no status found");
+        if (statuses.isEmpty()) {
+            throw new IllegalStateException("badly configured statuses: none found");
         }
-        statusPriorityMap = new HashMap<String, Integer>();
-        for (ListIterator<Status> iter = status.listIterator(); iter.hasNext();) {
-            Status status = iter.next();
-            statusPriorityMap.put(status.getName(), new Integer(iter.previousIndex()));
+        statusPriorityMap = new HashMap<>();
+        for (Status status : statuses) {
+            statusPriorityMap.put(status.getName(), statuses.indexOf(status));
         }
-        statusIntegrationMap = new HashMap<String, Boolean>();
-        for (Iterator<Status> iter = status.iterator(); iter.hasNext();) {
-            Status status = iter.next();
-            statusIntegrationMap.put(status.getName(), Boolean.valueOf(status.isIntegration()));
+        statusIntegrationMap = new HashMap<>();
+        for (Status status : statuses) {
+            statusIntegrationMap.put(status.getName(), status.isIntegration());
         }
     }
 
@@ -102,19 +98,19 @@ public class StatusManager {
         if (statusPriorityMap == null) {
             computeMaps();
         }
-        Integer priority = (Integer) statusPriorityMap.get(status);
+        Integer priority = statusPriorityMap.get(status);
         if (priority == null) {
             Message.debug("unknown status " + status + ": assuming lowest priority");
             return Integer.MAX_VALUE;
         }
-        return priority.intValue();
+        return priority;
     }
 
     public boolean isIntegration(String status) {
         if (statusIntegrationMap == null) {
             computeMaps();
         }
-        Boolean isIntegration = (Boolean) statusIntegrationMap.get(status);
+        Boolean isIntegration = statusIntegrationMap.get(status);
         if (isIntegration == null) {
             Message.debug("unknown status " + status + ": assuming integration");
             return true;
@@ -124,8 +120,8 @@ public class StatusManager {
 
     public String getDeliveryStatusListString() {
         if (deliveryStatusListString == null) {
-            StringBuffer ret = new StringBuffer();
-            for (Status status : this.status) {
+            StringBuilder ret = new StringBuilder();
+            for (Status status : statuses) {
                 if (!status.isIntegration()) {
                     ret.append(status.getName()).append(",");
                 }
@@ -140,10 +136,10 @@ public class StatusManager {
 
     public String getDefaultStatus() {
         if (defaultStatus == null) {
-            if (status.isEmpty()) {
-                throw new IllegalStateException("badly configured statuses: no status found");
+            if (statuses.isEmpty()) {
+                throw new IllegalStateException("badly configured statuses: none found");
             }
-            defaultStatus = ((Status) status.get(status.size() - 1)).getName();
+            defaultStatus = statuses.get(statuses.size() - 1).getName();
         }
         return defaultStatus;
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/pack/PackagingManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/pack/PackagingManager.java b/src/java/org/apache/ivy/core/pack/PackagingManager.java
index 0271f87..6d9a03e 100644
--- a/src/java/org/apache/ivy/core/pack/PackagingManager.java
+++ b/src/java/org/apache/ivy/core/pack/PackagingManager.java
@@ -55,7 +55,7 @@ public class PackagingManager implements IvySettingsAware {
                 throw new IllegalStateException("Unsupported archive only packing type '"
                         + packings[i] + "' in the streamed chain: " + packaging);
             }
-            ext = ((StreamPacking) packing).getUnpackedExtension(ext);
+            ext = packing.getUnpackedExtension(ext);
         }
         ArchivePacking packing = settings.getPackingRegistry().get(packings[0]);
         if (packing == null) {
@@ -110,12 +110,11 @@ public class PackagingManager implements IvySettingsAware {
                 }
             }
         }
-        final DefaultArtifact unpacked = new DefaultArtifact(artifact.getModuleRevisionId(),
+
+        return new DefaultArtifact(artifact.getModuleRevisionId(),
                 artifact.getPublicationDate(), artifact.getName(),
                 artifact.getType() + "_unpacked", ext);
 
-        return unpacked;
-
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/pack/PackingRegistry.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/pack/PackingRegistry.java b/src/java/org/apache/ivy/core/pack/PackingRegistry.java
index 6688677f..77684dc 100644
--- a/src/java/org/apache/ivy/core/pack/PackingRegistry.java
+++ b/src/java/org/apache/ivy/core/pack/PackingRegistry.java
@@ -22,7 +22,7 @@ import java.util.Map;
 
 public class PackingRegistry {
 
-    private Map<String, ArchivePacking> packings = new HashMap<String, ArchivePacking>();
+    private Map<String, ArchivePacking> packings = new HashMap<>();
 
     public PackingRegistry() {
         // register defaults

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/pack/ZipPacking.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/pack/ZipPacking.java b/src/java/org/apache/ivy/core/pack/ZipPacking.java
index 35da694..76d06ad 100644
--- a/src/java/org/apache/ivy/core/pack/ZipPacking.java
+++ b/src/java/org/apache/ivy/core/pack/ZipPacking.java
@@ -49,9 +49,7 @@ public class ZipPacking extends ArchivePacking {
 
     @Override
     public void unpack(InputStream packed, File dest) throws IOException {
-        ZipInputStream zip = null;
-        try {
-            zip = new ZipInputStream(packed);
+        try (ZipInputStream zip = new ZipInputStream(packed)) {
             ZipEntry entry = null;
             while (((entry = zip.getNextEntry()) != null)) {
                 File f = new File(dest, entry.getName());
@@ -71,14 +69,6 @@ public class ZipPacking extends ArchivePacking {
 
                 f.setLastModified(entry.getTime());
             }
-        } finally {
-            if (zip != null) {
-                try {
-                    zip.close();
-                } catch (IOException e) {
-                    // ignore
-                }
-            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/publish/PublishEngine.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/publish/PublishEngine.java b/src/java/org/apache/ivy/core/publish/PublishEngine.java
index a43240c..9730957 100644
--- a/src/java/org/apache/ivy/core/publish/PublishEngine.java
+++ b/src/java/org/apache/ivy/core/publish/PublishEngine.java
@@ -118,7 +118,7 @@ public class PublishEngine {
                     tmp.deleteOnExit();
 
                     String[] confs = ConfigurationUtils.replaceWildcards(options.getConfs(), md);
-                    Set<String> confsToRemove = new HashSet<String>(Arrays.asList(md
+                    Set<String> confsToRemove = new HashSet<>(Arrays.asList(md
                             .getConfigurationsNames()));
                     confsToRemove.removeAll(Arrays.asList(confs));
 
@@ -183,24 +183,24 @@ public class PublishEngine {
 
     public Collection<Artifact> publish(ModuleDescriptor md, Collection<String> srcArtifactPattern,
             DependencyResolver resolver, PublishOptions options) throws IOException {
-        Collection<Artifact> missing = new ArrayList<Artifact>();
-        Set<Artifact> artifactsSet = new LinkedHashSet<Artifact>();
+        Collection<Artifact> missing = new ArrayList<>();
+        Set<Artifact> artifactsSet = new LinkedHashSet<>();
         String[] confs = ConfigurationUtils.replaceWildcards(options.getConfs(), md);
 
-        for (int i = 0; i < confs.length; i++) {
-            Artifact[] artifacts = md.getArtifacts(confs[i]);
+        for (String conf : confs) {
+            Artifact[] artifacts = md.getArtifacts(conf);
             artifactsSet.addAll(Arrays.asList(artifacts));
         }
         Artifact[] extraArtifacts = options.getExtraArtifacts();
         if (extraArtifacts != null) {
-            for (int i = 0; i < extraArtifacts.length; i++) {
-                artifactsSet.add(new MDArtifact(md, extraArtifacts[i].getName(), extraArtifacts[i]
-                        .getType(), extraArtifacts[i].getExt(), extraArtifacts[i].getUrl(),
-                        extraArtifacts[i].getQualifiedExtraAttributes()));
+            for (Artifact extraArtifact : extraArtifacts) {
+                artifactsSet.add(new MDArtifact(md, extraArtifact.getName(), extraArtifact
+                        .getType(), extraArtifact.getExt(), extraArtifact.getUrl(),
+                        extraArtifact.getQualifiedExtraAttributes()));
             }
         }
         // now collects artifacts files
-        Map<Artifact, File> artifactsFiles = new LinkedHashMap<Artifact, File>();
+        Map<Artifact, File> artifactsFiles = new LinkedHashMap<>();
         for (Artifact artifact : artifactsSet) {
             for (String pattern : srcArtifactPattern) {
                 File artifactFile = settings.resolveFile(IvyPatternHelper.substitute(
@@ -211,7 +211,7 @@ public class PublishEngine {
                 }
             }
             if (!artifactsFiles.containsKey(artifact)) {
-                StringBuffer sb = new StringBuffer();
+                StringBuilder sb = new StringBuilder();
                 sb.append("missing artifact ").append(artifact).append(":\n");
                 for (String pattern : srcArtifactPattern) {
                     sb.append("\t").append(settings.resolveFile(IvyPatternHelper.substitute(pattern, artifact))).append(" file does not exist\n");

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java b/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java
index 03c2441..6ca13ca 100644
--- a/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java
+++ b/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java
@@ -182,14 +182,11 @@ public class ArtifactDownloadReport {
     }
 
     public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
+        if (!(obj instanceof ArtifactDownloadReport)) {
             return false;
         }
-        if (getClass() != obj.getClass()) {
-            return false;
+        if (this == obj) {
+            return true;
         }
         ArtifactDownloadReport other = (ArtifactDownloadReport) obj;
         if (artifact == null) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java b/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java
index 47fa680..c8e2854 100644
--- a/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java
+++ b/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java
@@ -56,13 +56,13 @@ public class ConfigurationResolveReport {
 
     private final ResolveOptions options;
 
-    private Map<IvyNode, List<ArtifactDownloadReport>> dependencyReports = new LinkedHashMap<IvyNode, List<ArtifactDownloadReport>>();
+    private Map<IvyNode, List<ArtifactDownloadReport>> dependencyReports = new LinkedHashMap<>();
 
-    private Map<ModuleRevisionId, IvyNode> dependencies = new LinkedHashMap<ModuleRevisionId, IvyNode>();
+    private Map<ModuleRevisionId, IvyNode> dependencies = new LinkedHashMap<>();
 
     private final ResolveEngine resolveEngine;
 
-    private Map<ModuleId, Collection<IvyNode>> modulesIdsMap = new LinkedHashMap<ModuleId, Collection<IvyNode>>();
+    private Map<ModuleId, Collection<IvyNode>> modulesIdsMap = new LinkedHashMap<>();
 
     private List<ModuleId> modulesIds;
 
@@ -98,7 +98,7 @@ public class ConfigurationResolveReport {
                 parser.parse(previousReportFile);
                 List<ModuleRevisionId> previousDeps = Arrays.asList(parser
                         .getDependencyRevisionIds());
-                HashSet<ModuleRevisionId> previousDepSet = new HashSet<ModuleRevisionId>(
+                HashSet<ModuleRevisionId> previousDepSet = new HashSet<>(
                         previousDeps);
                 hasChanged = !previousDepSet.equals(getModuleRevisionIds());
             } catch (Exception e) {
@@ -126,7 +126,7 @@ public class ConfigurationResolveReport {
      * @return all non evicted and non error dependency mrids
      */
     public Set<ModuleRevisionId> getModuleRevisionIds() {
-        Set<ModuleRevisionId> mrids = new LinkedHashSet<ModuleRevisionId>();
+        Set<ModuleRevisionId> mrids = new LinkedHashSet<>();
         for (IvyNode node : getDependencies()) {
             if (!node.isEvicted(getConfiguration()) && !node.hasProblem()) {
                 mrids.add(node.getResolvedId());
@@ -148,7 +148,7 @@ public class ConfigurationResolveReport {
     public void addDependency(IvyNode node, DownloadReport report) {
         dependencies.put(node.getId(), node);
         dependencies.put(node.getResolvedId(), node);
-        List<ArtifactDownloadReport> adrs = new ArrayList<ArtifactDownloadReport>();
+        List<ArtifactDownloadReport> adrs = new ArrayList<>();
         Artifact[] artifacts = node.getArtifacts(conf);
         for (Artifact artifact : artifacts) {
             ArtifactDownloadReport artifactReport = report.getArtifactReport(artifact);
@@ -174,7 +174,7 @@ public class ConfigurationResolveReport {
     }
 
     public IvyNode[] getUnresolvedDependencies() {
-        List<IvyNode> unresolved = new ArrayList<IvyNode>();
+        List<IvyNode> unresolved = new ArrayList<>();
         for (IvyNode node : getDependencies()) {
             if (node.hasProblem()) {
                 unresolved.add(node);
@@ -184,11 +184,11 @@ public class ConfigurationResolveReport {
     }
 
     private Collection<IvyNode> getDependencies() {
-        return new LinkedHashSet<IvyNode>(dependencies.values());
+        return new LinkedHashSet<>(dependencies.values());
     }
 
     public IvyNode[] getEvictedNodes() {
-        List<IvyNode> evicted = new ArrayList<IvyNode>();
+        List<IvyNode> evicted = new ArrayList<>();
         for (IvyNode node : getDependencies()) {
             if (node.isEvicted(conf)) {
                 evicted.add(node);
@@ -198,7 +198,7 @@ public class ConfigurationResolveReport {
     }
 
     private Set<ModuleRevisionId> getEvictedMrids() {
-        Set<ModuleRevisionId> evicted = new LinkedHashSet<ModuleRevisionId>();
+        Set<ModuleRevisionId> evicted = new LinkedHashSet<>();
         IvyNode[] evictedNodes = getEvictedNodes();
         for (IvyNode node : evictedNodes) {
             evicted.add(node.getId());
@@ -207,7 +207,7 @@ public class ConfigurationResolveReport {
     }
 
     public IvyNode[] getDownloadedNodes() {
-        List<IvyNode> downloaded = new ArrayList<IvyNode>();
+        List<IvyNode> downloaded = new ArrayList<>();
         for (IvyNode node : getDependencies()) {
             if (node.isDownloaded() && node.getRealNode() == node) {
                 downloaded.add(node);
@@ -217,7 +217,7 @@ public class ConfigurationResolveReport {
     }
 
     public IvyNode[] getSearchedNodes() {
-        List<IvyNode> downloaded = new ArrayList<IvyNode>();
+        List<IvyNode> downloaded = new ArrayList<>();
         for (IvyNode node : getDependencies()) {
             if (node.isSearched() && node.getRealNode() == node) {
                 downloaded.add(node);
@@ -252,12 +252,12 @@ public class ConfigurationResolveReport {
                 ModuleId mid = dependency.getResolvedId().getModuleId();
                 Collection<IvyNode> deps = modulesIdsMap.get(mid);
                 if (deps == null) {
-                    deps = new LinkedHashSet<IvyNode>();
+                    deps = new LinkedHashSet<>();
                     modulesIdsMap.put(mid, deps);
                 }
                 deps.add(dependency);
             }
-            modulesIds = new ArrayList<ModuleId>(modulesIdsMap.keySet());
+            modulesIds = new ArrayList<>(modulesIdsMap.keySet());
         }
         return Collections.unmodifiableList(modulesIds);
     }
@@ -305,7 +305,7 @@ public class ConfigurationResolveReport {
      */
     public ArtifactDownloadReport[] getArtifactsReports(DownloadStatus downloadStatus,
             boolean withEvicted) {
-        Collection<ArtifactDownloadReport> all = new LinkedHashSet<ArtifactDownloadReport>();
+        Collection<ArtifactDownloadReport> all = new LinkedHashSet<>();
         Collection<ModuleRevisionId> evictedMrids = null;
         if (!withEvicted) {
             evictedMrids = getEvictedMrids();
@@ -353,9 +353,10 @@ public class ConfigurationResolveReport {
 
     public static ArtifactDownloadReport[] filterOutMergedArtifacts(
             ArtifactDownloadReport[] allFailedReports) {
-        Collection<ArtifactDownloadReport> adrs = new ArrayList<ArtifactDownloadReport>(
+        Collection<ArtifactDownloadReport> adrs = new ArrayList<>(
                 Arrays.asList(allFailedReports));
-        for (Iterator<ArtifactDownloadReport> iterator = adrs.iterator(); iterator.hasNext();) {
+        Iterator<ArtifactDownloadReport> iterator = adrs.iterator();
+        while (iterator.hasNext()) {
             ArtifactDownloadReport adr = iterator.next();
 
             if (adr.getArtifact().getExtraAttribute("ivy:merged") != null) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/report/DownloadReport.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/report/DownloadReport.java b/src/java/org/apache/ivy/core/report/DownloadReport.java
index f2dfcb6..267c7b1 100644
--- a/src/java/org/apache/ivy/core/report/DownloadReport.java
+++ b/src/java/org/apache/ivy/core/report/DownloadReport.java
@@ -19,7 +19,6 @@ package org.apache.ivy.core.report;
 
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -29,29 +28,27 @@ import org.apache.ivy.core.module.descriptor.Artifact;
  *
  */
 public class DownloadReport {
-    private Map artifacts = new HashMap();
+    private final Map<Artifact, ArtifactDownloadReport> artifacts = new HashMap<>();
 
     public void addArtifactReport(ArtifactDownloadReport adr) {
         artifacts.put(adr.getArtifact(), adr);
     }
 
     public ArtifactDownloadReport[] getArtifactsReports() {
-        return (ArtifactDownloadReport[]) artifacts.values().toArray(
-            new ArtifactDownloadReport[artifacts.size()]);
+        return artifacts.values().toArray(new ArtifactDownloadReport[artifacts.size()]);
     }
 
     public ArtifactDownloadReport[] getArtifactsReports(DownloadStatus status) {
-        List ret = new ArrayList(artifacts.size());
-        for (Iterator iter = artifacts.values().iterator(); iter.hasNext();) {
-            ArtifactDownloadReport adr = (ArtifactDownloadReport) iter.next();
+        List<ArtifactDownloadReport> ret = new ArrayList<>(artifacts.size());
+        for (ArtifactDownloadReport adr : artifacts.values()) {
             if (adr.getDownloadStatus() == status) {
                 ret.add(adr);
             }
         }
-        return (ArtifactDownloadReport[]) ret.toArray(new ArtifactDownloadReport[ret.size()]);
+        return ret.toArray(new ArtifactDownloadReport[ret.size()]);
     }
 
     public ArtifactDownloadReport getArtifactReport(Artifact artifact) {
-        return (ArtifactDownloadReport) artifacts.get(artifact);
+        return artifacts.get(artifact);
     }
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/report/ResolveReport.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/report/ResolveReport.java b/src/java/org/apache/ivy/core/report/ResolveReport.java
index 01be748..5bc7e56 100644
--- a/src/java/org/apache/ivy/core/report/ResolveReport.java
+++ b/src/java/org/apache/ivy/core/report/ResolveReport.java
@@ -50,16 +50,16 @@ import org.apache.ivy.util.filter.Filter;
 public class ResolveReport {
     private ModuleDescriptor md;
 
-    private Map<String, ConfigurationResolveReport> confReports = new LinkedHashMap<String, ConfigurationResolveReport>();
+    private Map<String, ConfigurationResolveReport> confReports = new LinkedHashMap<>();
 
-    private List<String> problemMessages = new ArrayList<String>();
+    private List<String> problemMessages = new ArrayList<>();
 
     /**
      * the list of all dependencies resolved, ordered from the more dependent to the less dependent
      */
-    private List<IvyNode> dependencies = new ArrayList<IvyNode>();
+    private List<IvyNode> dependencies = new ArrayList<>();
 
-    private List<Artifact> artifacts = new ArrayList<Artifact>();
+    private List<Artifact> artifacts = new ArrayList<>();
 
     private long resolveTime;
 
@@ -101,8 +101,8 @@ public class ResolveReport {
 
     public void output(ReportOutputter[] outputters, ResolutionCacheManager cacheMgr,
             ResolveOptions options) throws IOException {
-        for (int i = 0; i < outputters.length; i++) {
-            outputters[i].output(this, cacheMgr, options);
+        for (ReportOutputter outputter : outputters) {
+            outputter.output(this, cacheMgr, options);
         }
     }
 
@@ -111,7 +111,7 @@ public class ResolveReport {
     }
 
     public IvyNode[] getEvictedNodes() {
-        Collection<IvyNode> all = new LinkedHashSet<IvyNode>();
+        Collection<IvyNode> all = new LinkedHashSet<>();
         for (ConfigurationResolveReport report : confReports.values()) {
             all.addAll(Arrays.asList(report.getEvictedNodes()));
         }
@@ -119,7 +119,7 @@ public class ResolveReport {
     }
 
     public IvyNode[] getUnresolvedDependencies() {
-        Collection<IvyNode> all = new LinkedHashSet<IvyNode>();
+        Collection<IvyNode> all = new LinkedHashSet<>();
         for (ConfigurationResolveReport report : confReports.values()) {
             all.addAll(Arrays.asList(report.getUnresolvedDependencies()));
         }
@@ -161,7 +161,7 @@ public class ResolveReport {
      */
     public ArtifactDownloadReport[] getArtifactsReports(DownloadStatus downloadStatus,
             boolean withEvicted) {
-        Collection<ArtifactDownloadReport> all = new LinkedHashSet<ArtifactDownloadReport>();
+        Collection<ArtifactDownloadReport> all = new LinkedHashSet<>();
         for (ConfigurationResolveReport report : confReports.values()) {
             ArtifactDownloadReport[] reports = report.getArtifactsReports(downloadStatus,
                 withEvicted);
@@ -171,7 +171,7 @@ public class ResolveReport {
     }
 
     public ArtifactDownloadReport[] getArtifactsReports(ModuleRevisionId mrid) {
-        Collection<ArtifactDownloadReport> all = new LinkedHashSet<ArtifactDownloadReport>();
+        Collection<ArtifactDownloadReport> all = new LinkedHashSet<>();
         for (ConfigurationResolveReport report : confReports.values()) {
             all.addAll(Arrays.asList(report.getDownloadReports(mrid)));
         }
@@ -207,20 +207,18 @@ public class ResolveReport {
     }
 
     public List<String> getAllProblemMessages() {
-        List<String> ret = new ArrayList<String>(problemMessages);
+        List<String> ret = new ArrayList<>(problemMessages);
         for (ConfigurationResolveReport r : confReports.values()) {
-            IvyNode[] unresolved = r.getUnresolvedDependencies();
-            for (int i = 0; i < unresolved.length; i++) {
-                String errMsg = unresolved[i].getProblemMessage();
+            for (IvyNode unresolved : r.getUnresolvedDependencies()) {
+                String errMsg = unresolved.getProblemMessage();
                 if (errMsg.length() > 0) {
-                    ret.add("unresolved dependency: " + unresolved[i].getId() + ": " + errMsg);
+                    ret.add("unresolved dependency: " + unresolved.getId() + ": " + errMsg);
                 } else {
-                    ret.add("unresolved dependency: " + unresolved[i].getId());
+                    ret.add("unresolved dependency: " + unresolved.getId());
                 }
             }
-            ArtifactDownloadReport[] adrs = r.getFailedArtifactsReports();
-            for (int i = 0; i < adrs.length; i++) {
-                ret.add("download failed: " + adrs[i].getArtifact());
+            for (ArtifactDownloadReport adr : r.getFailedArtifactsReports()) {
+                ret.add("download failed: " + adr.getArtifact());
             }
         }
         return ret;
@@ -229,16 +227,15 @@ public class ResolveReport {
     public void setDependencies(List<IvyNode> dependencies, Filter<Artifact> artifactFilter) {
         this.dependencies = dependencies;
         // collect list of artifacts
-        artifacts = new ArrayList<Artifact>();
+        artifacts = new ArrayList<>();
         for (IvyNode dependency : dependencies) {
             if (!dependency.isCompletelyEvicted() && !dependency.hasProblem()) {
                 artifacts.addAll(Arrays.asList(dependency.getSelectedArtifacts(artifactFilter)));
             }
             // update the configurations reports with the dependencies
             // these reports will be completed later with download information, if any
-            String[] dconfs = dependency.getRootModuleConfigurations();
-            for (int j = 0; j < dconfs.length; j++) {
-                ConfigurationResolveReport configurationReport = getConfigurationReport(dconfs[j]);
+            for (String dconf : dependency.getRootModuleConfigurations()) {
+                ConfigurationResolveReport configurationReport = getConfigurationReport(dconf);
                 if (configurationReport != null) {
                     configurationReport.addDependency(dependency);
                 }
@@ -272,8 +269,8 @@ public class ResolveReport {
      * @return a list of ModuleId
      */
     public List<ModuleId> getModuleIds() {
-        List<ModuleId> ret = new ArrayList<ModuleId>();
-        List<IvyNode> sortedDependencies = new ArrayList<IvyNode>(dependencies);
+        List<ModuleId> ret = new ArrayList<>();
+        List<IvyNode> sortedDependencies = new ArrayList<>(dependencies);
         for (IvyNode dependency : sortedDependencies) {
             ModuleId mid = dependency.getResolvedId().getModuleId();
             if (!ret.contains(mid)) {
@@ -329,11 +326,10 @@ public class ResolveReport {
      */
     @SuppressWarnings("unused")
     private String[] getExtendingConfs(String extended) {
-        String[] allConfs = md.getConfigurationsNames();
-        Set<String> extendingConfs = new HashSet<String>();
+        Set<String> extendingConfs = new HashSet<>();
         extendingConfs.add(extended);
-        for (int i = 0; i < allConfs.length; i++) {
-            gatherExtendingConfs(extendingConfs, allConfs[i], extended);
+        for (String conf : md.getConfigurationsNames()) {
+            gatherExtendingConfs(extendingConfs, conf, extended);
         }
         return extendingConfs.toArray(new String[extendingConfs.size()]);
     }
@@ -342,20 +338,20 @@ public class ResolveReport {
         if (extendingConfs.contains(conf)) {
             return true;
         }
-        String[] ext = md.getConfiguration(conf).getExtends();
-        if (ext == null || ext.length == 0) {
+        String[] exts = md.getConfiguration(conf).getExtends();
+        if (exts == null || exts.length == 0) {
             return false;
         }
-        for (int i = 0; i < ext.length; i++) {
-            if (extendingConfs.contains(ext[i])) {
+        for (String ext : exts) {
+            if (extendingConfs.contains(ext)) {
                 extendingConfs.add(conf);
                 return true;
             }
-            if (ext[i].equals(extended)) {
+            if (ext.equals(extended)) {
                 extendingConfs.add(conf);
                 return true;
             }
-            if (gatherExtendingConfs(extendingConfs, ext[i], extended)) {
+            if (gatherExtendingConfs(extendingConfs, ext, extended)) {
                 extendingConfs.add(conf);
                 return true;
             }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java b/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java
index ae769cc..c700b02 100644
--- a/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java
+++ b/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java
@@ -22,13 +22,14 @@ import java.util.Collection;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.TreeSet;
 
 import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
 import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
+import org.apache.ivy.core.module.id.ModuleId;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 import org.apache.ivy.core.resolve.ResolveData;
 import org.apache.ivy.core.resolve.ResolveEngine;
@@ -85,17 +86,17 @@ public class RepositoryManagementEngine {
     /**
      * ModuleDescriptors stored by ModuleRevisionId
      */
-    private Map/* <ModuleRevisionId,ModuleDescriptor> */revisions = new HashMap();
+    private Map<ModuleRevisionId, ModuleDescriptor> revisions = new HashMap<>();
 
     /**
      * ModuleRevisionId for which loading was not possible, with corresponding error message.
      */
-    private Map/* <ModuleRevisionId,String> */errors = new HashMap();
+    private Map<ModuleRevisionId, String> errors = new HashMap<>();
 
     /**
-     * List of ModuleRevisionId per ModuleId.
+     * List of ModuleDescriptor per ModuleId.
      */
-    private Map/* <ModuleId,Collection<ModuleRevisionId>> */modules = new HashMap();
+    private Map<ModuleId, Collection<ModuleDescriptor>> modules = new HashMap<>();
 
     // /////////////////////////////////////////
     // state loaded on #analyze()
@@ -109,12 +110,12 @@ public class RepositoryManagementEngine {
     /**
      * Cache from requested module revision id to actual module revision id.
      */
-    private Map/* <ModuleRevisionId,ModuleRevisionId> */cache = new HashMap();
+    private Map<ModuleRevisionId, ModuleRevisionId> cache = new HashMap<>();
 
     /**
      * list of dependers per ModuleRevisionId.
      */
-    private Map/* <ModuleRevisionId,List<ModuleRevisionId>> */dependers = new HashMap();
+    private Map<ModuleRevisionId, List<ModuleRevisionId>> dependers = new HashMap<>();
 
     // /////////////////////////////////////////
     // dependencies
@@ -148,22 +149,19 @@ public class RepositoryManagementEngine {
         Message.rawinfo("searching modules... ");
         ModuleRevisionId[] mrids = searchModules();
         Message.info("loading repository metadata...");
-        for (int i = 0; i < mrids.length; i++) {
+        for (ModuleRevisionId mrid : mrids) {
             try {
-                loadModuleRevision(mrids[i]);
+                loadModuleRevision(mrid);
             } catch (Exception e) {
                 Message.debug(e);
-                errors.put(mrids[i], e.getMessage());
+                errors.put(mrid, e.getMessage());
             }
         }
         long endTime = System.currentTimeMillis();
-        Message.info("\nrepository loaded: "
-                + modules.size()
-                + " modules; "
-                + revisions.size()
-                + " revisions; "
-                + (settings.dumpMemoryUsage() ? (MemoryUtil.getUsedMemory() - startingMemoryUse)
-                        / KILO + "kB; " : "") + (endTime - startTime) / THOUSAND + "s");
+        Message.info(String.format("\nrepository loaded: %d modules; %d revisions; %s%ss",
+                modules.size(), revisions.size(), settings.dumpMemoryUsage()
+                        ? (MemoryUtil.getUsedMemory() - startingMemoryUse) / KILO + "kB; " : "",
+                (endTime - startTime) / THOUSAND));
         loaded = true;
     }
 
@@ -181,14 +179,11 @@ public class RepositoryManagementEngine {
     public void analyze() {
         ensureLoaded();
         Message.info("\nanalyzing dependencies...");
-        for (Iterator iterator = revisions.values().iterator(); iterator.hasNext();) {
-            ModuleDescriptor md = (ModuleDescriptor) iterator.next();
-            DependencyDescriptor[] dds = md.getDependencies();
-            for (int i = 0; i < dds.length; i++) {
-                ModuleRevisionId dep = getDependency(dds[i]);
+        for (ModuleDescriptor md : revisions.values()) {
+            for (DependencyDescriptor dd : md.getDependencies()) {
+                ModuleRevisionId dep = getDependency(dd);
                 if (dep == null) {
-                    Message.warn("inconsistent repository: declared dependency not found: "
-                            + dds[i]);
+                    Message.warn("inconsistent repository: declared dependency not found: " + dd);
                 } else {
                     getDependers(dep).add(md.getModuleRevisionId());
                 }
@@ -233,30 +228,27 @@ public class RepositoryManagementEngine {
      *             if the repository has not been analyzed yet
      * @see #analyze()
      */
-    public Collection getOrphans() {
+    public Collection<ModuleRevisionId> getOrphans() {
         ensureAnalyzed();
-        Collection orphans = new HashSet(revisions.keySet());
+        Collection<ModuleRevisionId> orphans = new HashSet<>(revisions.keySet());
         orphans.removeAll(dependers.keySet());
         return orphans;
     }
 
     private ModuleRevisionId[] searchModules() {
-        ModuleRevisionId[] mrids = searchEngine.listModules(ModuleRevisionId.newInstance(
+        return searchEngine.listModules(ModuleRevisionId.newInstance(
             PatternMatcher.ANY_EXPRESSION, PatternMatcher.ANY_EXPRESSION,
             PatternMatcher.ANY_EXPRESSION, PatternMatcher.ANY_EXPRESSION),
             RegexpPatternMatcher.INSTANCE);
-        return mrids;
     }
 
     private ModuleRevisionId getDependency(DependencyDescriptor dd) {
         ModuleRevisionId askedMrid = dd.getDependencyRevisionId();
         VersionMatcher vmatcher = settings.getVersionMatcher();
         if (vmatcher.isDynamic(askedMrid)) {
-            ModuleRevisionId mrid = (ModuleRevisionId) cache.get(askedMrid);
+            ModuleRevisionId mrid = cache.get(askedMrid);
             if (mrid == null) {
-                Collection revs = getAllRevisions(askedMrid);
-                for (Iterator iterator = revs.iterator(); iterator.hasNext();) {
-                    ModuleDescriptor md = (ModuleDescriptor) iterator.next();
+                for (ModuleDescriptor md : getAllRevisions(askedMrid)) {
                     if (vmatcher.needModuleDescriptor(askedMrid, md.getResolvedModuleRevisionId())) {
                         if (vmatcher.accept(askedMrid, md)) {
                             mrid = md.getResolvedModuleRevisionId();
@@ -281,10 +273,10 @@ public class RepositoryManagementEngine {
         }
     }
 
-    private Collection getDependers(ModuleRevisionId id) {
-        Collection depders = (Collection) dependers.get(id);
+    private Collection<ModuleRevisionId> getDependers(ModuleRevisionId id) {
+        List<ModuleRevisionId> depders = dependers.get(id);
         if (depders == null) {
-            depders = new ArrayList();
+            depders = new ArrayList<>();
             dependers.put(id, depders);
         }
         return depders;
@@ -302,13 +294,11 @@ public class RepositoryManagementEngine {
         Message.progress();
     }
 
-    private Collection getAllRevisions(ModuleRevisionId id) {
-        Collection revisions = (Collection) modules.get(id.getModuleId());
+    private Collection<ModuleDescriptor> getAllRevisions(ModuleRevisionId id) {
+        Collection<ModuleDescriptor> revisions = modules.get(id.getModuleId());
         if (revisions == null) {
-            revisions = new TreeSet(new Comparator() {
-                public int compare(Object o1, Object o2) {
-                    ModuleDescriptor md1 = (ModuleDescriptor) o1;
-                    ModuleDescriptor md2 = (ModuleDescriptor) o2;
+            revisions = new TreeSet<>(new Comparator<ModuleDescriptor>() {
+                public int compare(ModuleDescriptor md1, ModuleDescriptor md2) {
                     // we use reverse order compared to latest revision, to have latest revision
                     // first
                     return settings.getDefaultLatestStrategy().sort(new ArtifactInfo[] {md1, md2})


[2/7] ant-ivy git commit: Add generics and Java 7 syntax to core

Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriter.java b/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriter.java
index db8c469..2f98464 100644
--- a/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriter.java
+++ b/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriter.java
@@ -109,24 +109,24 @@ public final class XmlModuleDescriptorWriter {
 
     protected static void printDependency(ModuleDescriptor md, DependencyDescriptor dep,
             PrintWriter out) {
-        out.print("<dependency");
-        out.print(" org=\"" + XMLHelper.escape(dep.getDependencyRevisionId().getOrganisation())
-                + "\"");
-        out.print(" name=\"" + XMLHelper.escape(dep.getDependencyRevisionId().getName()) + "\"");
-        if (dep.getDependencyRevisionId().getBranch() != null) {
-            out.print(" branch=\"" + XMLHelper.escape(dep.getDependencyRevisionId().getBranch())
-                    + "\"");
-        }
-        out.print(" rev=\"" + XMLHelper.escape(dep.getDependencyRevisionId().getRevision()) + "\"");
-        if (!dep.getDynamicConstraintDependencyRevisionId().equals(dep.getDependencyRevisionId())) {
-            if (dep.getDynamicConstraintDependencyRevisionId().getBranch() != null) {
+        final ModuleRevisionId dependencyRevisionId = dep.getDependencyRevisionId();
+        out.print(String.format("<dependency org=\"%s\" name=\"%s\"",
+                XMLHelper.escape(dependencyRevisionId.getOrganisation()),
+                XMLHelper.escape(dependencyRevisionId.getName())));
+        if (dependencyRevisionId.getBranch() != null) {
+            out.print(" branch=\"" + XMLHelper.escape(dependencyRevisionId.getBranch()) + "\"");
+        }
+        out.print(" rev=\"" + XMLHelper.escape(dependencyRevisionId.getRevision()) + "\"");
+        final ModuleRevisionId dynamicConstraintDependencyRevisionId =
+                dep.getDynamicConstraintDependencyRevisionId();
+        if (!dynamicConstraintDependencyRevisionId.equals(dependencyRevisionId)) {
+            if (dynamicConstraintDependencyRevisionId.getBranch() != null) {
                 out.print(" branchConstraint=\""
-                        + XMLHelper.escape(dep.getDynamicConstraintDependencyRevisionId()
-                                .getBranch()) + "\"");
+                        + XMLHelper.escape(dynamicConstraintDependencyRevisionId.getBranch())
+                        + "\"");
             }
             out.print(" revConstraint=\""
-                    + XMLHelper
-                            .escape(dep.getDynamicConstraintDependencyRevisionId().getRevision())
+                    + XMLHelper.escape(dynamicConstraintDependencyRevisionId.getRevision())
                     + "\"");
         }
         if (dep.isForce()) {
@@ -138,22 +138,15 @@ public final class XmlModuleDescriptorWriter {
         if (!dep.isTransitive()) {
             out.print(" transitive=\"" + dep.isTransitive() + "\"");
         }
-        out.print(" conf=\"");
-        String[] modConfs = dep.getModuleConfigurations();
-        for (int j = 0; j < modConfs.length; j++) {
-            String[] depConfs = dep.getDependencyConfigurations(modConfs[j]);
-            out.print(XMLHelper.escape(modConfs[j]) + "->");
-            for (int k = 0; k < depConfs.length; k++) {
-                out.print(XMLHelper.escape(depConfs[k]));
-                if (k + 1 < depConfs.length) {
-                    out.print(",");
-                }
-            }
-            if (j + 1 < modConfs.length) {
-                out.print(";");
+        StringBuilder sb = new StringBuilder();
+        for (String modConf : dep.getModuleConfigurations()) {
+            if (sb.length() > 0) {
+                sb.append(";");
             }
+            sb.append(XMLHelper.escape(modConf)).append(
+                    listToPrefixedString(dep.getDependencyConfigurations(modConf), "->"));
         }
-        out.print("\"");
+        out.print(" conf=\"" + sb + "\"");
 
         printExtraAttributes(dep, out, " ");
 
@@ -215,28 +208,17 @@ public final class XmlModuleDescriptorWriter {
         ExcludeRule[] excludes = md.getAllExcludeRules();
         if (excludes.length > 0) {
             for (ExcludeRule exclude : excludes) {
-                out.print("\t\t<exclude");
-                out.print(" org=\""
-                        + XMLHelper.escape(exclude.getId().getModuleId().getOrganisation())
-                        + "\"");
-                out.print(" module=\""
-                        + XMLHelper.escape(exclude.getId().getModuleId().getName()) + "\"");
-                out.print(" artifact=\"" + XMLHelper.escape(exclude.getId().getName()) + "\"");
-                out.print(" type=\"" + XMLHelper.escape(exclude.getId().getType()) + "\"");
-                out.print(" ext=\"" + XMLHelper.escape(exclude.getId().getExt()) + "\"");
+                out.print(String.format("\t\t<exclude org=\"%s\" module=\"%s\" artifact=\"%s\" type=\"%s\" ext=\"%s\"",
+                        XMLHelper.escape(exclude.getId().getModuleId().getOrganisation()),
+                        XMLHelper.escape(exclude.getId().getModuleId().getName()),
+                        XMLHelper.escape(exclude.getId().getName()),
+                        XMLHelper.escape(exclude.getId().getType()),
+                        XMLHelper.escape(exclude.getId().getExt())));
                 String[] ruleConfs = exclude.getConfigurations();
                 if (!Arrays.asList(ruleConfs).equals(Arrays.asList(md.getConfigurationsNames()))) {
-                    out.print(" conf=\"");
-                    for (int k = 0; k < ruleConfs.length; k++) {
-                        out.print(XMLHelper.escape(ruleConfs[k]));
-                        if (k + 1 < ruleConfs.length) {
-                            out.print(",");
-                        }
-                    }
-                    out.print("\"");
+                    out.print(listToPrefixedString(ruleConfs, " conf=\""));
                 }
-                out.print(" matcher=\"" + XMLHelper.escape(exclude.getMatcher().getName())
-                        + "\"");
+                out.print(" matcher=\"" + XMLHelper.escape(exclude.getMatcher().getName()) + "\"");
                 out.println("/>");
             }
         }
@@ -246,28 +228,17 @@ public final class XmlModuleDescriptorWriter {
             ExcludeRule[] excludes) {
         if (excludes.length > 0) {
             for (ExcludeRule exclude : excludes) {
-                out.print("\t\t\t<exclude");
-                out.print(" org=\""
-                        + XMLHelper.escape(exclude.getId().getModuleId().getOrganisation())
-                        + "\"");
-                out.print(" module=\""
-                        + XMLHelper.escape(exclude.getId().getModuleId().getName()) + "\"");
-                out.print(" name=\"" + XMLHelper.escape(exclude.getId().getName()) + "\"");
-                out.print(" type=\"" + XMLHelper.escape(exclude.getId().getType()) + "\"");
-                out.print(" ext=\"" + XMLHelper.escape(exclude.getId().getExt()) + "\"");
+                out.print(String.format("\t\t\t<exclude org=\"%s\" module=\"%s\" name=\"%s\" type=\"%s\" ext=\"%s\"",
+                        XMLHelper.escape(exclude.getId().getModuleId().getOrganisation()),
+                        XMLHelper.escape(exclude.getId().getModuleId().getName()),
+                        XMLHelper.escape(exclude.getId().getName()),
+                        XMLHelper.escape(exclude.getId().getType()),
+                        XMLHelper.escape(exclude.getId().getExt())));
                 String[] ruleConfs = exclude.getConfigurations();
                 if (!Arrays.asList(ruleConfs).equals(Arrays.asList(md.getConfigurationsNames()))) {
-                    out.print(" conf=\"");
-                    for (int k = 0; k < ruleConfs.length; k++) {
-                        out.print(XMLHelper.escape(ruleConfs[k]));
-                        if (k + 1 < ruleConfs.length) {
-                            out.print(",");
-                        }
-                    }
-                    out.print("\"");
+                    out.print(listToPrefixedString(ruleConfs, " conf=\""));
                 }
-                out.print(" matcher=\"" + XMLHelper.escape(exclude.getMatcher().getName())
-                        + "\"");
+                out.print(" matcher=\"" + XMLHelper.escape(exclude.getMatcher().getName()) + "\"");
                 out.println("/>");
             }
         }
@@ -277,23 +248,15 @@ public final class XmlModuleDescriptorWriter {
             IncludeRule[] includes) {
         if (includes.length > 0) {
             for (IncludeRule include : includes) {
-                out.print("\t\t\t<include");
-                out.print(" name=\"" + XMLHelper.escape(include.getId().getName()) + "\"");
-                out.print(" type=\"" + XMLHelper.escape(include.getId().getType()) + "\"");
-                out.print(" ext=\"" + XMLHelper.escape(include.getId().getExt()) + "\"");
+                out.print(String.format("\t\t\t<include name=\"%s\" type=\"%s\" ext=\"%s\"",
+                        XMLHelper.escape(include.getId().getName()),
+                        XMLHelper.escape(include.getId().getType()),
+                        XMLHelper.escape(include.getId().getExt())));
                 String[] ruleConfs = include.getConfigurations();
                 if (!Arrays.asList(ruleConfs).equals(Arrays.asList(md.getConfigurationsNames()))) {
-                    out.print(" conf=\"");
-                    for (int k = 0; k < ruleConfs.length; k++) {
-                        out.print(XMLHelper.escape(ruleConfs[k]));
-                        if (k + 1 < ruleConfs.length) {
-                            out.print(",");
-                        }
-                    }
-                    out.print("\"");
+                    out.print(listToPrefixedString(ruleConfs, " conf=\""));
                 }
-                out.print(" matcher=\"" + XMLHelper.escape(include.getMatcher().getName())
-                        + "\"");
+                out.print(" matcher=\"" + XMLHelper.escape(include.getMatcher().getName()) + "\"");
                 out.println("/>");
             }
         }
@@ -303,20 +266,13 @@ public final class XmlModuleDescriptorWriter {
             DependencyArtifactDescriptor[] depArtifacts) {
         if (depArtifacts.length > 0) {
             for (DependencyArtifactDescriptor depArtifact : depArtifacts) {
-                out.print("\t\t\t<artifact");
-                out.print(" name=\"" + XMLHelper.escape(depArtifact.getName()) + "\"");
-                out.print(" type=\"" + XMLHelper.escape(depArtifact.getType()) + "\"");
-                out.print(" ext=\"" + XMLHelper.escape(depArtifact.getExt()) + "\"");
-                String[] dadconfs = depArtifact.getConfigurations();
-                if (!Arrays.asList(dadconfs).equals(Arrays.asList(md.getConfigurationsNames()))) {
-                    out.print(" conf=\"");
-                    for (int k = 0; k < dadconfs.length; k++) {
-                        out.print(XMLHelper.escape(dadconfs[k]));
-                        if (k + 1 < dadconfs.length) {
-                            out.print(",");
-                        }
-                    }
-                    out.print("\"");
+                out.print(String.format("\t\t\t<artifact name=\"%s\" type=\"%s\" ext=\"%s\"",
+                        XMLHelper.escape(depArtifact.getName()),
+                        XMLHelper.escape(depArtifact.getType()),
+                        XMLHelper.escape(depArtifact.getExt())));
+                String[] dadConfs = depArtifact.getConfigurations();
+                if (!Arrays.asList(dadConfs).equals(Arrays.asList(md.getConfigurationsNames()))) {
+                    out.print(listToPrefixedString(dadConfs, " conf=\""));
                 }
                 printExtraAttributes(depArtifact, out, " ");
                 out.println("/>");
@@ -324,6 +280,20 @@ public final class XmlModuleDescriptorWriter {
         }
     }
 
+    private static String listToPrefixedString(String[] confs, String prefix) {
+        StringBuilder sb = new StringBuilder(prefix);
+        for (String conf : confs) {
+            if (sb.length() > prefix.length()) {
+                sb.append(",");
+            }
+            sb.append(XMLHelper.escape(conf));
+        }
+        if (prefix.endsWith("\"")) {
+            sb.append("\"");
+        }
+        return sb.toString();
+    }
+
     /**
      * Writes the extra attributes of the given {@link ExtendableItem} to the given
      * <tt>PrintWriter</tt>.
@@ -367,11 +337,11 @@ public final class XmlModuleDescriptorWriter {
         out.println("\t<publications>");
         Artifact[] artifacts = md.getAllArtifacts();
         for (Artifact artifact : artifacts) {
-            out.print("\t\t<artifact");
-            out.print(" name=\"" + XMLHelper.escape(artifact.getName()) + "\"");
-            out.print(" type=\"" + XMLHelper.escape(artifact.getType()) + "\"");
-            out.print(" ext=\"" + XMLHelper.escape(artifact.getExt()) + "\"");
-            out.print(" conf=\"" + XMLHelper.escape(getConfs(md, artifact)) + "\"");
+            out.print(String.format("\t\t<artifact name=\"%s\" type=\"%s\" ext=\"%s\" conf=\"%s\"",
+                    XMLHelper.escape(artifact.getName()),
+                    XMLHelper.escape(artifact.getType()),
+                    XMLHelper.escape(artifact.getExt()),
+                    XMLHelper.escape(getConfs(md, artifact))));
             printExtraAttributes(artifact, out, " ");
             out.println("/>");
         }
@@ -399,14 +369,7 @@ public final class XmlModuleDescriptorWriter {
         }
         String[] exts = conf.getExtends();
         if (exts.length > 0) {
-            out.print(" extends=\"");
-            for (int j = 0; j < exts.length; j++) {
-                out.print(XMLHelper.escape(exts[j]));
-                if (j + 1 < exts.length) {
-                    out.print(",");
-                }
-            }
-            out.print("\"");
+            out.print(listToPrefixedString(exts, " extends=\""));
         }
         if (!conf.isTransitive()) {
             out.print(" transitive=\"false\"");
@@ -451,9 +414,10 @@ public final class XmlModuleDescriptorWriter {
             ExtendsDescriptor[] parents = md.getInheritedDescriptors();
             for (ExtendsDescriptor parent : parents) {
                 ModuleRevisionId mrid = parent.getParentRevisionId();
-                out.print("\t\t<extends organisation=\"" + XMLHelper.escape(mrid.getOrganisation())
-                        + "\"" + " module=\"" + XMLHelper.escape(mrid.getName()) + "\""
-                        + " revision=\"" + XMLHelper.escape(mrid.getRevision()) + "\"");
+                out.print(String.format("\t\t<extends organisation=\"%s\" module=\"%s\" revision=\"%s\"",
+                        XMLHelper.escape(mrid.getOrganisation()),
+                        XMLHelper.escape(mrid.getName()),
+                        XMLHelper.escape(mrid.getRevision())));
 
                 String location = parent.getLocation();
                 if (location != null) {
@@ -503,12 +467,7 @@ public final class XmlModuleDescriptorWriter {
         out.print("<");
         out.print(extraInfo.getName());
         for (Entry<String, String> entry : extraInfo.getAttributes().entrySet()) {
-            out.print(" ");
-            out.print(entry.getKey());
-            out.print("=");
-            out.print("\"");
-            out.print(entry.getValue());
-            out.print("\"");
+            out.print(String.format(" %s=\"%s\"", entry.getKey(), entry.getValue()));
         }
         boolean requireClosingTag = false;
         if (extraInfo.getContent() != null && extraInfo.getContent().trim().length() > 0) {
@@ -536,19 +495,15 @@ public final class XmlModuleDescriptorWriter {
         }
     }
 
-    @SuppressWarnings("deprecation")
     private static boolean requireInnerInfoElement(ModuleDescriptor md) {
-        return md.getExtraInfo().size() > 0 || md.getExtraInfos().size() > 0
-                || md.getHomePage() != null
+        return md.getExtraInfos().size() > 0 || md.getHomePage() != null
                 || (md.getDescription() != null && md.getDescription().trim().length() > 0)
                 || md.getLicenses().length > 0 || md.getInheritedDescriptors().length > 0;
     }
 
     private static String getConfs(ModuleDescriptor md, Artifact artifact) {
         StringBuilder ret = new StringBuilder();
-
-        String[] confs = md.getConfigurationsNames();
-        for (String conf : confs) {
+        for (String conf : md.getConfigurationsNames()) {
             if (Arrays.asList(md.getArtifacts(conf)).contains(artifact)) {
                 ret.append(conf).append(",");
             }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/report/XmlReportWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/report/XmlReportWriter.java b/src/java/org/apache/ivy/plugins/report/XmlReportWriter.java
index 9f33c01..deaeec7 100644
--- a/src/java/org/apache/ivy/plugins/report/XmlReportWriter.java
+++ b/src/java/org/apache/ivy/plugins/report/XmlReportWriter.java
@@ -92,7 +92,7 @@ public class XmlReportWriter {
             out.println("\t\t<module organisation=\"" + XMLHelper.escape(mid.getOrganisation())
                     + "\"" + " name=\"" + XMLHelper.escape(mid.getName()) + "\">");
             for (IvyNode dep : report.getNodes(mid)) {
-                ouputRevision(report, out, dependencies, dep);
+                outputRevision(report, out, dependencies, dep);
             }
             out.println("\t\t</module>");
         }
@@ -101,8 +101,8 @@ public class XmlReportWriter {
         out.flush();
     }
 
-    private void ouputRevision(ConfigurationResolveReport report, PrintWriter out,
-            List<ModuleRevisionId> dependencies, IvyNode dep) {
+    private void outputRevision(ConfigurationResolveReport report, PrintWriter out,
+                                List<ModuleRevisionId> dependencies, IvyNode dep) {
         Map<String, String> extraAttributes;
         ModuleDescriptor md = null;
         if (dep.getModuleRevision() != null) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java b/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java
index 1aeda94..e1d013c 100644
--- a/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java
+++ b/src/java/org/apache/ivy/plugins/repository/sftp/SFTPRepository.java
@@ -88,17 +88,11 @@ public class SFTPRepository extends AbstractSshBasedRepository {
     @SuppressWarnings("unchecked")
     public Resource resolveResource(String path) {
         try {
-            ChannelSftp c = getSftpChannel(path);
-
-            // ls() returns a Vector of LsEntry
-            Collection<LsEntry> r = c.ls(getPath(path));
-
+            List<LsEntry> r = getSftpChannel(path).ls(getPath(path));
             if (r != null) {
-                for (LsEntry entry : r) {
-                    SftpATTRS attrs = entry.getAttrs();
-                    return new BasicResource(path, true, attrs.getSize(),
+                SftpATTRS attrs = r.get(0).getAttrs();
+                return new BasicResource(path, true, attrs.getSize(),
                             attrs.getMTime() * MILLIS_PER_SECOND, false);
-                }
             }
         } catch (Exception e) {
             Message.debug("Error while resolving resource " + path, e);
@@ -148,7 +142,7 @@ public class SFTPRepository extends AbstractSshBasedRepository {
         }
     }
 
-    private void mkdirs(String directory, ChannelSftp c) throws IOException, SftpException {
+    private void mkdirs(String directory, ChannelSftp c) throws SftpException {
         try {
             SftpATTRS att = c.stat(directory);
             if (att != null) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java b/src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java
index d96d0c2..3411bd6 100644
--- a/src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java
+++ b/src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java
@@ -23,16 +23,17 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.HashMap;
 import java.util.Locale;
+import java.util.Map;
 
 import org.apache.ivy.plugins.repository.AbstractRepository;
 import org.apache.ivy.util.Credentials;
 import org.apache.ivy.util.CredentialsUtil;
 import org.apache.ivy.util.Message;
 
+import com.jcraft.jsch.ConfigRepository;
 import com.jcraft.jsch.ConfigRepository.Config;
-import com.jcraft.jsch.Session;
 import com.jcraft.jsch.OpenSSHConfig;
-import com.jcraft.jsch.ConfigRepository;
+import com.jcraft.jsch.Session;
 
 public abstract class AbstractSshBasedRepository extends AbstractRepository {
 
@@ -61,7 +62,7 @@ public abstract class AbstractSshBasedRepository extends AbstractRepository {
     /**
      * hashmap of user/hosts with credentials. key is hostname, value is Credentials
      **/
-    private static final HashMap<String, Credentials> credentialsCache = new HashMap<>();
+    private static final Map<String, Credentials> credentialsCache = new HashMap<>();
 
     private static final int MAX_CREDENTIALS_CACHE_SIZE = 100;
 
@@ -113,7 +114,6 @@ public abstract class AbstractSshBasedRepository extends AbstractRepository {
             }
         }
 
-
         if (host == null) {
             throw new IllegalArgumentException(
                     "missing host information. host should be provided either "

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/repository/ssh/Scp.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/repository/ssh/Scp.java b/src/java/org/apache/ivy/plugins/repository/ssh/Scp.java
index 8e5a5e1..0723e25 100644
--- a/src/java/org/apache/ivy/plugins/repository/ssh/Scp.java
+++ b/src/java/org/apache/ivy/plugins/repository/ssh/Scp.java
@@ -491,8 +491,8 @@ public class Scp {
                 throw new IllegalArgumentException("Invalid mode.");
             }
 
-            for (int i = 0; i < mode.length(); i++) {
-                if (!Character.isDigit(mode.charAt(i))) {
+            for (char c : mode.toCharArray()) {
+                if (!Character.isDigit(c)) {
                     throw new IllegalArgumentException("Invalid mode.");
                 }
             }
@@ -500,10 +500,10 @@ public class Scp {
 
         String cmd = "scp -t ";
         if (mode != null) {
-            cmd = cmd + "-p ";
+            cmd += "-p ";
         }
         if (remoteTargetDir != null && remoteTargetDir.length() > 0) {
-            cmd = cmd + "-d " + remoteTargetDir;
+            cmd += "-d " + remoteTargetDir;
         }
 
         try {
@@ -549,9 +549,9 @@ public class Scp {
      * @throws RemoteScpException
      *             in case of problems on the target system (connection ok)
      */
+    @SuppressWarnings("unused")
     public void get(String remoteFile, OutputStream localTarget) throws IOException,
             RemoteScpException {
-    @SuppressWarnings("unused")
         ChannelExec channel = null;
 
         if ((remoteFile == null) || (localTarget == null)) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/repository/ssh/SshCache.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/repository/ssh/SshCache.java b/src/java/org/apache/ivy/plugins/repository/ssh/SshCache.java
index f056380..04ac8b5 100644
--- a/src/java/org/apache/ivy/plugins/repository/ssh/SshCache.java
+++ b/src/java/org/apache/ivy/plugins/repository/ssh/SshCache.java
@@ -263,7 +263,6 @@ public final class SshCache {
      * @param session
      *            to connect to
      * @return channelSftp or null if not successful (channel not existent or dead)
-     * @throws IOException if something goes wrong
      */
     public ChannelSftp getChannelSftp(Session session) throws IOException {
         ChannelSftp channel = null;

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java b/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java
index 4939931..46b380c 100644
--- a/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java
+++ b/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java
@@ -160,7 +160,7 @@ public class SshRepository extends AbstractSshBasedRepository {
      */
     public List<String> list(String parent) throws IOException {
         Message.debug("SShRepository:list called: " + parent);
-        ArrayList<String> result = new ArrayList<>();
+        List<String> result = new ArrayList<>();
         Session session = null;
         ChannelExec channel = null;
         session = getSession(parent);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/repository/vfs/VfsRepository.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/repository/vfs/VfsRepository.java b/src/java/org/apache/ivy/plugins/repository/vfs/VfsRepository.java
index b220250..4706cb6 100644
--- a/src/java/org/apache/ivy/plugins/repository/vfs/VfsRepository.java
+++ b/src/java/org/apache/ivy/plugins/repository/vfs/VfsRepository.java
@@ -164,7 +164,7 @@ public class VfsRepository extends AbstractRepository {
      * @see "Supported File Systems in the jakarta-commons-vfs documentation"
      */
     public List<String> list(String vfsURI) throws IOException {
-        ArrayList<String> list = new ArrayList<>();
+        List<String> list = new ArrayList<>();
         Message.debug("list called for URI" + vfsURI);
         FileObject resourceImpl = getVFSManager().resolveFile(vfsURI);
         Message.debug("resourceImpl=" + resourceImpl.toString());

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/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 3250e96..bf22346 100644
--- a/src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java
+++ b/src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java
@@ -86,7 +86,7 @@ public class VfsResource implements Resource {
      */
     public List<String> getChildren() {
         init();
-        ArrayList<String> list = new ArrayList<>();
+        List<String> list = new ArrayList<>();
         try {
             if ((resourceImpl != null) && resourceImpl.exists()
                     && (resourceImpl.getType() == FileType.FOLDER)) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpRepository.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpRepository.java b/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpRepository.java
index 861fe3c..463facc 100644
--- a/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpRepository.java
+++ b/src/java/org/apache/ivy/plugins/repository/vsftp/VsftpRepository.java
@@ -221,7 +221,7 @@ public class VsftpRepository extends AbstractRepository {
         initIvy();
         try {
             if (!parent.endsWith("/")) {
-                parent = parent + "/";
+                parent += "/";
             }
             String response = sendCommand("ls -l " + parent, true, true);
             if (response.startsWith("ls")) {
@@ -229,12 +229,12 @@ public class VsftpRepository extends AbstractRepository {
             }
             String[] lines = response.split("\n");
             List<String> ret = new ArrayList<>(lines.length);
-            for (int i = 0; i < lines.length; i++) {
-                while (lines[i].endsWith("\r") || lines[i].endsWith("\n")) {
-                    lines[i] = lines[i].substring(0, lines[i].length() - 1);
+            for (String line : lines) {
+                while (line.endsWith("\r") || line.endsWith("\n")) {
+                    line = line.substring(0, line.length() - 1);
                 }
-                if (lines[i].trim().length() != 0) {
-                    ret.add(parent + lines[i].substring(lines[i].lastIndexOf(' ') + 1));
+                if (line.trim().length() != 0) {
+                    ret.add(parent + line.substring(line.lastIndexOf(' ') + 1));
                 }
             }
             return ret;
@@ -383,12 +383,13 @@ public class VsftpRepository extends AbstractRepository {
                     try {
                         int c;
                         boolean getPrompt = false;
-                        // the reading is done in a for loop making five attempts to read the stream
+                        // the reading is done in a loop making five attempts to read the stream
                         // if we do not reach the next prompt
-                        for (int attempts = 0; !getPrompt && attempts < MAX_READ_PROMPT_ATTEMPT; attempts++) {
+                        int attempt = 0;
+                        while (!getPrompt && attempt < MAX_READ_PROMPT_ATTEMPT) {
                             while ((c = in.read()) != -1) {
-                                attempts = 0; // we manage to read something, reset numer of
-                                // attempts
+                                // we managed to read something, reset number of attempts
+                                attempt = 0;
                                 response.append((char) c);
                                 if (response.length() >= PROMPT.length()
                                         && response.substring(response.length() - PROMPT.length(),
@@ -405,6 +406,7 @@ public class VsftpRepository extends AbstractRepository {
                                     break;
                                 }
                             }
+                            attempt++;
                         }
                         if (getPrompt) {
                             // wait enough for error stream to be fully read
@@ -457,12 +459,14 @@ public class VsftpRepository extends AbstractRepository {
         } else if (!done[0]) {
             if (reader != null && reader.isAlive()) {
                 reader.interrupt();
-                for (int i = 0; i < MAX_READER_ALIVE_ATTEMPT && reader.isAlive(); i++) {
+                int attempt = 0;
+                while (attempt < MAX_READER_ALIVE_ATTEMPT && reader.isAlive()) {
                     try {
                         Thread.sleep(READER_ALIVE_SLEEP_TIME);
                     } catch (InterruptedException e) {
                         break;
                     }
+                    attempt++;
                 }
                 if (reader.isAlive()) {
                     reader.stop(); // no way to interrupt it non abruptly

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/resolver/AbstractPatternsBasedResolver.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/resolver/AbstractPatternsBasedResolver.java b/src/java/org/apache/ivy/plugins/resolver/AbstractPatternsBasedResolver.java
index 5a3765b..6872f30 100644
--- a/src/java/org/apache/ivy/plugins/resolver/AbstractPatternsBasedResolver.java
+++ b/src/java/org/apache/ivy/plugins/resolver/AbstractPatternsBasedResolver.java
@@ -24,7 +24,6 @@ import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
@@ -92,16 +91,17 @@ public abstract class AbstractPatternsBasedResolver extends BasicResolver {
         List<ResolvedResource> resolvedResources = new ArrayList<>();
         Set<String> foundRevisions = new HashSet<>();
         boolean dynamic = getSettings().getVersionMatcher().isDynamic(moduleRevision);
-        boolean stop = false;
-        for (Iterator<String> iter = patternList.iterator(); iter.hasNext() && !stop;) {
-            String pattern = iter.next();
+        for (String pattern : patternList) {
             ResolvedResource rres = findResourceUsingPattern(moduleRevision, pattern, artifact,
                 rmdparser, date);
             if ((rres != null) && !foundRevisions.contains(rres.getRevision())) {
                 // only add the first found ResolvedResource for each revision
                 foundRevisions.add(rres.getRevision());
                 resolvedResources.add(rres);
-                stop = !dynamic; // stop iterating if we are not searching a dynamic revision
+                if (!dynamic) {
+                    // stop iterating if we are not searching a dynamic revision
+                    break;
+                }
             }
         }
 
@@ -158,6 +158,7 @@ public abstract class AbstractPatternsBasedResolver extends BasicResolver {
         return names;
     }
 
+    @SuppressWarnings("unchecked")
     @Override
     public Map<String, String>[] listTokenValues(String[] tokens, Map<String, Object> criteria) {
         Set<Map<String, String>> result = new LinkedHashSet<>();

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java b/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java
index 1d66f45..59148de 100644
--- a/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java
+++ b/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java
@@ -174,6 +174,7 @@ public abstract class AbstractResolver implements DependencyResolver, HasLatestS
         return new String[0];
     }
 
+    @SuppressWarnings("unchecked")
     public Map<String, String>[] listTokenValues(String[] tokens, Map<String, Object> criteria) {
         return new Map[0];
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java b/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
index b45db09..780cc05 100644
--- a/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
+++ b/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
@@ -95,7 +95,6 @@ public abstract class BasicResolver extends AbstractResolver {
      * converted in a message (either error or verbose) and returning null
      * </p>
      */
-    @SuppressWarnings("serial")
     private static class UnresolvedDependencyException extends RuntimeException {
         private static final long serialVersionUID = 1L;
 
@@ -660,8 +659,8 @@ public abstract class BasicResolver extends AbstractResolver {
         List<ModuleRevisionId> foundBlacklisted = new ArrayList<>();
         IvyContext context = IvyContext.getContext();
 
-        for (ListIterator<ArtifactInfo> iter = sorted.listIterator(sorted.size()); iter
-                .hasPrevious();) {
+        ListIterator<ArtifactInfo> iter = sorted.listIterator(sorted.size());
+        while (iter.hasPrevious()) {
             ResolvedResource rres = (ResolvedResource) iter.previous();
             // we start by filtering based on information already available,
             // even though we don't even know if the resource actually exist.
@@ -780,7 +779,7 @@ public abstract class BasicResolver extends AbstractResolver {
     }
 
     protected void logAttempt(String attempt) {
-        Artifact currentArtifact = (Artifact) IvyContext.getContext().get(getName() + ".artifact");
+        Artifact currentArtifact = IvyContext.getContext().get(getName() + ".artifact");
         if (currentArtifact != null) {
             logArtifactAttempt(currentArtifact, attempt);
         } else {
@@ -795,10 +794,9 @@ public abstract class BasicResolver extends AbstractResolver {
             Message.warn("  " + m);
         }
         for (Map.Entry<Artifact, List<String>> entry : artattempts.entrySet()) {
-            Artifact art = entry.getKey();
             List<String> attempts = entry.getValue();
             if (attempts != null) {
-                Message.warn("  -- artifact " + art + ":");
+                Message.warn("  -- artifact " + entry.getKey() + ":");
                 for (String m : attempts) {
                     Message.warn("  " + m);
                 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/resolver/ChainResolver.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/resolver/ChainResolver.java b/src/java/org/apache/ivy/plugins/resolver/ChainResolver.java
index 18ce352..5581f41 100644
--- a/src/java/org/apache/ivy/plugins/resolver/ChainResolver.java
+++ b/src/java/org/apache/ivy/plugins/resolver/ChainResolver.java
@@ -180,6 +180,7 @@ public class ChainResolver extends AbstractResolver {
         return null;
     }
 
+    @SuppressWarnings("unchecked")
     @Override
     public Map<String, String>[] listTokenValues(String[] tokens, Map<String, Object> criteria) {
         Set<Map<String, String>> result = new HashSet<>();

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/resolver/FileSystemResolver.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/resolver/FileSystemResolver.java b/src/java/org/apache/ivy/plugins/resolver/FileSystemResolver.java
index f217693..c2bb7c9 100644
--- a/src/java/org/apache/ivy/plugins/resolver/FileSystemResolver.java
+++ b/src/java/org/apache/ivy/plugins/resolver/FileSystemResolver.java
@@ -155,18 +155,17 @@ public class FileSystemResolver extends RepositoryResolver {
                 Message.info("\tpublish committed: moved " + transactionTempDir + " \n\t\tto "
                         + transactionDestDir);
             } catch (IOException ex) {
-                IOException commitEx;
+                String message;
                 try {
                     getFileRepository().delete(transactionTempDir);
-                    commitEx = new IOException("publish transaction commit error for "
-                            + transactionDestDir + ": rolled back");
+                    message = "publish transaction commit error for "
+                                + transactionDestDir + ": rolled back";
                 } catch (IOException deleteEx) {
-                    commitEx = new IOException("publish transaction commit error for "
-                            + transactionDestDir + ": rollback impossible either, "
-                            + "please remove " + transactionTempDir + " manually");
+                    message = "publish transaction commit error for "
+                                + transactionDestDir + ": rollback impossible either, "
+                                + "please remove " + transactionTempDir + " manually";
                 }
-                commitEx.initCause(ex);
-                throw commitEx;
+                throw new IOException(message, ex);
             } finally {
                 closeTransaction();
             }
@@ -203,9 +202,9 @@ public class FileSystemResolver extends RepositoryResolver {
     protected Collection<String> filterNames(Collection<String> values) {
         if (supportTransaction()) {
             values = super.filterNames(values);
-            for (Iterator<String> iterator = values.iterator(); iterator.hasNext();) {
-                String v = iterator.next();
-                if (v.endsWith(TRANSACTION_DESTINATION_SUFFIX)) {
+            Iterator<String> iterator = values.iterator();
+            while (iterator.hasNext()) {
+                if (iterator.next().endsWith(TRANSACTION_DESTINATION_SUFFIX)) {
                     iterator.remove();
                 }
             }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/resolver/VsftpResolver.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/resolver/VsftpResolver.java b/src/java/org/apache/ivy/plugins/resolver/VsftpResolver.java
index 07a81da..0ccbacf 100644
--- a/src/java/org/apache/ivy/plugins/resolver/VsftpResolver.java
+++ b/src/java/org/apache/ivy/plugins/resolver/VsftpResolver.java
@@ -20,7 +20,7 @@ package org.apache.ivy.plugins.resolver;
 import org.apache.ivy.plugins.repository.vsftp.VsftpRepository;
 
 /**
- * This resolver uses SecureCRT vsft to access an sftp server. It supports listing and publishing.
+ * This resolver uses SecureCRT vsftp to access an sftp server. It supports listing and publishing.
  * The server host should absolutely be set using setHost, so does the username.
  */
 public class VsftpResolver extends RepositoryResolver {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java b/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java
index 33b880b..d800d0e 100644
--- a/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java
+++ b/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java
@@ -149,11 +149,12 @@ public class OpenPGPSignatureGenerator implements SignatureGenerator {
                 new BcKeyFingerprintCalculator());
 
         PGPSecretKey key = null;
-        for (Iterator<PGPSecretKeyRing> it = pgpSec.getKeyRings(); key == null && it.hasNext();) {
+        Iterator<PGPSecretKeyRing> it = pgpSec.getKeyRings();
+        while (key == null && it.hasNext()) {
             PGPSecretKeyRing kRing = it.next();
 
-            for (Iterator<PGPSecretKey> it2 = kRing.getSecretKeys(); key == null
-                    && it2.hasNext();) {
+            Iterator<PGPSecretKey> it2 = kRing.getSecretKeys();
+            while (key == null && it2.hasNext()) {
                 PGPSecretKey k = it2.next();
                 if ((keyId == null) && k.isSigningKey()) {
                     key = k;

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/trigger/AbstractTrigger.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/trigger/AbstractTrigger.java b/src/java/org/apache/ivy/plugins/trigger/AbstractTrigger.java
index c588867..5aae2dd 100644
--- a/src/java/org/apache/ivy/plugins/trigger/AbstractTrigger.java
+++ b/src/java/org/apache/ivy/plugins/trigger/AbstractTrigger.java
@@ -33,7 +33,7 @@ import org.apache.ivy.util.filter.Filter;
  * @since 1.4
  */
 public abstract class AbstractTrigger implements Trigger {
-    private Filter filter;
+    private Filter<IvyEvent> filter;
 
     private String event;
 
@@ -41,14 +41,14 @@ public abstract class AbstractTrigger implements Trigger {
 
     private String matcher = PatternMatcher.EXACT;
 
-    public Filter getEventFilter() {
+    public Filter<IvyEvent> getEventFilter() {
         if (filter == null) {
             filter = createFilter();
         }
         return filter;
     }
 
-    private Filter createFilter() {
+    private Filter<IvyEvent> createFilter() {
         return new IvyEventFilter(getEvent(), getFilter(), getPatternMatcher());
     }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/trigger/Trigger.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/trigger/Trigger.java b/src/java/org/apache/ivy/plugins/trigger/Trigger.java
index b8987e9..ea4ee5a 100644
--- a/src/java/org/apache/ivy/plugins/trigger/Trigger.java
+++ b/src/java/org/apache/ivy/plugins/trigger/Trigger.java
@@ -17,9 +17,10 @@
  */
 package org.apache.ivy.plugins.trigger;
 
+import org.apache.ivy.core.event.IvyEvent;
 import org.apache.ivy.core.event.IvyListener;
 import org.apache.ivy.util.filter.Filter;
 
 public interface Trigger extends IvyListener {
-    Filter getEventFilter();
+    Filter<IvyEvent> getEventFilter();
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/plugins/version/ChainVersionMatcher.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/version/ChainVersionMatcher.java b/src/java/org/apache/ivy/plugins/version/ChainVersionMatcher.java
index 5ab5d71..412e883 100644
--- a/src/java/org/apache/ivy/plugins/version/ChainVersionMatcher.java
+++ b/src/java/org/apache/ivy/plugins/version/ChainVersionMatcher.java
@@ -117,7 +117,8 @@ public class ChainVersionMatcher extends AbstractVersionMatcher {
     public boolean accept(ModuleRevisionId askedMrid, ModuleRevisionId foundMrid) {
         Checks.checkNotNull(askedMrid, "askedMrid");
         Checks.checkNotNull(foundMrid, "foundMrid");
-        for (Iterator<VersionMatcher> iter = matchers.iterator(); iter.hasNext();) {
+        Iterator<VersionMatcher> iter = matchers.iterator();
+        while (iter.hasNext()) {
             VersionMatcher matcher = iter.next();
             if (!iter.hasNext() || matcher.isDynamic(askedMrid)) {
                 return matcher.accept(askedMrid, foundMrid);
@@ -129,7 +130,8 @@ public class ChainVersionMatcher extends AbstractVersionMatcher {
     public boolean needModuleDescriptor(ModuleRevisionId askedMrid, ModuleRevisionId foundMrid) {
         Checks.checkNotNull(askedMrid, "askedMrid");
         Checks.checkNotNull(foundMrid, "foundMrid");
-        for (Iterator<VersionMatcher> iter = matchers.iterator(); iter.hasNext();) {
+        Iterator<VersionMatcher> iter = matchers.iterator();
+        while (iter.hasNext()) {
             VersionMatcher matcher = iter.next();
             if (!iter.hasNext() || matcher.isDynamic(askedMrid)) {
                 return matcher.needModuleDescriptor(askedMrid, foundMrid);
@@ -141,7 +143,8 @@ public class ChainVersionMatcher extends AbstractVersionMatcher {
     public boolean accept(ModuleRevisionId askedMrid, ModuleDescriptor foundMD) {
         Checks.checkNotNull(askedMrid, "askedMrid");
         Checks.checkNotNull(foundMD, "foundMD");
-        for (Iterator<VersionMatcher> iter = matchers.iterator(); iter.hasNext();) {
+        Iterator<VersionMatcher> iter = matchers.iterator();
+        while (iter.hasNext()) {
             VersionMatcher matcher = iter.next();
             if (!iter.hasNext() || matcher.isDynamic(askedMrid)) {
                 return matcher.accept(askedMrid, foundMD);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/tools/analyser/JarJarDependencyAnalyser.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/tools/analyser/JarJarDependencyAnalyser.java b/src/java/org/apache/ivy/tools/analyser/JarJarDependencyAnalyser.java
index ecb0cbd..6ba2466 100644
--- a/src/java/org/apache/ivy/tools/analyser/JarJarDependencyAnalyser.java
+++ b/src/java/org/apache/ivy/tools/analyser/JarJarDependencyAnalyser.java
@@ -39,21 +39,22 @@ public class JarJarDependencyAnalyser implements DependencyAnalyser {
     }
 
     public ModuleDescriptor[] analyze(JarModule[] modules) {
-
         StringBuilder jarjarCmd = new StringBuilder("java -jar \"").append(
             jarjarjarLocation.getAbsolutePath()).append("\" --find --level=jar ");
         Map<String, JarModule> jarModulesMap = new HashMap<>();
         Map<ModuleRevisionId, DefaultModuleDescriptor> mds = new HashMap<>();
 
-        for (int i = 0; i < modules.length; i++) {
-            jarModulesMap.put(modules[i].getJar().getAbsolutePath(), modules[i]);
+        for (JarModule jarModule : modules) {
+            jarModulesMap.put(jarModule.getJar().getAbsolutePath(), jarModule);
             DefaultModuleDescriptor md = DefaultModuleDescriptor.newBasicInstance(
-                modules[i].getMrid(), new Date(modules[i].getJar().lastModified()));
-            mds.put(modules[i].getMrid(), md);
-            jarjarCmd.append("\"").append(modules[i].getJar().getAbsolutePath()).append("\"");
-            if (i + 1 < modules.length) {
-                jarjarCmd.append(File.pathSeparator);
-            }
+                    jarModule.getMrid(), new Date(jarModule.getJar().lastModified()));
+            mds.put(jarModule.getMrid(), md);
+            jarjarCmd.append("\"").append(jarModule.getJar().getAbsolutePath()).append("\"");
+            jarjarCmd.append(File.pathSeparator);
+        }
+
+        if (modules.length > 0) {
+            jarjarCmd.setLength(jarjarCmd.length() - 1);
         }
 
         Message.verbose("jarjar command: " + jarjarCmd);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/util/Configurator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/util/Configurator.java b/src/java/org/apache/ivy/util/Configurator.java
index 893ed50..deac6c8 100644
--- a/src/java/org/apache/ivy/util/Configurator.java
+++ b/src/java/org/apache/ivy/util/Configurator.java
@@ -202,7 +202,7 @@ public class Configurator {
         public Object play(Configurator conf, Map<String, String> attValues,
                            Map<String, List<MacroRecord>> macroRecords) {
             for (Attribute att : attributes.values()) {
-               String val = attValues.get(att.getName());
+                String val = attValues.get(att.getName());
                 if (val == null) {
                     if (att.getDefault() == null) {
                         throw new IllegalArgumentException("attribute " + att.getName()
@@ -393,11 +393,11 @@ public class Configurator {
             return addConfiguredMethods.get(name);
         }
 
-        public Method getAddMethod(Class type) {
+        public Method getAddMethod(Class<?> type) {
             return getTypeMatchingMethod(type, typeAddMethods);
         }
 
-        public Method getAddConfiguredMethod(Class type) {
+        public Method getAddConfiguredMethod(Class<?> type) {
             return getTypeMatchingMethod(type, typeAddConfiguredMethods);
         }
 
@@ -432,13 +432,13 @@ public class Configurator {
     // stack in which the top is current configured object descriptor
     private Stack<ObjectDescriptor> objectStack = new Stack<>();
 
-    private static final List TRUE_VALUES = Arrays.asList("true", "yes", "on");
+    private static final List<String> TRUE_VALUES = Arrays.asList("true", "yes", "on");
 
     public void typeDef(String name, String className) throws ClassNotFoundException {
         typeDef(name, Class.forName(className));
     }
 
-    public void typeDef(String name, Class clazz) {
+    public void typeDef(String name, Class<?> clazz) {
         typedefs.put(name, clazz);
     }
 
@@ -458,6 +458,7 @@ public class Configurator {
         objectStack.push(new ObjectDescriptor(object, name));
     }
 
+    @SuppressWarnings("rawtypes")
     public Object startCreateChild(String name) {
         if (objectStack.isEmpty()) {
             throw new IllegalStateException("set root before creating child");
@@ -488,7 +489,7 @@ public class Configurator {
             setCurrent(macro, name);
             return macro;
         }
-        Class childClass = typedefs.get(name);
+        Class<?> childClass = typedefs.get(name);
         Method addChild = null;
         try {
             if (childClass != null) {
@@ -512,7 +513,7 @@ public class Configurator {
                 if (addChild != null) {
                     childClass = addChild.getParameterTypes()[0];
                     if (Map.class == childClass) {
-                        child = new HashMap();
+                        child = new HashMap<>();
                     } else {
                         child = childClass.newInstance();
                     }
@@ -547,7 +548,9 @@ public class Configurator {
         }
     }
 
-    private Object addChild(ObjectDescriptor parentOD, Class childClass, String name, Object child)
+    @SuppressWarnings("rawtypes")
+    private Object addChild(ObjectDescriptor parentOD, Class<?> childClass, String name,
+            Object child)
             throws InstantiationException, IllegalAccessException, InvocationTargetException {
         Object parent = parentOD.getObject();
         if (parent instanceof MacroRecord) {
@@ -569,7 +572,7 @@ public class Configurator {
         if (addChild != null) {
             if (child == null) {
                 if (Map.class == childClass) {
-                    child = new HashMap();
+                    child = new HashMap<>();
                 } else {
                     child = childClass.newInstance();
                 }
@@ -589,6 +592,7 @@ public class Configurator {
         return (od.getObject() instanceof MacroDef);
     }
 
+    @SuppressWarnings("unchecked")
     public void setAttribute(String attributeName, String value) {
         if (objectStack.isEmpty()) {
             throw new IllegalStateException("set root before setting attribute");
@@ -726,7 +730,7 @@ public class Configurator {
         macrodefs.put(macrodef.getName(), macrodef);
     }
 
-    public Class getTypeDef(String name) {
+    public Class<?> getTypeDef(String name) {
         return typedefs.get(name);
     }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/util/Credentials.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/util/Credentials.java b/src/java/org/apache/ivy/util/Credentials.java
index 719e7af..6e70d63 100644
--- a/src/java/org/apache/ivy/util/Credentials.java
+++ b/src/java/org/apache/ivy/util/Credentials.java
@@ -82,16 +82,8 @@ public class Credentials {
     }
 
     public boolean equals(Object o) {
-        if (o == null) {
-            return false;
-        }
-
-        if (o instanceof Credentials) {
-            Credentials c = (Credentials) o;
-            return getKey().equals(c.getKey());
-        }
+        return o instanceof Credentials && getKey().equals(((Credentials) o).getKey());
 
-        return false;
     }
 
     public int hashCode() {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/util/FileUtil.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/util/FileUtil.java b/src/java/org/apache/ivy/util/FileUtil.java
index d78afee..56ada7e 100644
--- a/src/java/org/apache/ivy/util/FileUtil.java
+++ b/src/java/org/apache/ivy/util/FileUtil.java
@@ -749,8 +749,8 @@ public final class FileUtil {
 
         @Override
         public String toString() {
-            return "Dissected Path [root=" + root + ", remainingPath=" +
-                    remainingPath + "]";
+            return "Dissected Path [root=" + root + ", remainingPath="
+                    + remainingPath + "]";
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/util/MemoryUtil.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/util/MemoryUtil.java b/src/java/org/apache/ivy/util/MemoryUtil.java
index db425f1..dc80730 100644
--- a/src/java/org/apache/ivy/util/MemoryUtil.java
+++ b/src/java/org/apache/ivy/util/MemoryUtil.java
@@ -35,7 +35,7 @@ public final class MemoryUtil {
      *            the class to evaluate.
      * @return the estimated size of instance, in bytes.
      */
-    public static long sizeOf(Class clazz) {
+    public static long sizeOf(Class<?> clazz) {
         long size = 0;
         Object[] objects = new Object[SAMPLING_SIZE];
         try {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/util/MessageLoggerHelper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/util/MessageLoggerHelper.java b/src/java/org/apache/ivy/util/MessageLoggerHelper.java
index beb4ad0..093efe1 100644
--- a/src/java/org/apache/ivy/util/MessageLoggerHelper.java
+++ b/src/java/org/apache/ivy/util/MessageLoggerHelper.java
@@ -21,7 +21,7 @@ import java.util.List;
 
 public final class MessageLoggerHelper {
     public static void sumupProblems(MessageLogger logger) {
-        List myProblems = logger.getProblems();
+        List<String> myProblems = logger.getProblems();
         if (myProblems.size() > 0) {
             List<String> myWarns = logger.getWarns();
             List<String> myErrors = logger.getErrors();

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/util/StringUtils.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/util/StringUtils.java b/src/java/org/apache/ivy/util/StringUtils.java
index 26ade15..6e4931a 100644
--- a/src/java/org/apache/ivy/util/StringUtils.java
+++ b/src/java/org/apache/ivy/util/StringUtils.java
@@ -142,8 +142,7 @@ public final class StringUtils {
             return null;
         }
         StringBuilder buf = new StringBuilder();
-        for (int i = 0; i < str.length(); i++) {
-            char c = str.charAt(i);
+        for (char c : str.toCharArray()) {
             if (c >= SHIFTS.length) {
                 throw new IllegalArgumentException(
                         "encrypt method can only be used with simple characters. '" + c
@@ -166,8 +165,8 @@ public final class StringUtils {
             return null;
         }
         StringBuilder buf = new StringBuilder();
-        for (int i = 0; i < str.length(); i++) {
-            buf.append(decrypt(str.charAt(i)));
+        for (char c : str.toCharArray()) {
+            buf.append(decrypt(c));
         }
         return buf.toString();
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/util/filter/AndFilter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/util/filter/AndFilter.java b/src/java/org/apache/ivy/util/filter/AndFilter.java
index f747469..bfa945f 100644
--- a/src/java/org/apache/ivy/util/filter/AndFilter.java
+++ b/src/java/org/apache/ivy/util/filter/AndFilter.java
@@ -17,25 +17,25 @@
  */
 package org.apache.ivy.util.filter;
 
-public class AndFilter implements Filter {
-    private Filter op1;
+public class AndFilter<T> implements Filter<T> {
+    private Filter<T> op1;
 
-    private Filter op2;
+    private Filter<T> op2;
 
-    public AndFilter(Filter op1, Filter op2) {
+    public AndFilter(Filter<T> op1, Filter<T> op2) {
         this.op1 = op1;
         this.op2 = op2;
     }
 
-    public Filter getOp1() {
+    public Filter<T> getOp1() {
         return op1;
     }
 
-    public Filter getOp2() {
+    public Filter<T> getOp2() {
         return op2;
     }
 
-    public boolean accept(Object o) {
+    public boolean accept(T o) {
         return op1.accept(o) && op2.accept(o);
     }
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/util/filter/FilterHelper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/util/filter/FilterHelper.java b/src/java/org/apache/ivy/util/filter/FilterHelper.java
index 04e8011..7664c09 100644
--- a/src/java/org/apache/ivy/util/filter/FilterHelper.java
+++ b/src/java/org/apache/ivy/util/filter/FilterHelper.java
@@ -73,9 +73,9 @@ public final class FilterHelper {
             return col;
         }
         Collection<T> ret = new ArrayList<>(col);
-        for (Iterator<T> iter = ret.iterator(); iter.hasNext();) {
-            T element = iter.next();
-            if (!filter.accept(element)) {
+        Iterator<T> iter = ret.iterator();
+        while (iter.hasNext()) {
+            if (!filter.accept(iter.next())) {
                 iter.remove();
             }
         }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/util/filter/NoFilter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/util/filter/NoFilter.java b/src/java/org/apache/ivy/util/filter/NoFilter.java
index cdaf88d..c89aab5 100644
--- a/src/java/org/apache/ivy/util/filter/NoFilter.java
+++ b/src/java/org/apache/ivy/util/filter/NoFilter.java
@@ -17,18 +17,20 @@
  */
 package org.apache.ivy.util.filter;
 
-public final class NoFilter implements Filter {
+public final class NoFilter<T> implements Filter<T> {
 
+    @SuppressWarnings("rawtypes")
     public static final Filter INSTANCE = new NoFilter();
 
+    @SuppressWarnings("unchecked")
     public static <T> Filter<T> instance() {
-        return INSTANCE;
+        return (Filter<T>) INSTANCE;
     }
 
     private NoFilter() {
     }
 
-    public boolean accept(Object o) {
+    public boolean accept(T o) {
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/util/filter/NotFilter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/util/filter/NotFilter.java b/src/java/org/apache/ivy/util/filter/NotFilter.java
index 7d55004..3401d60 100644
--- a/src/java/org/apache/ivy/util/filter/NotFilter.java
+++ b/src/java/org/apache/ivy/util/filter/NotFilter.java
@@ -17,18 +17,18 @@
  */
 package org.apache.ivy.util.filter;
 
-public class NotFilter implements Filter {
-    private Filter op;
+public class NotFilter<T> implements Filter<T> {
+    private Filter<T> op;
 
-    public NotFilter(Filter op) {
+    public NotFilter(Filter<T> op) {
         this.op = op;
     }
 
-    public Filter getOp() {
+    public Filter<T> getOp() {
         return op;
     }
 
-    public boolean accept(Object o) {
+    public boolean accept(T o) {
         return !op.accept(o);
     }
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/util/filter/OrFilter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/util/filter/OrFilter.java b/src/java/org/apache/ivy/util/filter/OrFilter.java
index 46f1571..d372b02 100644
--- a/src/java/org/apache/ivy/util/filter/OrFilter.java
+++ b/src/java/org/apache/ivy/util/filter/OrFilter.java
@@ -17,25 +17,25 @@
  */
 package org.apache.ivy.util.filter;
 
-public class OrFilter implements Filter {
-    private Filter op1;
+public class OrFilter<T> implements Filter<T> {
+    private Filter<T> op1;
 
-    private Filter op2;
+    private Filter<T> op2;
 
-    public OrFilter(Filter op1, Filter op2) {
+    public OrFilter(Filter<T> op1, Filter<T> op2) {
         this.op1 = op1;
         this.op2 = op2;
     }
 
-    public Filter getOp1() {
+    public Filter<T> getOp1() {
         return op1;
     }
 
-    public Filter getOp2() {
+    public Filter<T> getOp2() {
         return op2;
     }
 
-    public boolean accept(Object o) {
+    public boolean accept(T o) {
         return op1.accept(o) || op2.accept(o);
     }
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/util/url/HttpClientHandler.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/util/url/HttpClientHandler.java b/src/java/org/apache/ivy/util/url/HttpClientHandler.java
index f0a0c96..2c25026 100644
--- a/src/java/org/apache/ivy/util/url/HttpClientHandler.java
+++ b/src/java/org/apache/ivy/util/url/HttpClientHandler.java
@@ -177,7 +177,7 @@ public class HttpClientHandler extends AbstractURLHandler {
         return UNAVAILABLE;
     }
 
-    private boolean checkStatusCode(URL url, HttpMethodBase method) throws IOException {
+    private boolean checkStatusCode(URL url, HttpMethodBase method) {
         int status = method.getStatusCode();
         if (status == HttpStatus.SC_OK) {
             return true;

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/util/url/URLHandlerRegistry.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/util/url/URLHandlerRegistry.java b/src/java/org/apache/ivy/util/url/URLHandlerRegistry.java
index 6baa758..8cf62de 100644
--- a/src/java/org/apache/ivy/util/url/URLHandlerRegistry.java
+++ b/src/java/org/apache/ivy/util/url/URLHandlerRegistry.java
@@ -50,7 +50,7 @@ public final class URLHandlerRegistry {
             // http-client-3.x is available
             Class.forName("org.apache.commons.httpclient.params.HttpClientParams");
 
-            Class handler = Class.forName("org.apache.ivy.util.url.HttpClientHandler");
+            Class<?> handler = Class.forName("org.apache.ivy.util.url.HttpClientHandler");
             Message.verbose("jakarta commons httpclient detected: using it for http downloading");
             return (URLHandler) handler.newInstance();
         } catch (ClassNotFoundException e) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/custom-classpath/org/apache/ivy/plugins/resolver/CustomResolver.java
----------------------------------------------------------------------
diff --git a/test/custom-classpath/org/apache/ivy/plugins/resolver/CustomResolver.java b/test/custom-classpath/org/apache/ivy/plugins/resolver/CustomResolver.java
index cb6b772..082c735 100644
--- a/test/custom-classpath/org/apache/ivy/plugins/resolver/CustomResolver.java
+++ b/test/custom-classpath/org/apache/ivy/plugins/resolver/CustomResolver.java
@@ -20,7 +20,7 @@ package org.apache.ivy.plugins.resolver;
 /**
  * This custom resolver is only used to test custom classpath, and has absolutely
  * no interest in itself
- * 
+ *
  */
 public class CustomResolver extends IBiblioResolver {
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/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 ac8b669..e20144b 100644
--- a/test/java/org/apache/ivy/TestHelper.java
+++ b/test/java/org/apache/ivy/TestHelper.java
@@ -17,6 +17,8 @@
  */
 package org.apache.ivy;
 
+import static org.junit.Assert.assertEquals;
+
 import java.io.File;
 import java.io.IOException;
 import java.lang.reflect.Field;
@@ -49,8 +51,6 @@ import org.apache.tools.ant.DefaultLogger;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.taskdefs.Delete;
 
-import static org.junit.Assert.assertEquals;
-
 public class TestHelper {
 
     public static DefaultArtifact newArtifact(String organisation, String module, String revision,
@@ -120,7 +120,7 @@ public class TestHelper {
     /**
      * Returns an array of {@link ModuleRevisionId} corresponding to the given comma separated list
      * of their text representation.
-     * 
+     *
      * @param mrids
      *            the text representation of the {@link ModuleRevisionId}
      * @return an array of {@link ModuleRevisionId}
@@ -134,25 +134,25 @@ public class TestHelper {
      * Parses a string representation of a module descriptor in micro ivy format.
      * <p>
      * Examples:
-     * 
+     *
      * <pre>
      * #A;1
      * </pre>
-     * 
+     *
      * <hr/>
-     * 
+     *
      * <pre>
      * #A;2-> #B;[1.0,1.5]
      * </pre>
-     * 
+     *
      * <hr/>
-     * 
+     *
      * <pre>
      * #A;3-> { #B;[1.0,1.5] #C;[2.0,2.5] }
      * </pre>
-     * 
+     *
      * </p>
-     * 
+     *
      * @param microIvy
      *            the micro ivy description of the module descriptor
      * @return the parsed module descriptor
@@ -197,7 +197,7 @@ public class TestHelper {
     /**
      * Parses a collection of module descriptors in the micro ivy format, separated by double semi
      * columns.
-     * 
+     *
      * @param microIvy
      *            the text representation of the collection of module descriptors
      * @return the collection of module descriptors parsed
@@ -212,7 +212,7 @@ public class TestHelper {
 
     /**
      * Fills a repository with a set of module, using empty files for published artifacts.
-     * 
+     *
      * @param resolver
      *            the resolver to use to publish the modules
      * @param mds
@@ -256,6 +256,8 @@ public class TestHelper {
      * <p>
      * When finished you should call {@link #cleanTestRepository()}
      * </p>
+     *
+     * @return FileSystemResolver
      */
     public static FileSystemResolver newTestRepository() {
         FileSystemResolver testRepository = new FileSystemResolver();
@@ -270,7 +272,7 @@ public class TestHelper {
 
     /**
      * Cleans up the test repository.
-     * 
+     *
      * @see #newTestRepository()
      */
     public static void cleanTestRepository() {
@@ -279,7 +281,7 @@ public class TestHelper {
 
     /**
      * Cleans up the test repository and cache.
-     * 
+     *
      * @see #newTestRepository()
      */
     public static void cleanTest() {
@@ -290,7 +292,7 @@ public class TestHelper {
     /**
      * Init a test resolver as default, useful combined with
      * {@link #fillRepository(DependencyResolver, Collection)}.
-     * 
+     *
      * @param settings
      *            the settings to initialize
      * @return test settings
@@ -304,7 +306,7 @@ public class TestHelper {
 
     /**
      * Create basic resolve data using the given settings
-     * 
+     *
      * @param settings
      *            the settings to use to create the resolve data
      * @return basic resolve data useful for testing
@@ -316,7 +318,7 @@ public class TestHelper {
 
     /**
      * Create basic resolve options using the given settings
-     * 
+     *
      * @param settings
      *            the settings to use to create the resolve options
      * @return the basic resolve options, useful for testing

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/ant/AntCallTriggerTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/AntCallTriggerTest.java b/test/java/org/apache/ivy/ant/AntCallTriggerTest.java
index 1383366..1892ac3 100644
--- a/test/java/org/apache/ivy/ant/AntCallTriggerTest.java
+++ b/test/java/org/apache/ivy/ant/AntCallTriggerTest.java
@@ -26,7 +26,6 @@ import java.io.PrintStream;
 import java.util.Vector;
 
 import org.apache.ivy.util.FileUtil;
-
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.BuildLogger;
 import org.apache.tools.ant.DefaultLogger;
@@ -37,7 +36,6 @@ import org.apache.tools.ant.Project;
 import org.apache.tools.ant.ProjectHelper;
 import org.apache.tools.ant.input.DefaultInputHandler;
 import org.apache.tools.ant.input.InputHandler;
-
 import org.junit.After;
 import org.junit.Test;
 
@@ -163,6 +161,8 @@ public class AntCallTriggerTest {
      *
      * @param project
      *            The project to add listeners to. Must not be <code>null</code>.
+     * @param level
+     *            log level
      */
     protected void addBuildListeners(Project project, int level) {
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/ant/IvyCacheFilesetTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/IvyCacheFilesetTest.java b/test/java/org/apache/ivy/ant/IvyCacheFilesetTest.java
index b02c78c..cc52a66 100644
--- a/test/java/org/apache/ivy/ant/IvyCacheFilesetTest.java
+++ b/test/java/org/apache/ivy/ant/IvyCacheFilesetTest.java
@@ -17,27 +17,29 @@
  */
 package org.apache.ivy.ant;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.File;
 import java.util.Arrays;
 import java.util.List;
 
 import org.apache.ivy.TestHelper;
 import org.apache.ivy.core.report.ArtifactDownloadReport;
-
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.DirectoryScanner;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.taskdefs.Delete;
 import org.apache.tools.ant.types.FileSet;
-
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 
-import static org.junit.Assert.*;
-
 public class IvyCacheFilesetTest {
 
     private IvyCacheFileset fileset;
@@ -263,7 +265,7 @@ public class IvyCacheFilesetTest {
         );
         assertNotNull(fileset.requireCommonBaseDir(reports));
     }
-    
+
     private ArtifactDownloadReport artifactDownloadReport(File localFile) {
         ArtifactDownloadReport report = new ArtifactDownloadReport(null);
         report.setLocalFile(localFile);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/ant/IvyConfigureTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/IvyConfigureTest.java b/test/java/org/apache/ivy/ant/IvyConfigureTest.java
index 8568f62..11fdd69 100644
--- a/test/java/org/apache/ivy/ant/IvyConfigureTest.java
+++ b/test/java/org/apache/ivy/ant/IvyConfigureTest.java
@@ -17,6 +17,10 @@
  */
 package org.apache.ivy.ant;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
 import java.io.File;
 import java.util.List;
 
@@ -27,18 +31,14 @@ import org.apache.ivy.core.settings.IvySettings;
 import org.apache.ivy.plugins.resolver.DependencyResolver;
 import org.apache.ivy.plugins.resolver.IBiblioResolver;
 import org.apache.ivy.plugins.resolver.IvyRepResolver;
-
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.types.Reference;
-
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 
-import static org.junit.Assert.*;
-
 public class IvyConfigureTest {
     private IvyConfigure configure;
 
@@ -56,7 +56,6 @@ public class IvyConfigureTest {
         configure.setProject(project);
     }
 
-    @SuppressWarnings("deprecation")
     private Ivy getIvyInstance() {
         IvyTask task = new IvyTask() {
             public void doExecute() throws BuildException {
@@ -65,7 +64,7 @@ public class IvyConfigureTest {
         task.setProject(project);
         task.init();
 
-        Reference ref = new Reference(configure.getSettingsId());
+        Reference ref = new Reference(task.getProject(), configure.getSettingsId());
         // ref.setProject(project);
         task.setSettingsRef(ref);
         return task.getIvyInstance();

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/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 0e94d4d..5bcc689 100644
--- a/test/java/org/apache/ivy/ant/IvyDeliverTest.java
+++ b/test/java/org/apache/ivy/ant/IvyDeliverTest.java
@@ -135,10 +135,9 @@ public class IvyDeliverTest {
 
        try (BufferedReader merged = new BufferedReader(new FileReader(delivered));
             BufferedReader expected = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("ivy-extends-merged.xml")))) {
-           for (String mergeLine = merged.readLine(), expectedLine = expected.readLine();
-                mergeLine != null && expectedLine != null;
-                mergeLine = merged.readLine(), expectedLine = expected.readLine()) {
-
+           String mergeLine = merged.readLine();
+           String expectedLine = expected.readLine();
+           while (mergeLine != null && expectedLine != null) {
                mergeLine = mergeLine.trim();
                expectedLine = expectedLine.trim();
 
@@ -148,6 +147,8 @@ public class IvyDeliverTest {
                }
 
                ++lineNo;
+               mergeLine = merged.readLine();
+               expectedLine = expected.readLine();
            }
        }
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/ant/IvyPublishTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/IvyPublishTest.java b/test/java/org/apache/ivy/ant/IvyPublishTest.java
index 077df58..e20c0ad 100644
--- a/test/java/org/apache/ivy/ant/IvyPublishTest.java
+++ b/test/java/org/apache/ivy/ant/IvyPublishTest.java
@@ -138,9 +138,9 @@ public class IvyPublishTest {
             try (BufferedReader expected = new BufferedReader(new InputStreamReader(getClass()
                     .getResourceAsStream(expectedFilename)))) {
                 int lineNo = 1;
-                for (String mergeLine = merged.readLine(), expectedLine = expected.readLine(); mergeLine != null
-                        && expectedLine != null; mergeLine = merged.readLine(), expectedLine = expected
-                        .readLine()) {
+                String mergeLine = merged.readLine();
+                String expectedLine = expected.readLine();
+                while (mergeLine != null && expectedLine != null) {
 
                     // strip timestamps for the comparison
                     if (mergeLine.contains("<info")) {
@@ -153,6 +153,8 @@ public class IvyPublishTest {
                     }
 
                     ++lineNo;
+                    mergeLine = merged.readLine();
+                    expectedLine = expected.readLine();
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/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 3103553..2639087 100644
--- a/test/java/org/apache/ivy/ant/IvyResourcesTest.java
+++ b/test/java/org/apache/ivy/ant/IvyResourcesTest.java
@@ -79,7 +79,7 @@ public class IvyResourcesTest {
         dependency.setName("mod1.2");
         dependency.setRev("2.0");
 
-        List files = asList(resources);
+        List<File> files = asList(resources);
         assertEquals(1, files.size());
         assertEquals(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar"),
             files.get(0));
@@ -97,7 +97,7 @@ public class IvyResourcesTest {
         dependency.setName("mod2.3");
         dependency.setRev("0.7");
 
-        List files = asList(resources);
+        List<File> files = asList(resources);
         assertEquals(5, files.size());
         assertTrue(files.contains(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar",
             "jar")));
@@ -124,7 +124,7 @@ public class IvyResourcesTest {
         dependency.setRev("0.10");
         dependency.setConf("A");
 
-        List files = asList(resources);
+        List<File> files = asList(resources);
         assertEquals(3, files.size());
         assertTrue(files.contains(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar",
             "jar")));
@@ -147,7 +147,7 @@ public class IvyResourcesTest {
         dependency.setRev("0.10");
         dependency.setConf("B");
 
-        List files = asList(resources);
+        List<File> files = asList(resources);
         assertEquals(4, files.size());
         assertTrue(files.contains(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar",
             "jar")));
@@ -176,7 +176,7 @@ public class IvyResourcesTest {
         exclude.setOrg("org1");
         exclude.setModule("mod1.1");
 
-        List files = asList(resources);
+        List<File> files = asList(resources);
         assertEquals(3, files.size());
         assertTrue(files.contains(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar",
             "jar")));
@@ -227,7 +227,7 @@ public class IvyResourcesTest {
         IvyDependencyInclude include = dependency.createInclude();
         include.setName("art22-1");
 
-        List files = asList(resources);
+        List<File> files = asList(resources);
         assertEquals(2, files.size());
         assertTrue(files.contains(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar",
             "jar")));

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/ant/IvyTaskTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/IvyTaskTest.java b/test/java/org/apache/ivy/ant/IvyTaskTest.java
index ab23d3e..cfa9a05 100644
--- a/test/java/org/apache/ivy/ant/IvyTaskTest.java
+++ b/test/java/org/apache/ivy/ant/IvyTaskTest.java
@@ -65,7 +65,6 @@ public class IvyTaskTest {
         assertEquals("myvalue", settings.getVariables().getVariable("myproperty"));
     }
 
-    @SuppressWarnings("deprecation")
     @Test
     public void testReferencedSettings() throws MalformedURLException {
         Project p = TestHelper.newProject();
@@ -82,7 +81,7 @@ public class IvyTaskTest {
             }
         };
         task.setProject(p);
-        task.setSettingsRef(new Reference("mySettings"));
+        task.setSettingsRef(new Reference(task.getProject(), "mySettings"));
         Ivy ivy = task.getIvyInstance();
         assertNotNull(ivy);
         IvySettings settings = ivy.getSettings();

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/ant/testutil/AntTestListener.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/testutil/AntTestListener.java b/test/java/org/apache/ivy/ant/testutil/AntTestListener.java
index ef89fa6..73866d2 100644
--- a/test/java/org/apache/ivy/ant/testutil/AntTestListener.java
+++ b/test/java/org/apache/ivy/ant/testutil/AntTestListener.java
@@ -30,6 +30,9 @@ public class AntTestListener implements BuildListener {
 
     /**
      * Constructs a test listener which will ignore log events above the given level.
+     *
+     * @param logLevel
+     *            ditto
      */
     public AntTestListener(int logLevel) {
         this.logLevel = logLevel;
@@ -37,6 +40,9 @@ public class AntTestListener implements BuildListener {
 
     /**
      * Fired before any targets are started.
+     *
+     * @param event
+     *            BuildEvent
      */
     public void buildStarted(BuildEvent event) {
     }
@@ -45,6 +51,8 @@ public class AntTestListener implements BuildListener {
      * Fired after the last target has finished. This event will still be thrown if an error
      * occurred during the build.
      *
+     * @param event
+     *            BuildEvent
      * @see BuildEvent#getException()
      */
     public void buildFinished(BuildEvent event) {
@@ -53,6 +61,8 @@ public class AntTestListener implements BuildListener {
     /**
      * Fired when a target is started.
      *
+     * @param event
+     *            BuildEvent
      * @see BuildEvent#getTarget()
      */
     public void targetStarted(BuildEvent event) {
@@ -63,6 +73,8 @@ public class AntTestListener implements BuildListener {
      * Fired when a target has finished. This event will still be thrown if an error occurred during
      * the build.
      *
+     * @param event
+     *            BuildEvent
      * @see BuildEvent#getException()
      */
     public void targetFinished(BuildEvent event) {
@@ -72,6 +84,8 @@ public class AntTestListener implements BuildListener {
     /**
      * Fired when a task is started.
      *
+     * @param event
+     *            BuildEvent
      * @see BuildEvent#getTask()
      */
     public void taskStarted(BuildEvent event) {
@@ -82,6 +96,8 @@ public class AntTestListener implements BuildListener {
      * Fired when a task has finished. This event will still be throw if an error occurred during
      * the build.
      *
+     * @param event
+     *            BuildEvent
      * @see BuildEvent#getException()
      */
     public void taskFinished(BuildEvent event) {
@@ -91,6 +107,8 @@ public class AntTestListener implements BuildListener {
     /**
      * Fired whenever a message is logged.
      *
+     * @param event
+     *            BuildEvent
      * @see BuildEvent#getMessage()
      * @see BuildEvent#getPriority()
      */

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/test/java/org/apache/ivy/core/cache/ModuleDescriptorMemoryCacheTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/cache/ModuleDescriptorMemoryCacheTest.java b/test/java/org/apache/ivy/core/cache/ModuleDescriptorMemoryCacheTest.java
index 9052307..d28a4a1 100644
--- a/test/java/org/apache/ivy/core/cache/ModuleDescriptorMemoryCacheTest.java
+++ b/test/java/org/apache/ivy/core/cache/ModuleDescriptorMemoryCacheTest.java
@@ -17,6 +17,9 @@
  */
 package org.apache.ivy.core.cache;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 import java.io.File;
 import java.io.IOException;
 import java.text.ParseException;
@@ -28,10 +31,6 @@ import org.apache.ivy.core.settings.IvySettings;
 import org.apache.ivy.plugins.parser.ParserSettings;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-
 public class ModuleDescriptorMemoryCacheTest {
 
     ModuleDescriptorMemoryCache cache = new ModuleDescriptorMemoryCache(2);
@@ -99,8 +98,8 @@ public class ModuleDescriptorMemoryCacheTest {
         ModuleDescriptorProviderMock providerMock3 = new ModuleDescriptorProviderMock(md3);
         cache.get(url1, ivySettings, false, providerMock);
         cache.get(url2, ivySettings, false, providerMock2);
-        cache.get(url3, ivySettings, false, providerMock3);// adding 1
-        cache.get(url1, ivySettings, false, providerMock1b);// and one has been removed
+        cache.get(url3, ivySettings, false, providerMock3); // adding 1
+        cache.get(url1, ivySettings, false, providerMock1b); // and one has been removed
         providerMock1b.assertCalled();
     }
 
@@ -114,7 +113,7 @@ public class ModuleDescriptorMemoryCacheTest {
         cache.get(url2, ivySettings, false, providerMock2);
         cache.get(url1, ivySettings, false, null);
         cache.get(url3, ivySettings, false, providerMock3);
-        cache.get(url1, ivySettings, false, null);// and one has been removed
+        cache.get(url1, ivySettings, false, null); // and one has been removed
         cache.get(url2, ivySettings, false, providerMock2b);
         providerMock2b.assertCalled();
     }


[6/7] ant-ivy git commit: Add generics and Java 7 syntax to core

Posted by ja...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/check/CheckEngine.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/check/CheckEngine.java b/src/java/org/apache/ivy/core/check/CheckEngine.java
index 8f85f4b..d48df8a 100644
--- a/src/java/org/apache/ivy/core/check/CheckEngine.java
+++ b/src/java/org/apache/ivy/core/check/CheckEngine.java
@@ -22,7 +22,6 @@ import java.net.URL;
 import java.text.ParseException;
 import java.util.Arrays;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Set;
 
 import org.apache.ivy.core.module.descriptor.Artifact;
@@ -67,56 +66,47 @@ public class CheckEngine {
             // check publications if possible
             if (resolvername != null) {
                 DependencyResolver resolver = settings.getResolver(resolvername);
-                String[] confs = md.getConfigurationsNames();
-                Set artifacts = new HashSet();
-                for (int i = 0; i < confs.length; i++) {
-                    artifacts.addAll(Arrays.asList(md.getArtifacts(confs[i])));
+                Set<Artifact> artifacts = new HashSet<>();
+                for (String conf : md.getConfigurationsNames()) {
+                    artifacts.addAll(Arrays.asList(md.getArtifacts(conf)));
                 }
-                for (Iterator iter = artifacts.iterator(); iter.hasNext();) {
-                    Artifact art = (Artifact) iter.next();
-                    if (!resolver.exists(art)) {
-                        Message.info("declared publication not found: " + art);
+                for (Artifact artifact : artifacts) {
+                    if (!resolver.exists(artifact)) {
+                        Message.info("declared publication not found: " + artifact);
                         result = false;
                     }
                 }
             }
 
             // check dependencies
-            DependencyDescriptor[] dds = md.getDependencies();
             ResolveData data = new ResolveData(resolveEngine, new ResolveOptions());
-            for (int i = 0; i < dds.length; i++) {
+            for (DependencyDescriptor dd : md.getDependencies()) {
                 // check master confs
-                String[] masterConfs = dds[i].getModuleConfigurations();
-                for (int j = 0; j < masterConfs.length; j++) {
-                    if (!"*".equals(masterConfs[j].trim())
-                            && md.getConfiguration(masterConfs[j]) == null) {
+                for (String masterConf : dd.getModuleConfigurations()) {
+                    if (!"*".equals(masterConf.trim()) && md.getConfiguration(masterConf) == null) {
                         Message.info("dependency required in non existing conf for " + ivyFile
-                                + " \n\tin " + dds[i] + ": " + masterConfs[j]);
+                                + " \n\tin " + dd + ": " + masterConf);
                         result = false;
                     }
                 }
                 // resolve
-                DependencyResolver resolver = settings
-                        .getResolver(dds[i].getDependencyRevisionId());
-                ResolvedModuleRevision rmr = resolver.getDependency(dds[i], data);
+                DependencyResolver resolver = settings.getResolver(dd.getDependencyRevisionId());
+                ResolvedModuleRevision rmr = resolver.getDependency(dd, data);
                 if (rmr == null) {
-                    Message.info("dependency not found in " + ivyFile + ":\n\t" + dds[i]);
+                    Message.info("dependency not found in " + ivyFile + ":\n\t" + dd);
                     result = false;
                 } else {
-                    String[] depConfs = dds[i].getDependencyConfigurations(md
-                            .getConfigurationsNames());
-                    for (int j = 0; j < depConfs.length; j++) {
-                        if (!Arrays.asList(rmr.getDescriptor().getConfigurationsNames()).contains(
-                            depConfs[j])) {
+                    for (String depConf : dd.getDependencyConfigurations(md.getConfigurationsNames())) {
+                        if (!Arrays.asList(rmr.getDescriptor().getConfigurationsNames())
+                                .contains(depConf)) {
                             Message.info("dependency configuration is missing for " + ivyFile
-                                    + "\n\tin " + dds[i] + ": " + depConfs[j]);
+                                    + "\n\tin " + dd + ": " + depConf);
                             result = false;
                         }
-                        Artifact[] arts = rmr.getDescriptor().getArtifacts(depConfs[j]);
-                        for (int k = 0; k < arts.length; k++) {
-                            if (!resolver.exists(arts[k])) {
+                        for (Artifact art : rmr.getDescriptor().getArtifacts(depConf)) {
+                            if (!resolver.exists(art)) {
                                 Message.info("dependency artifact is missing for " + ivyFile
-                                        + "\n\t in " + dds[i] + ": " + arts[k]);
+                                        + "\n\t in " + dd + ": " + art);
                                 result = false;
                             }
                         }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/deliver/DeliverEngine.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/deliver/DeliverEngine.java b/src/java/org/apache/ivy/core/deliver/DeliverEngine.java
index 11a843a..4a7c050 100644
--- a/src/java/org/apache/ivy/core/deliver/DeliverEngine.java
+++ b/src/java/org/apache/ivy/core/deliver/DeliverEngine.java
@@ -24,7 +24,6 @@ import java.text.ParseException;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
@@ -115,9 +114,9 @@ public class DeliverEngine {
         md.setResolvedPublicationDate(options.getPubdate());
 
         // 2) parse resolvedRevisions From properties file
-        Map resolvedRevisions = new HashMap(); // Map (ModuleId -> String revision)
-        Map resolvedBranches = new HashMap(); // Map (ModuleId -> String branch)
-        Map dependenciesStatus = new HashMap(); // Map (ModuleId -> String status)
+        Map<ModuleRevisionId, String> resolvedRevisions = new HashMap<>(); // Map (ModuleId -> String revision)
+        Map<ModuleRevisionId, String> resolvedBranches = new HashMap<>(); // Map (ModuleId -> String branch)
+        Map<ModuleRevisionId, String> dependenciesStatus = new HashMap<>(); // Map (ModuleId -> String status)
         File ivyProperties = getCache().getResolvedIvyPropertiesInCache(mrid);
         if (!ivyProperties.exists()) {
             throw new IllegalStateException("ivy properties not found in cache for " + mrid
@@ -128,8 +127,8 @@ public class DeliverEngine {
         props.load(in);
         in.close();
 
-        for (Iterator iter = props.keySet().iterator(); iter.hasNext();) {
-            String depMridStr = (String) iter.next();
+        for (Object o : props.keySet()) {
+            String depMridStr = (String) o;
             String[] parts = props.getProperty(depMridStr).split(" ");
             ModuleRevisionId decodedMrid = ModuleRevisionId.decode(depMridStr);
             if (options.isResolveDynamicRevisions()) {
@@ -155,29 +154,23 @@ public class DeliverEngine {
         }
 
         // 3) use pdrResolver to resolve dependencies info
-        Map resolvedDependencies = new HashMap(); // Map (ModuleRevisionId -> String revision)
-        DependencyDescriptor[] dependencies = md.getDependencies();
-        for (int i = 0; i < dependencies.length; i++) {
-            String rev = (String) resolvedRevisions.get(dependencies[i].getDependencyRevisionId());
+        Map<ModuleRevisionId, String> resolvedDependencies = new HashMap<>();
+        // Map (ModuleRevisionId -> String revision)
+        for (DependencyDescriptor dependency : md.getDependencies()) {
+            String rev = resolvedRevisions.get(dependency.getDependencyRevisionId());
             if (rev == null) {
-                rev = dependencies[i].getDependencyRevisionId().getRevision();
+                rev = dependency.getDependencyRevisionId().getRevision();
             }
-            String bra = (String) resolvedBranches.get(dependencies[i].getDependencyRevisionId());
+            String bra = resolvedBranches.get(dependency.getDependencyRevisionId());
             if (bra == null || "null".equals(bra)) {
-                bra = dependencies[i].getDependencyRevisionId().getBranch();
+                bra = dependency.getDependencyRevisionId().getBranch();
             }
-            String depStatus = (String) dependenciesStatus.get(dependencies[i]
-                    .getDependencyRevisionId());
-            ModuleRevisionId mrid2 = null;
-            if (bra == null) {
-                mrid2 = ModuleRevisionId
-                        .newInstance(dependencies[i].getDependencyRevisionId(), rev);
-            } else {
-                mrid2 = ModuleRevisionId.newInstance(dependencies[i].getDependencyRevisionId(),
-                    bra, rev);
-            }
-            resolvedDependencies.put(dependencies[i].getDependencyRevisionId(), options
-                    .getPdrResolver().resolve(md, options.getStatus(), mrid2, depStatus));
+            String depStatus = dependenciesStatus.get(dependency.getDependencyRevisionId());
+            ModuleRevisionId mrid2 = (bra == null)
+                    ? ModuleRevisionId.newInstance(dependency.getDependencyRevisionId(), rev)
+                    : ModuleRevisionId.newInstance(dependency.getDependencyRevisionId(), bra, rev);
+            resolvedDependencies.put(dependency.getDependencyRevisionId(),
+                options.getPdrResolver().resolve(md, options.getStatus(), mrid2, depStatus));
         }
 
         // 4) copy the source resolved ivy to the destination specified,
@@ -188,7 +181,7 @@ public class DeliverEngine {
         Message.info("\tdelivering ivy file to " + publishedIvy);
 
         String[] confs = ConfigurationUtils.replaceWildcards(options.getConfs(), md);
-        Set confsToRemove = new HashSet(Arrays.asList(md.getConfigurationsNames()));
+        Set<String> confsToRemove = new HashSet<>(Arrays.asList(md.getConfigurationsNames()));
         confsToRemove.removeAll(Arrays.asList(confs));
 
         try {
@@ -203,7 +196,7 @@ public class DeliverEngine {
                     .setMerge(options.isMerge())
                     .setMergedDescriptor(md)
                     .setConfsToExclude(
-                        (String[]) confsToRemove.toArray(new String[confsToRemove.size()]));
+                            confsToRemove.toArray(new String[confsToRemove.size()]));
             if (!resolvedBranches.isEmpty()) {
                 opts = opts.setResolvedBranches(resolvedBranches);
             }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/event/EventManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/event/EventManager.java b/src/java/org/apache/ivy/core/event/EventManager.java
index 743b7d4..5186b5f 100644
--- a/src/java/org/apache/ivy/core/event/EventManager.java
+++ b/src/java/org/apache/ivy/core/event/EventManager.java
@@ -37,17 +37,17 @@ public class EventManager implements TransferListener {
         addIvyListener(listener, new IvyEventFilter(eventName, null, null));
     }
 
-    public void addIvyListener(IvyListener listener, Filter filter) {
+    public void addIvyListener(IvyListener listener, Filter<IvyEvent> filter) {
         listeners.add(IvyListener.class, new FilteredIvyListener(listener, filter));
     }
 
     public void removeIvyListener(IvyListener listener) {
         listeners.remove(IvyListener.class, listener);
         IvyListener[] listeners = this.listeners.getListeners(IvyListener.class);
-        for (int i = 0; i < listeners.length; i++) {
-            if (listeners[i] instanceof FilteredIvyListener) {
-                if (listener.equals(((FilteredIvyListener) listeners[i]).getIvyListener())) {
-                    this.listeners.remove(IvyListener.class, listeners[i]);
+        for (IvyListener listen : listeners) {
+            if (listen instanceof FilteredIvyListener) {
+                if (listener.equals(((FilteredIvyListener) listen).getIvyListener())) {
+                    this.listeners.remove(IvyListener.class, listen);
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/event/FilteredIvyListener.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/event/FilteredIvyListener.java b/src/java/org/apache/ivy/core/event/FilteredIvyListener.java
index e52512d..88b5c67 100644
--- a/src/java/org/apache/ivy/core/event/FilteredIvyListener.java
+++ b/src/java/org/apache/ivy/core/event/FilteredIvyListener.java
@@ -22,9 +22,9 @@ import org.apache.ivy.util.filter.Filter;
 public class FilteredIvyListener implements IvyListener {
     private IvyListener listener;
 
-    private Filter filter;
+    private Filter<IvyEvent> filter;
 
-    public FilteredIvyListener(IvyListener listener, Filter filter) {
+    public FilteredIvyListener(IvyListener listener, Filter<IvyEvent> filter) {
         this.listener = listener;
         this.filter = filter;
     }
@@ -33,7 +33,7 @@ public class FilteredIvyListener implements IvyListener {
         return listener;
     }
 
-    public Filter getFilter() {
+    public Filter<IvyEvent> getFilter() {
         return filter;
     }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/event/IvyEvent.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/event/IvyEvent.java b/src/java/org/apache/ivy/core/event/IvyEvent.java
index 68e13b3..82e2d7f 100644
--- a/src/java/org/apache/ivy/core/event/IvyEvent.java
+++ b/src/java/org/apache/ivy/core/event/IvyEvent.java
@@ -84,7 +84,7 @@ public class IvyEvent {
         addAttribute("conf", StringUtils.join(confs, ", "));
     }
 
-    protected void addAttributes(Map attributes) {
+    protected void addAttributes(Map<String, String> attributes) {
         this.attributes.putAll(attributes);
     }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/event/IvyEventFilter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/event/IvyEventFilter.java b/src/java/org/apache/ivy/core/event/IvyEventFilter.java
index ac9251f..2958513 100644
--- a/src/java/org/apache/ivy/core/event/IvyEventFilter.java
+++ b/src/java/org/apache/ivy/core/event/IvyEventFilter.java
@@ -67,7 +67,7 @@ import org.apache.ivy.util.filter.OrFilter;
  *
  * @since 1.4
  */
-public class IvyEventFilter implements Filter {
+public class IvyEventFilter implements Filter<IvyEvent> {
     private static final String NOT = "NOT ";
 
     private static final String OR = " OR ";
@@ -76,28 +76,27 @@ public class IvyEventFilter implements Filter {
 
     private PatternMatcher matcher;
 
-    private Filter nameFilter;
+    private Filter<IvyEvent> nameFilter;
 
-    private Filter attFilter;
+    private Filter<IvyEvent> attFilter;
 
     public IvyEventFilter(String event, String filterExpression, PatternMatcher matcher) {
-        this.matcher = matcher == null ? ExactPatternMatcher.INSTANCE : matcher;
+        this.matcher = (matcher == null) ? ExactPatternMatcher.INSTANCE : matcher;
         if (event == null) {
-            nameFilter = NoFilter.INSTANCE;
+            nameFilter = NoFilter.instance();
         } else {
             final Matcher eventNameMatcher = this.matcher.getMatcher(event);
-            nameFilter = new Filter() {
-                public boolean accept(Object o) {
-                    IvyEvent e = (IvyEvent) o;
+            nameFilter = new Filter<IvyEvent>() {
+                public boolean accept(IvyEvent e) {
                     return eventNameMatcher.matches(e.getName());
                 }
             };
         }
-        attFilter = filterExpression == null || filterExpression.trim().length() == 0 ? NoFilter.INSTANCE
-                : parseExpression(filterExpression);
+        attFilter = (filterExpression == null || filterExpression.trim().length() == 0)
+                ? NoFilter.<IvyEvent> instance() : parseExpression(filterExpression);
     }
 
-    private Filter parseExpression(String filterExpression) {
+    private Filter<IvyEvent> parseExpression(String filterExpression) {
         // expressions handled for the moment: (informal grammar)
         // EXP := SIMPLE_EXP | AND_EXP | OR_EXP | NOT_EXP
         // AND_EXP := EXP && EXP
@@ -111,7 +110,7 @@ public class IvyEventFilter implements Filter {
             index = filterExpression.indexOf(OR);
             if (index == -1) {
                 if (filterExpression.startsWith(NOT)) {
-                    return new NotFilter(parseExpression(filterExpression.substring(NOT.length())));
+                    return new NotFilter<>(parseExpression(filterExpression.substring(NOT.length())));
                 } else {
                     index = filterExpression.indexOf("=");
                     if (index == -1) {
@@ -124,15 +123,14 @@ public class IvyEventFilter implements Filter {
                     for (int i = 0; i < values.length; i++) {
                         matchers[i] = matcher.getMatcher(values[i].trim());
                     }
-                    return new Filter() {
-                        public boolean accept(Object o) {
-                            IvyEvent e = (IvyEvent) o;
-                            String val = (String) e.getAttributes().get(attname);
+                    return new Filter<IvyEvent>() {
+                        public boolean accept(IvyEvent e) {
+                            String val = e.getAttributes().get(attname);
                             if (val == null) {
                                 return false;
                             }
-                            for (int i = 0; i < matchers.length; i++) {
-                                if (matchers[i].matches(val)) {
+                            for (Matcher matcher : matchers) {
+                                if (matcher.matches(val)) {
                                     return true;
                                 }
                             }
@@ -141,17 +139,17 @@ public class IvyEventFilter implements Filter {
                     };
                 }
             } else {
-                return new OrFilter(parseExpression(filterExpression.substring(0, index)),
+                return new OrFilter<>(parseExpression(filterExpression.substring(0, index)),
                         parseExpression(filterExpression.substring(index + OR.length())));
             }
         } else {
-            return new AndFilter(parseExpression(filterExpression.substring(0, index)),
+            return new AndFilter<>(parseExpression(filterExpression.substring(0, index)),
                     parseExpression(filterExpression.substring(index + AND.length())));
         }
     }
 
-    public boolean accept(Object o) {
-        return o instanceof IvyEvent && nameFilter.accept(o) && attFilter.accept(o);
+    public boolean accept(IvyEvent e) {
+        return nameFilter.accept(e) && attFilter.accept(e);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/event/publish/EndArtifactPublishEvent.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/event/publish/EndArtifactPublishEvent.java b/src/java/org/apache/ivy/core/event/publish/EndArtifactPublishEvent.java
index c2e08dd..53e4539 100644
--- a/src/java/org/apache/ivy/core/event/publish/EndArtifactPublishEvent.java
+++ b/src/java/org/apache/ivy/core/event/publish/EndArtifactPublishEvent.java
@@ -30,9 +30,6 @@ import org.apache.ivy.plugins.resolver.DependencyResolver;
  */
 public class EndArtifactPublishEvent extends PublishEvent {
 
-    @SuppressWarnings("unused")
-    private static final long serialVersionUID = -65690169431499422L;
-
     public static final String NAME = "post-publish-artifact";
 
     public static final String STATUS_SUCCESSFUL = "successful";

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/event/publish/StartArtifactPublishEvent.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/event/publish/StartArtifactPublishEvent.java b/src/java/org/apache/ivy/core/event/publish/StartArtifactPublishEvent.java
index 42a8068..36ead5a 100644
--- a/src/java/org/apache/ivy/core/event/publish/StartArtifactPublishEvent.java
+++ b/src/java/org/apache/ivy/core/event/publish/StartArtifactPublishEvent.java
@@ -30,9 +30,6 @@ import org.apache.ivy.plugins.resolver.DependencyResolver;
  */
 public class StartArtifactPublishEvent extends PublishEvent {
 
-    @SuppressWarnings("unused")
-    private static final long serialVersionUID = -1134274781039590219L;
-
     public static final String NAME = "pre-publish-artifact";
 
     public StartArtifactPublishEvent(DependencyResolver resolver, Artifact artifact, File data,

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/install/InstallEngine.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/install/InstallEngine.java b/src/java/org/apache/ivy/core/install/InstallEngine.java
index 47e45e7..db9a4cb 100644
--- a/src/java/org/apache/ivy/core/install/InstallEngine.java
+++ b/src/java/org/apache/ivy/core/install/InstallEngine.java
@@ -93,28 +93,23 @@ public class InstallEngine {
                     ExactPatternMatcher.ANY_EXPRESSION), ExactPatternMatcher.INSTANCE,
                 new NoConflictManager());
 
-            for (int c = 0; c < options.getConfs().length; c++) {
-                final String[] depConfs = options.getConfs();
-
-                for (int j = 0; j < depConfs.length; j++) {
-                    final String depConf = depConfs[j].trim();
-
-                    if (MatcherHelper.isExact(matcher, mrid)) {
-                        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md, mrid,
-                                false, false, options.isTransitive());
+            for (String dc : options.getConfs()) {
+                final String depConf = dc.trim();
+
+                if (MatcherHelper.isExact(matcher, mrid)) {
+                    DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md, mrid,
+                            false, false, options.isTransitive());
+                    dd.addDependencyConfiguration("default", depConf);
+                    md.addDependency(dd);
+                } else {
+                    ModuleRevisionId[] mrids = searchEngine.listModules(fromResolver, mrid, matcher);
+
+                    for (ModuleRevisionId imrid : mrids) {
+                        Message.info("\tfound " + imrid + " to install: adding to the list");
+                        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md,
+                                imrid, false, false, options.isTransitive());
                         dd.addDependencyConfiguration("default", depConf);
                         md.addDependency(dd);
-                    } else {
-                        ModuleRevisionId[] mrids = searchEngine.listModules(fromResolver, mrid,
-                            matcher);
-
-                        for (int i = 0; i < mrids.length; i++) {
-                            Message.info("\tfound " + mrids[i] + " to install: adding to the list");
-                            DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md,
-                                    mrids[i], false, false, options.isTransitive());
-                            dd.addDependencyConfiguration("default", depConf);
-                            md.addDependency(dd);
-                        }
                     }
                 }
             }
@@ -134,8 +129,8 @@ public class InstallEngine {
 
             // now that everything is in cache, we can publish all these modules
             Message.info(":: installing in " + to + " ::");
-            for (int i = 0; i < dependencies.length; i++) {
-                ModuleDescriptor depmd = dependencies[i].getDescriptor();
+            for (IvyNode dependency : dependencies) {
+                ModuleDescriptor depmd = dependency.getDescriptor();
                 if (depmd != null) {
                     ModuleRevisionId depMrid = depmd.getModuleRevisionId();
                     Message.verbose("installing " + depMrid);
@@ -145,15 +140,15 @@ public class InstallEngine {
 
                         // publish artifacts
                         ArtifactDownloadReport[] artifacts = report.getArtifactsReports(depMrid);
-                        for (int j = 0; j < artifacts.length; j++) {
-                            if (artifacts[j].getLocalFile() != null) {
-                                toResolver.publish(artifacts[j].getArtifact(),
-                                    artifacts[j].getLocalFile(), options.isOverwrite());
+                        for (ArtifactDownloadReport artifact : artifacts) {
+                            if (artifact.getLocalFile() != null) {
+                                toResolver.publish(artifact.getArtifact(), artifact.getLocalFile(),
+                                    options.isOverwrite());
                             }
                         }
 
                         // publish metadata
-                        MetadataArtifactDownloadReport artifactDownloadReport = dependencies[i]
+                        MetadataArtifactDownloadReport artifactDownloadReport = dependency
                                 .getModuleRevision().getReport();
                         File localIvyFile = artifactDownloadReport.getLocalFile();
                         toResolver.publish(depmd.getMetadataArtifact(), localIvyFile,

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/install/InstallEngineSettings.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/install/InstallEngineSettings.java b/src/java/org/apache/ivy/core/install/InstallEngineSettings.java
index 9f3426b..0aa56dd 100644
--- a/src/java/org/apache/ivy/core/install/InstallEngineSettings.java
+++ b/src/java/org/apache/ivy/core/install/InstallEngineSettings.java
@@ -29,7 +29,7 @@ public interface InstallEngineSettings extends ParserSettings {
 
     DependencyResolver getResolver(String from);
 
-    Collection getResolverNames();
+    Collection<String> getResolverNames();
 
     ReportOutputter[] getReportOutputters();
 
@@ -41,6 +41,6 @@ public interface InstallEngineSettings extends ParserSettings {
 
     PatternMatcher getMatcher(String matcherName);
 
-    Collection getMatcherNames();
+    Collection<String> getMatcherNames();
 
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/install/InstallOptions.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/install/InstallOptions.java b/src/java/org/apache/ivy/core/install/InstallOptions.java
index 5bb4182..ee6beeb 100644
--- a/src/java/org/apache/ivy/core/install/InstallOptions.java
+++ b/src/java/org/apache/ivy/core/install/InstallOptions.java
@@ -17,6 +17,7 @@
  */
 package org.apache.ivy.core.install;
 
+import org.apache.ivy.core.module.descriptor.Artifact;
 import org.apache.ivy.plugins.matcher.PatternMatcher;
 import org.apache.ivy.util.filter.Filter;
 import org.apache.ivy.util.filter.FilterHelper;
@@ -32,7 +33,7 @@ public class InstallOptions {
 
     private String[] confs = {"*"};
 
-    private Filter artifactFilter = FilterHelper.NO_FILTER;
+    private Filter<Artifact> artifactFilter = FilterHelper.NO_FILTER;
 
     private String matcherName = PatternMatcher.EXACT;
 
@@ -63,12 +64,12 @@ public class InstallOptions {
         return this;
     }
 
-    public Filter getArtifactFilter() {
+    public Filter<Artifact> getArtifactFilter() {
         return artifactFilter;
     }
 
-    public InstallOptions setArtifactFilter(Filter artifactFilter) {
-        this.artifactFilter = artifactFilter == null ? FilterHelper.NO_FILTER : artifactFilter;
+    public InstallOptions setArtifactFilter(Filter<Artifact> artifactFilter) {
+        this.artifactFilter = (artifactFilter == null) ? FilterHelper.NO_FILTER : artifactFilter;
         return this;
     }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/module/descriptor/AbstractArtifact.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/module/descriptor/AbstractArtifact.java b/src/java/org/apache/ivy/core/module/descriptor/AbstractArtifact.java
index 95b175c..74bb54f 100644
--- a/src/java/org/apache/ivy/core/module/descriptor/AbstractArtifact.java
+++ b/src/java/org/apache/ivy/core/module/descriptor/AbstractArtifact.java
@@ -62,7 +62,7 @@ public abstract class AbstractArtifact implements Artifact {
         return getId().getAttribute(attName);
     }
 
-    public Map getAttributes() {
+    public Map<String, String> getAttributes() {
         return getId().getAttributes();
     }
 
@@ -70,11 +70,11 @@ public abstract class AbstractArtifact implements Artifact {
         return getId().getExtraAttribute(attName);
     }
 
-    public Map getExtraAttributes() {
+    public Map<String, String> getExtraAttributes() {
         return getId().getExtraAttributes();
     }
 
-    public Map getQualifiedExtraAttributes() {
+    public Map<String, String> getQualifiedExtraAttributes() {
         return getId().getQualifiedExtraAttributes();
     }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/module/descriptor/AbstractIncludeExcludeRule.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/module/descriptor/AbstractIncludeExcludeRule.java b/src/java/org/apache/ivy/core/module/descriptor/AbstractIncludeExcludeRule.java
index 6c29ad2..bdea406 100644
--- a/src/java/org/apache/ivy/core/module/descriptor/AbstractIncludeExcludeRule.java
+++ b/src/java/org/apache/ivy/core/module/descriptor/AbstractIncludeExcludeRule.java
@@ -35,11 +35,12 @@ public abstract class AbstractIncludeExcludeRule extends UnmodifiableExtendableI
 
     private ArtifactId id;
 
-    private Collection confs = new ArrayList();
+    private final Collection<String> confs = new ArrayList<>();
 
     private PatternMatcher patternMatcher;
 
-    public AbstractIncludeExcludeRule(ArtifactId aid, PatternMatcher matcher, Map extraAttributes) {
+    public AbstractIncludeExcludeRule(ArtifactId aid, PatternMatcher matcher,
+                                      Map<String, String> extraAttributes) {
         super(null, extraAttributes);
         id = aid;
         patternMatcher = matcher;
@@ -81,7 +82,7 @@ public abstract class AbstractIncludeExcludeRule extends UnmodifiableExtendableI
     }
 
     public String[] getConfigurations() {
-        return (String[]) confs.toArray(new String[confs.size()]);
+        return confs.toArray(new String[confs.size()]);
     }
 
     public PatternMatcher getMatcher() {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/module/descriptor/Configuration.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/module/descriptor/Configuration.java b/src/java/org/apache/ivy/core/module/descriptor/Configuration.java
index cb808dc..56d96c4 100644
--- a/src/java/org/apache/ivy/core/module/descriptor/Configuration.java
+++ b/src/java/org/apache/ivy/core/module/descriptor/Configuration.java
@@ -60,11 +60,11 @@ public class Configuration extends DefaultExtendableItem implements InheritableI
 
     public static Collection<Configuration> findConfigurationExtending(String conf,
             Configuration[] confs) {
-        Collection<Configuration> extendingConfs = new ArrayList<Configuration>();
-        for (int i = 0; i < confs.length; i++) {
-            if (confs[i] != null && Arrays.asList(confs[i].getExtends()).contains(conf)) {
-                extendingConfs.add(confs[i]);
-                extendingConfs.addAll(findConfigurationExtending(confs[i].getName(), confs));
+        Collection<Configuration> extendingConfs = new ArrayList<>();
+        for (Configuration cf : confs) {
+            if (cf != null && Arrays.asList(cf.getExtends()).contains(conf)) {
+                extendingConfs.add(cf);
+                extendingConfs.addAll(findConfigurationExtending(cf.getName(), confs));
             }
         }
         return extendingConfs;
@@ -219,16 +219,16 @@ public class Configuration extends DefaultExtendableItem implements InheritableI
 
         Configuration[] configs = md.getConfigurations();
 
-        Set<String> newExtends = new LinkedHashSet<String>();
-        for (int j = 0; j < extendsFrom.length; j++) {
-            if ("*".equals(extendsFrom[j])) {
+        Set<String> newExtends = new LinkedHashSet<>();
+        for (String extend : extendsFrom) {
+            if ("*".equals(extend)) {
                 addOther(configs, null, newExtends);
-            } else if ("*(public)".equals(extendsFrom[j])) {
+            } else if ("*(public)".equals(extend)) {
                 addOther(configs, Visibility.PUBLIC, newExtends);
-            } else if ("*(private)".equals(extendsFrom[j])) {
+            } else if ("*(private)".equals(extend)) {
                 addOther(configs, Visibility.PRIVATE, newExtends);
             } else {
-                newExtends.add(extendsFrom[j]);
+                newExtends.add(extend);
             }
         }
 
@@ -236,10 +236,10 @@ public class Configuration extends DefaultExtendableItem implements InheritableI
     }
 
     private void addOther(Configuration[] allConfigs, Visibility visibility, Set<String> configs) {
-        for (int i = 0; i < allConfigs.length; i++) {
-            String currentName = allConfigs[i].getName();
+        for (Configuration allConfig : allConfigs) {
+            String currentName = allConfig.getName();
             if (!name.equals(currentName)
-                    && ((visibility == null) || visibility.equals(allConfigs[i].getVisibility()))) {
+                    && (visibility == null || visibility.equals(allConfig.getVisibility()))) {
                 configs.add(currentName);
             }
         }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/module/descriptor/ConfigurationGroup.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/module/descriptor/ConfigurationGroup.java b/src/java/org/apache/ivy/core/module/descriptor/ConfigurationGroup.java
index 5f827a7..80182da 100644
--- a/src/java/org/apache/ivy/core/module/descriptor/ConfigurationGroup.java
+++ b/src/java/org/apache/ivy/core/module/descriptor/ConfigurationGroup.java
@@ -17,7 +17,6 @@
  */
 package org.apache.ivy.core.module.descriptor;
 
-import java.util.Iterator;
 import java.util.Map;
 
 /**
@@ -25,9 +24,9 @@ import java.util.Map;
  */
 public class ConfigurationGroup extends Configuration {
 
-    private final Map/* <String, Configuration> */members;
+    private final Map<String, Configuration> members;
 
-    public ConfigurationGroup(String confName, Map /* <String, Configuration> */members) {
+    public ConfigurationGroup(String confName, Map<String, Configuration> members) {
         super(confName);
         this.members = members;
     }
@@ -43,7 +42,7 @@ public class ConfigurationGroup extends Configuration {
      * @return the list of configurations' names this object is an intersection of.
      */
     public String[] getMembersConfigurationNames() {
-        return (String[]) members.keySet().toArray(new String[members.size()]);
+        return members.keySet().toArray(new String[members.size()]);
     }
 
     /**
@@ -56,12 +55,11 @@ public class ConfigurationGroup extends Configuration {
      * @return the member {@link Configuration} object for the given conf name
      */
     public Configuration getMemberConfiguration(String confName) {
-        return (Configuration) members.get(confName);
+        return members.get(confName);
     }
 
     public Visibility getVisibility() {
-        for (Iterator it = members.values().iterator(); it.hasNext();) {
-            Configuration c = (Configuration) it.next();
+        for (Configuration c : members.values()) {
             if (c != null && Visibility.PRIVATE.equals(c.getVisibility())) {
                 return Visibility.PRIVATE;
             }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/module/descriptor/ConfigurationIntersection.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/module/descriptor/ConfigurationIntersection.java b/src/java/org/apache/ivy/core/module/descriptor/ConfigurationIntersection.java
index 36f2bc3..406fd07 100644
--- a/src/java/org/apache/ivy/core/module/descriptor/ConfigurationIntersection.java
+++ b/src/java/org/apache/ivy/core/module/descriptor/ConfigurationIntersection.java
@@ -17,7 +17,6 @@
  */
 package org.apache.ivy.core.module.descriptor;
 
-import java.util.Iterator;
 import java.util.Map;
 
 /**
@@ -25,10 +24,10 @@ import java.util.Map;
  */
 public class ConfigurationIntersection extends Configuration {
 
-    private final Map/* <String, Configuration> */intersectedConfs;
+    private final Map<String, Configuration> intersectedConfs;
 
     public ConfigurationIntersection(String confName,
-            Map /* <String, Configuration> */intersectedConfs) {
+            Map<String, Configuration> intersectedConfs) {
         super(confName);
         this.intersectedConfs = intersectedConfs;
     }
@@ -44,7 +43,7 @@ public class ConfigurationIntersection extends Configuration {
      * @return the list of configurations' names this object is an intersection of.
      */
     public String[] getIntersectedConfigurationNames() {
-        return (String[]) intersectedConfs.keySet().toArray(new String[intersectedConfs.size()]);
+        return intersectedConfs.keySet().toArray(new String[intersectedConfs.size()]);
     }
 
     /**
@@ -57,12 +56,11 @@ public class ConfigurationIntersection extends Configuration {
      * @return the intersected {@link Configuration} object for the given conf name
      */
     public Configuration getIntersectedConfiguration(String confName) {
-        return (Configuration) intersectedConfs.get(confName);
+        return intersectedConfs.get(confName);
     }
 
     public Visibility getVisibility() {
-        for (Iterator it = intersectedConfs.values().iterator(); it.hasNext();) {
-            Configuration c = (Configuration) it.next();
+        for (Configuration c : intersectedConfs.values()) {
             if (c != null && Visibility.PRIVATE.equals(c.getVisibility())) {
                 return Visibility.PRIVATE;
             }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/module/descriptor/DefaultArtifact.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/module/descriptor/DefaultArtifact.java b/src/java/org/apache/ivy/core/module/descriptor/DefaultArtifact.java
index 3ea103d..05880b2 100644
--- a/src/java/org/apache/ivy/core/module/descriptor/DefaultArtifact.java
+++ b/src/java/org/apache/ivy/core/module/descriptor/DefaultArtifact.java
@@ -84,12 +84,12 @@ public class DefaultArtifact extends AbstractArtifact {
     }
 
     public DefaultArtifact(ModuleRevisionId mrid, Date publicationDate, String name, String type,
-            String ext, Map extraAttributes) {
+            String ext, Map<String, String> extraAttributes) {
         this(mrid, publicationDate, name, type, ext, null, extraAttributes);
     }
 
     public DefaultArtifact(ModuleRevisionId mrid, Date publicationDate, String name, String type,
-            String ext, URL url, Map extraAttributes) {
+            String ext, URL url, Map<String, String> extraAttributes) {
         this(ArtifactRevisionId.newInstance(mrid, name, type, ext, extraAttributes),
                 publicationDate, url, false);
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyArtifactDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyArtifactDescriptor.java b/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyArtifactDescriptor.java
index 4785a3f..c7d5537 100644
--- a/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyArtifactDescriptor.java
+++ b/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyArtifactDescriptor.java
@@ -29,7 +29,7 @@ import org.apache.ivy.util.extendable.UnmodifiableExtendableItem;
 public class DefaultDependencyArtifactDescriptor extends UnmodifiableExtendableItem implements
         DependencyArtifactDescriptor, ConfigurationAware {
 
-    private Collection confs = new ArrayList();
+    private final Collection<String> confs = new ArrayList<>();
 
     private URL url;
 
@@ -50,7 +50,7 @@ public class DefaultDependencyArtifactDescriptor extends UnmodifiableExtendableI
      * @param extraAttributes ditto
      */
     public DefaultDependencyArtifactDescriptor(DependencyDescriptor dd, String name, String type,
-            String ext, URL url, Map extraAttributes) {
+            String ext, URL url, Map<String, String> extraAttributes) {
         super(null, extraAttributes);
         Checks.checkNotNull(dd, "dd");
         Checks.checkNotNull(name, "name");
@@ -109,7 +109,7 @@ public class DefaultDependencyArtifactDescriptor extends UnmodifiableExtendableI
     }
 
     public String[] getConfigurations() {
-        return (String[]) confs.toArray(new String[confs.size()]);
+        return confs.toArray(new String[confs.size()]);
     }
 
     public URL getUrl() {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java b/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java
index a3e86e7..30677eb 100644
--- a/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java
+++ b/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java
@@ -22,7 +22,6 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.List;
@@ -101,25 +100,25 @@ public class DefaultDependencyDescriptor implements DependencyDescriptor {
         if (moduleConfs.length == 1 && "*".equals(moduleConfs[0])) {
             if (dd instanceof DefaultDependencyDescriptor) {
                 DefaultDependencyDescriptor ddd = (DefaultDependencyDescriptor) dd;
-                newdd.confs = new LinkedHashMap(ddd.confs);
-                newdd.setExcludeRules(new LinkedHashMap(ddd.getExcludeRules()));
-                newdd.setIncludeRules(new LinkedHashMap(ddd.getIncludeRules()));
-                newdd.setDependencyArtifacts(new LinkedHashMap(ddd.getDependencyArtifacts()));
+                newdd.confs = new LinkedHashMap<>(ddd.confs);
+                newdd.setExcludeRules(new LinkedHashMap<>(ddd.getExcludeRules()));
+                newdd.setIncludeRules(new LinkedHashMap<>(ddd.getIncludeRules()));
+                newdd.setDependencyArtifacts(new LinkedHashMap<>(ddd.getDependencyArtifacts()));
             } else {
                 throw new IllegalArgumentException(
                         "dependency descriptor transformation does not support * module confs "
                                 + "with descriptors which aren't DefaultDependencyDescriptor");
             }
         } else {
-            for (int i = 0; i < moduleConfs.length; i++) {
-                newdd.confs.put(moduleConfs[i],
-                    new ArrayList(Arrays.asList(dd.getDependencyConfigurations(moduleConfs[i]))));
-                newdd.getExcludeRules().put(moduleConfs[i],
-                    new ArrayList(Arrays.asList(dd.getExcludeRules(moduleConfs[i]))));
-                newdd.getIncludeRules().put(moduleConfs[i],
-                    new ArrayList(Arrays.asList(dd.getIncludeRules(moduleConfs[i]))));
-                newdd.getDependencyArtifacts().put(moduleConfs[i],
-                    new ArrayList(Arrays.asList(dd.getDependencyArtifacts(moduleConfs[i]))));
+            for (String moduleConf : moduleConfs) {
+                newdd.confs.put(moduleConf,
+                    new ArrayList<>(Arrays.asList(dd.getDependencyConfigurations(moduleConf))));
+                newdd.getExcludeRules().put(moduleConf,
+                    new ArrayList<>(Arrays.asList(dd.getExcludeRules(moduleConf))));
+                newdd.getIncludeRules().put(moduleConf,
+                    new ArrayList<>(Arrays.asList(dd.getIncludeRules(moduleConf))));
+                newdd.getDependencyArtifacts().put(moduleConf,
+                    new ArrayList<>(Arrays.asList(dd.getDependencyArtifacts(moduleConf))));
             }
         }
         if (fromSystem) {
@@ -132,16 +131,19 @@ public class DefaultDependencyDescriptor implements DependencyDescriptor {
 
     private ModuleRevisionId dynamicRevId;
 
-    private Map/* <String,List<String>> */confs = new LinkedHashMap();
+    private Map<String, List<String>> confs = new LinkedHashMap<>();
 
     // Map (String masterConf -> Collection(DependencyArtifactDescriptor))
-    private Map dependencyArtifacts; // initialized on demand only for memory consumption reason
+    // initialized on demand only for memory consumption reasons
+    private Map<String, Collection<DependencyArtifactDescriptor>> dependencyArtifacts;
 
     // Map (String masterConf -> Collection(IncludeRule))
-    private Map includeRules; // initialized on demand only for memory consumption reason
+    // initialized on demand only for memory consumption reasons
+    private Map<String, Collection<IncludeRule>> includeRules;
 
     // Map (String masterConf -> Collection(ExcludeRule))
-    private Map excludeRules; // initialized on demand only for memory consumption reason
+    // initialized on demand only for memory consumption reasons
+    private Map<String, Collection<ExcludeRule>> excludeRules;
 
     /**
      * Used to indicate that this revision must be used in case of conflicts, independently of
@@ -189,10 +191,10 @@ public class DefaultDependencyDescriptor implements DependencyDescriptor {
         isTransitive = dd.isTransitive;
         namespace = dd.namespace;
         confs.putAll(dd.confs);
-        excludeRules = dd.excludeRules == null ? null : new LinkedHashMap(dd.excludeRules);
-        includeRules = dd.includeRules == null ? null : new LinkedHashMap(dd.includeRules);
-        dependencyArtifacts = dd.dependencyArtifacts == null ? null : new LinkedHashMap(
-                dd.dependencyArtifacts);
+        excludeRules = (dd.excludeRules == null) ? null : new LinkedHashMap<>(dd.excludeRules);
+        includeRules = (dd.includeRules == null) ? null : new LinkedHashMap<>(dd.includeRules);
+        dependencyArtifacts = (dd.dependencyArtifacts == null) ? null
+                : new LinkedHashMap<>(dd.dependencyArtifacts);
         sourceModule = dd.sourceModule;
     }
 
@@ -236,7 +238,7 @@ public class DefaultDependencyDescriptor implements DependencyDescriptor {
     }
 
     public String[] getModuleConfigurations() {
-        return (String[]) confs.keySet().toArray(new String[confs.keySet().size()]);
+        return confs.keySet().toArray(new String[confs.keySet().size()]);
     }
 
     public String[] getDependencyConfigurations(String moduleConfiguration) {
@@ -265,11 +267,10 @@ public class DefaultDependencyDescriptor implements DependencyDescriptor {
             Configuration c = md.getConfiguration(moduleConfiguration);
             if (c instanceof ConfigurationIntersection) {
                 ConfigurationIntersection intersection = (ConfigurationIntersection) c;
-                Set /* <String> */intersectedDepConfs = new HashSet();
-                String[] intersected = intersection.getIntersectedConfigurationNames();
-                for (int i = 0; i < intersected.length; i++) {
-                    Collection depConfs = getDependencyConfigurationsIncludingExtending(
-                        intersected[i], requestedConfiguration);
+                Set<String> intersectedDepConfs = new HashSet<>();
+                for (String intersect : intersection.getIntersectedConfigurationNames()) {
+                    Collection<String> depConfs = getDependencyConfigurationsIncludingExtending(
+                        intersect, requestedConfiguration);
                     if (intersectedDepConfs.isEmpty()) {
                         intersectedDepConfs.addAll(depConfs);
                     } else {
@@ -280,10 +281,9 @@ public class DefaultDependencyDescriptor implements DependencyDescriptor {
                             // nothing to do, intersection of 'something'
                             // with 'everything' is 'something'
                         } else {
-                            Set /* <String> */intersectedDepConfsCopy = intersectedDepConfs;
-                            intersectedDepConfs = new HashSet();
-                            for (Iterator it = intersectedDepConfsCopy.iterator(); it.hasNext();) {
-                                String intersectedDepConf = (String) it.next();
+                            Set<String> intersectedDepConfsCopy = intersectedDepConfs;
+                            intersectedDepConfs = new HashSet<>();
+                            for (String intersectedDepConf : intersectedDepConfsCopy) {
                                 if (depConfs.contains(intersectedDepConf)) {
                                     // the conf is present in both sets,
                                     // so it is in the intersection
@@ -295,36 +295,34 @@ public class DefaultDependencyDescriptor implements DependencyDescriptor {
                                  * confs yet: it would require supporting parenthesis grouping in
                                  * configurations intersection interpretation
                                  *
-                                 * for (Iterator it2 = depConfs.iterator(); it2.hasNext();) {
-                                 *     String depConf = (String) it2.next();
-                                 *     if (depConf.startsWith("*")) {
-                                 *         if (intersectedDepConf .indexOf("(" + depConf + ")") != -1) {
-                                 *             intersectedDepConfs.add(intersectedDepConf);
-                                 *         } else {
-                                 *             intersectedDepConfs.add( "(" + intersectedDepConf + ")+(" + depConf + ")");
-                                 *         }
-                                 *     } else if (intersectedDepConf.startsWith("*")) {
-                                 *         if (depConf .indexOf("(" + intersectedDepConf + ")") != -1) {
-                                 *             intersectedDepConfs.add(depConf);
-                                 *         } else {
-                                 *             intersectedDepConfs.add( depConf + "+" + intersectedDepConf);
-                                 *         }
-                                 *     }
+                                 * for (String depConf : depConfs) {
+                                 *    if (depConf.startsWith("*")) {
+                                 *       if (intersectedDepConf.contains("(" + depConf + ")")) {
+                                 *          intersectedDepConfs.add(intersectedDepConf);
+                                 *       } else {
+                                 *          intersectedDepConfs.add("(" + intersectedDepConf + ")+(" + depConf + ")");
+                                 *       }
+                                 *    } else if (intersectedDepConf.startsWith("*")) {
+                                 *       if (depConf.contains("(" + intersectedDepConf + ")")) {
+                                 *          intersectedDepConfs.add(depConf);
+                                 *       } else {
+                                 *          intersectedDepConfs.add(depConf + "+" + intersectedDepConf);
+                                 *       }
+                                 *    }
                                  * }
                                  */
                             }
                         }
                     }
                 }
-                List confsList = (List) confs.get(moduleConfiguration);
+                List<String> confsList = confs.get(moduleConfiguration);
                 if (confsList != null) {
                     intersectedDepConfs.addAll(confsList);
                 }
                 if (intersectedDepConfs.isEmpty()) {
-                    List defConfs = (List) confs.get("*");
+                    List<String> defConfs = confs.get("*");
                     if (defConfs != null) {
-                        for (Iterator it = defConfs.iterator(); it.hasNext();) {
-                            String mappedConf = (String) it.next();
+                        for (String mappedConf : defConfs) {
                             if (mappedConf != null && mappedConf.startsWith("@+")) {
                                 return new String[] {moduleConfiguration + mappedConf.substring(1)};
                             } else if (mappedConf != null && mappedConf.equals("@")) {
@@ -333,28 +331,26 @@ public class DefaultDependencyDescriptor implements DependencyDescriptor {
                         }
                     }
                 }
-                return (String[]) intersectedDepConfs
-                        .toArray(new String[intersectedDepConfs.size()]);
+                return intersectedDepConfs.toArray(new String[intersectedDepConfs.size()]);
             } else if (c instanceof ConfigurationGroup) {
                 ConfigurationGroup group = (ConfigurationGroup) c;
-                Set /* <String> */groupDepConfs = new HashSet();
-                String[] members = group.getMembersConfigurationNames();
-                for (int i = 0; i < members.length; i++) {
-                    Collection depConfs = getDependencyConfigurationsIncludingExtending(members[i],
-                        requestedConfiguration);
+                Set<String> groupDepConfs = new HashSet<>();
+                for (String member : group.getMembersConfigurationNames()) {
+                    Collection<String> depConfs = getDependencyConfigurationsIncludingExtending(
+                        member, requestedConfiguration);
                     groupDepConfs.addAll(depConfs);
                 }
-                return (String[]) groupDepConfs.toArray(new String[groupDepConfs.size()]);
+                return groupDepConfs.toArray(new String[groupDepConfs.size()]);
             }
         }
 
-        List confsList = (List) confs.get(moduleConfiguration);
+        List<String> confsList = confs.get(moduleConfiguration);
         if (confsList == null) {
             // there is no mapping defined for this configuration, add the 'other' mappings.
-            confsList = (List) confs.get("%");
+            confsList = confs.get("%");
         }
-        List defConfs = (List) confs.get("*");
-        Collection ret = new LinkedHashSet();
+        List<String> defConfs = confs.get("*");
+        Collection<String> ret = new LinkedHashSet<>();
         if (confsList != null) {
             ret.addAll(confsList);
         }
@@ -362,9 +358,8 @@ public class DefaultDependencyDescriptor implements DependencyDescriptor {
             ret.addAll(defConfs);
         }
 
-        Collection replacedRet = new LinkedHashSet();
-        for (Iterator iter = ret.iterator(); iter.hasNext();) {
-            String c = (String) iter.next();
+        Collection<String> replacedRet = new LinkedHashSet<>();
+        for (String c : ret) {
             String replacedConf = replaceSelfFallbackPattern(c, moduleConfiguration);
             if (replacedConf == null) {
                 replacedConf = replaceThisFallbackPattern(c, requestedConfiguration);
@@ -376,31 +371,29 @@ public class DefaultDependencyDescriptor implements DependencyDescriptor {
         }
         ret = replacedRet;
         if (ret.remove("*")) {
-            StringBuffer r = new StringBuffer("*");
+            StringBuilder r = new StringBuilder("*");
             // merge excluded configurations as one conf like *!A!B
-            for (Iterator iter = ret.iterator(); iter.hasNext();) {
-                String c = (String) iter.next();
+            for (String c : ret) {
                 if (c.startsWith("!")) {
                     r.append(c);
                 }
             }
             return new String[] {r.toString()};
         }
-        return (String[]) ret.toArray(new String[ret.size()]);
+        return ret.toArray(new String[ret.size()]);
     }
 
-    private Collection getDependencyConfigurationsIncludingExtending(String conf,
+    private Collection<String> getDependencyConfigurationsIncludingExtending(String conf,
             String requestedConfiguration) {
-        Set/* <String> */allDepConfs = new LinkedHashSet();
+        Set<String> allDepConfs = new LinkedHashSet<>();
         allDepConfs
                 .addAll(Arrays.asList(getDependencyConfigurations(conf, requestedConfiguration)));
 
-        Collection extendingConfs = Configuration.findConfigurationExtending(conf,
+        Collection<Configuration> extendingConfs = Configuration.findConfigurationExtending(conf,
             md.getConfigurations());
-        for (Iterator it = extendingConfs.iterator(); it.hasNext();) {
-            Configuration extendingConf = (Configuration) it.next();
-            allDepConfs.addAll(Arrays.asList(getDependencyConfigurations(extendingConf.getName(),
-                requestedConfiguration)));
+        for (Configuration extendingConf : extendingConfs) {
+            allDepConfs.addAll(Arrays.asList(
+                getDependencyConfigurations(extendingConf.getName(), requestedConfiguration)));
         }
         return allDepConfs;
     }
@@ -433,10 +426,10 @@ public class DefaultDependencyDescriptor implements DependencyDescriptor {
         if (matcher.matches()) {
             String mappedConf = moduleConfiguration;
             if (matcher.group(1) != null) {
-                mappedConf = mappedConf + matcher.group(1);
+                mappedConf += matcher.group(1);
             }
             if (matcher.group(2) != null) {
-                mappedConf = mappedConf + matcher.group(2);
+                mappedConf += matcher.group(2);
             }
             return mappedConf;
         }
@@ -444,40 +437,42 @@ public class DefaultDependencyDescriptor implements DependencyDescriptor {
     }
 
     public String[] getDependencyConfigurations(String[] moduleConfigurations) {
-        Set confs = new LinkedHashSet();
-        for (int i = 0; i < moduleConfigurations.length; i++) {
-            confs.addAll(Arrays.asList(getDependencyConfigurations(moduleConfigurations[i])));
+        Set<String> confs = new LinkedHashSet<>();
+        for (String moduleConfiguration : moduleConfigurations) {
+            confs.addAll(Arrays.asList(getDependencyConfigurations(moduleConfiguration)));
         }
         if (confs.contains("*")) {
             return new String[] {"*"};
         }
-        return (String[]) confs.toArray(new String[confs.size()]);
+        return confs.toArray(new String[confs.size()]);
     }
 
     public DependencyArtifactDescriptor[] getDependencyArtifacts(String moduleConfiguration) {
-        Collection artifacts = getCollectionForConfiguration(moduleConfiguration,
-            dependencyArtifacts);
-        return (DependencyArtifactDescriptor[]) artifacts
-                .toArray(new DependencyArtifactDescriptor[artifacts.size()]);
+        Collection<DependencyArtifactDescriptor> artifacts = getCollectionForConfiguration(
+            moduleConfiguration, dependencyArtifacts);
+        return artifacts.toArray(new DependencyArtifactDescriptor[artifacts.size()]);
     }
 
     public IncludeRule[] getIncludeRules(String moduleConfiguration) {
-        Collection rules = getCollectionForConfiguration(moduleConfiguration, includeRules);
-        return (IncludeRule[]) rules.toArray(new IncludeRule[rules.size()]);
+        Collection<IncludeRule> rules = getCollectionForConfiguration(moduleConfiguration,
+            includeRules);
+        return rules.toArray(new IncludeRule[rules.size()]);
     }
 
     public ExcludeRule[] getExcludeRules(String moduleConfiguration) {
-        Collection rules = getCollectionForConfiguration(moduleConfiguration, excludeRules);
-        return (ExcludeRule[]) rules.toArray(new ExcludeRule[rules.size()]);
+        Collection<ExcludeRule> rules = getCollectionForConfiguration(moduleConfiguration,
+            excludeRules);
+        return rules.toArray(new ExcludeRule[rules.size()]);
     }
 
-    private Set getCollectionForConfiguration(String moduleConfiguration, Map collectionMap) {
+    private <T> Set<T> getCollectionForConfiguration(String moduleConfiguration,
+            Map<String, Collection<T>> collectionMap) {
         if (collectionMap == null || collectionMap.isEmpty()) {
             return Collections.emptySet();
         }
-        Collection artifacts = (Collection) collectionMap.get(moduleConfiguration);
-        Collection defArtifacts = (Collection) collectionMap.get("*");
-        Set ret = new LinkedHashSet();
+        Collection<T> artifacts = collectionMap.get(moduleConfiguration);
+        Collection<T> defArtifacts = collectionMap.get("*");
+        Set<T> ret = new LinkedHashSet<>();
         if (artifacts != null) {
             ret.addAll(artifacts);
         }
@@ -488,59 +483,56 @@ public class DefaultDependencyDescriptor implements DependencyDescriptor {
     }
 
     public DependencyArtifactDescriptor[] getDependencyArtifacts(String[] moduleConfigurations) {
-        Set artifacts = new LinkedHashSet();
-        for (int i = 0; i < moduleConfigurations.length; i++) {
-            artifacts.addAll(Arrays.asList(getDependencyArtifacts(moduleConfigurations[i])));
+        Set<DependencyArtifactDescriptor> artifacts = new LinkedHashSet<>();
+        for (String moduleConfiguration : moduleConfigurations) {
+            artifacts.addAll(Arrays.asList(getDependencyArtifacts(moduleConfiguration)));
         }
-        return (DependencyArtifactDescriptor[]) artifacts
-                .toArray(new DependencyArtifactDescriptor[artifacts.size()]);
+        return artifacts.toArray(new DependencyArtifactDescriptor[artifacts.size()]);
     }
 
     public IncludeRule[] getIncludeRules(String[] moduleConfigurations) {
-        Set rules = new LinkedHashSet();
-        for (int i = 0; i < moduleConfigurations.length; i++) {
-            rules.addAll(Arrays.asList(getIncludeRules(moduleConfigurations[i])));
+        Set<IncludeRule> rules = new LinkedHashSet<>();
+        for (String moduleConfiguration : moduleConfigurations) {
+            rules.addAll(Arrays.asList(getIncludeRules(moduleConfiguration)));
         }
-        return (IncludeRule[]) rules.toArray(new IncludeRule[rules.size()]);
+        return rules.toArray(new IncludeRule[rules.size()]);
     }
 
     public ExcludeRule[] getExcludeRules(String[] moduleConfigurations) {
-        Set rules = new LinkedHashSet();
-        for (int i = 0; i < moduleConfigurations.length; i++) {
-            rules.addAll(Arrays.asList(getExcludeRules(moduleConfigurations[i])));
+        Set<ExcludeRule> rules = new LinkedHashSet<>();
+        for (String moduleConfiguration : moduleConfigurations) {
+            rules.addAll(Arrays.asList(getExcludeRules(moduleConfiguration)));
         }
-        return (ExcludeRule[]) rules.toArray(new ExcludeRule[rules.size()]);
+        return rules.toArray(new ExcludeRule[rules.size()]);
     }
 
     public DependencyArtifactDescriptor[] getAllDependencyArtifacts() {
         if (dependencyArtifacts == null) {
             return new DependencyArtifactDescriptor[0];
         }
-        Set ret = mergeAll(dependencyArtifacts);
-        return (DependencyArtifactDescriptor[]) ret.toArray(new DependencyArtifactDescriptor[ret
-                .size()]);
+        Set<DependencyArtifactDescriptor> ret = mergeAll(dependencyArtifacts);
+        return ret.toArray(new DependencyArtifactDescriptor[ret.size()]);
     }
 
     public IncludeRule[] getAllIncludeRules() {
         if (includeRules == null) {
             return new IncludeRule[0];
         }
-        Set ret = mergeAll(includeRules);
-        return (IncludeRule[]) ret.toArray(new IncludeRule[ret.size()]);
+        Set<IncludeRule> ret = mergeAll(includeRules);
+        return ret.toArray(new IncludeRule[ret.size()]);
     }
 
     public ExcludeRule[] getAllExcludeRules() {
         if (excludeRules == null) {
             return new ExcludeRule[0];
         }
-        Set ret = mergeAll(excludeRules);
-        return (ExcludeRule[]) ret.toArray(new ExcludeRule[ret.size()]);
+        Set<ExcludeRule> ret = mergeAll(excludeRules);
+        return ret.toArray(new ExcludeRule[ret.size()]);
     }
 
-    private Set mergeAll(Map artifactsMap) {
-        Set ret = new LinkedHashSet();
-        for (Iterator it = artifactsMap.values().iterator(); it.hasNext();) {
-            Collection artifacts = (Collection) it.next();
+    private <T> Set<T> mergeAll(Map<String, Collection<T>> artifactsMap) {
+        Set<T> ret = new LinkedHashSet<>();
+        for (Collection<T> artifacts : artifactsMap.values()) {
             ret.addAll(artifacts);
         }
         return ret;
@@ -561,17 +553,16 @@ public class DefaultDependencyDescriptor implements DependencyDescriptor {
             }
             if (config instanceof ConfigurationGroup) {
                 ConfigurationGroup group = (ConfigurationGroup) config;
-                String[] members = group.getMembersConfigurationNames();
-                for (int i = 0; i < members.length; i++) {
-                    addDependencyConfiguration(members[i], depConf);
+                for (String member : group.getMembersConfigurationNames()) {
+                    addDependencyConfiguration(member, depConf);
                 }
                 return;
             }
         }
 
-        List confsList = (List) confs.get(masterConf);
+        List<String> confsList = confs.get(masterConf);
         if (confsList == null) {
-            confsList = new ArrayList();
+            confsList = new ArrayList<>();
             confs.put(masterConf, confsList);
         }
         if (!confsList.contains(depConf)) {
@@ -591,10 +582,11 @@ public class DefaultDependencyDescriptor implements DependencyDescriptor {
         addObjectToConfiguration(masterConf, rule, getExcludeRules());
     }
 
-    private void addObjectToConfiguration(String callerConf, Object toAdd, Map confsMap) {
-        Collection col = (Collection) confsMap.get(callerConf);
+    private <T> void addObjectToConfiguration(String callerConf, T toAdd,
+            Map<String, Collection<T>> confsMap) {
+        Collection<T> col = confsMap.get(callerConf);
         if (col == null) {
-            col = new ArrayList();
+            col = new ArrayList<>();
             confsMap.put(callerConf, col);
         }
         col.add(toAdd);
@@ -613,9 +605,8 @@ public class DefaultDependencyDescriptor implements DependencyDescriptor {
             artifactId = NameSpaceHelper
                     .transform(artifactId, namespace.getFromSystemTransformer());
         }
-        ExcludeRule[] rules = getExcludeRules(moduleConfigurations);
-        for (int i = 0; i < rules.length; i++) {
-            if (MatcherHelper.matches(rules[i].getMatcher(), rules[i].getId(), artifactId)) {
+        for (ExcludeRule rule : getExcludeRules(moduleConfigurations)) {
+            if (MatcherHelper.matches(rule.getMatcher(), rule.getId(), artifactId)) {
                 return true;
             }
         }
@@ -657,7 +648,7 @@ public class DefaultDependencyDescriptor implements DependencyDescriptor {
         return revId.getAttribute(attName);
     }
 
-    public Map getAttributes() {
+    public Map<String, String> getAttributes() {
         return revId.getAttributes();
     }
 
@@ -665,11 +656,11 @@ public class DefaultDependencyDescriptor implements DependencyDescriptor {
         return revId.getExtraAttribute(attName);
     }
 
-    public Map getExtraAttributes() {
+    public Map<String, String> getExtraAttributes() {
         return revId.getExtraAttributes();
     }
 
-    public Map getQualifiedExtraAttributes() {
+    public Map<String, String> getQualifiedExtraAttributes() {
         return revId.getQualifiedExtraAttributes();
     }
 
@@ -677,35 +668,36 @@ public class DefaultDependencyDescriptor implements DependencyDescriptor {
         return asSystem;
     }
 
-    private void setDependencyArtifacts(Map dependencyArtifacts) {
+    private void setDependencyArtifacts(
+            Map<String, Collection<DependencyArtifactDescriptor>> dependencyArtifacts) {
         this.dependencyArtifacts = dependencyArtifacts;
     }
 
-    private Map getDependencyArtifacts() {
+    private Map<String, Collection<DependencyArtifactDescriptor>> getDependencyArtifacts() {
         if (dependencyArtifacts == null) {
-            dependencyArtifacts = new LinkedHashMap();
+            dependencyArtifacts = new LinkedHashMap<>();
         }
         return dependencyArtifacts;
     }
 
-    private void setIncludeRules(Map includeRules) {
+    private void setIncludeRules(Map<String, Collection<IncludeRule>> includeRules) {
         this.includeRules = includeRules;
     }
 
-    private Map getIncludeRules() {
+    private Map<String, Collection<IncludeRule>> getIncludeRules() {
         if (includeRules == null) {
-            includeRules = new LinkedHashMap();
+            includeRules = new LinkedHashMap<>();
         }
         return includeRules;
     }
 
-    private void setExcludeRules(Map excludeRules) {
+    private void setExcludeRules(Map<String, Collection<ExcludeRule>> excludeRules) {
         this.excludeRules = excludeRules;
     }
 
-    private Map getExcludeRules() {
+    private Map<String, Collection<ExcludeRule>> getExcludeRules() {
         if (excludeRules == null) {
-            excludeRules = new LinkedHashMap();
+            excludeRules = new LinkedHashMap<>();
         }
         return excludeRules;
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/module/descriptor/DefaultExcludeRule.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/module/descriptor/DefaultExcludeRule.java b/src/java/org/apache/ivy/core/module/descriptor/DefaultExcludeRule.java
index 52acf82..e99dd0c 100644
--- a/src/java/org/apache/ivy/core/module/descriptor/DefaultExcludeRule.java
+++ b/src/java/org/apache/ivy/core/module/descriptor/DefaultExcludeRule.java
@@ -24,7 +24,7 @@ import org.apache.ivy.plugins.matcher.PatternMatcher;
 
 public class DefaultExcludeRule extends AbstractIncludeExcludeRule implements ExcludeRule {
 
-    public DefaultExcludeRule(ArtifactId aid, PatternMatcher matcher, Map extraAttributes) {
+    public DefaultExcludeRule(ArtifactId aid, PatternMatcher matcher, Map<String, String> extraAttributes) {
         super(aid, matcher, extraAttributes);
     }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/module/descriptor/DefaultExtendsDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/module/descriptor/DefaultExtendsDescriptor.java b/src/java/org/apache/ivy/core/module/descriptor/DefaultExtendsDescriptor.java
index 1900a05..33753a0 100644
--- a/src/java/org/apache/ivy/core/module/descriptor/DefaultExtendsDescriptor.java
+++ b/src/java/org/apache/ivy/core/module/descriptor/DefaultExtendsDescriptor.java
@@ -29,7 +29,7 @@ public class DefaultExtendsDescriptor implements ExtendsDescriptor {
 
     private String location;
 
-    private List extendsTypes;
+    private final List<String> extendsTypes;
 
     private boolean local;
 
@@ -42,7 +42,7 @@ public class DefaultExtendsDescriptor implements ExtendsDescriptor {
         this.parent = parent;
         this.location = location;
         this.local = local;
-        this.extendsTypes = new ArrayList(types.length);
+        this.extendsTypes = new ArrayList<>(types.length);
         extendsTypes.addAll(Arrays.asList(types));
     }
 
@@ -63,7 +63,7 @@ public class DefaultExtendsDescriptor implements ExtendsDescriptor {
     }
 
     public String[] getExtendsTypes() {
-        return (String[]) extendsTypes.toArray(new String[extendsTypes.size()]);
+        return extendsTypes.toArray(new String[extendsTypes.size()]);
     }
 
     public boolean isAllInherited() {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/module/descriptor/DefaultIncludeRule.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/module/descriptor/DefaultIncludeRule.java b/src/java/org/apache/ivy/core/module/descriptor/DefaultIncludeRule.java
index 87ddc58..82828de 100644
--- a/src/java/org/apache/ivy/core/module/descriptor/DefaultIncludeRule.java
+++ b/src/java/org/apache/ivy/core/module/descriptor/DefaultIncludeRule.java
@@ -24,7 +24,7 @@ import org.apache.ivy.plugins.matcher.PatternMatcher;
 
 public class DefaultIncludeRule extends AbstractIncludeExcludeRule implements IncludeRule {
 
-    public DefaultIncludeRule(ArtifactId aid, PatternMatcher matcher, Map extraAttributes) {
+    public DefaultIncludeRule(ArtifactId aid, PatternMatcher matcher, Map<String, String> extraAttributes) {
         super(aid, matcher, extraAttributes);
     }
 


[7/7] ant-ivy git commit: Add generics and Java 7 syntax to core

Posted by ja...@apache.org.
Add generics and Java 7 syntax to core

This closes #52 pull request at github/apache/ant-ivy


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

Branch: refs/heads/master
Commit: 6920717979fe3c0d29f4704404492e1c5c0d7c2c
Parents: 844100a
Author: twogee <g....@gmail.com>
Authored: Thu Jul 6 08:04:24 2017 +0200
Committer: Jaikiran Pai <ja...@apache.org>
Committed: Mon Jul 17 11:07:59 2017 +0530

----------------------------------------------------------------------
 .checkstyle                                     |   1 +
 src/java/org/apache/ivy/Ivy14.java              | 207 ++++++--------
 src/java/org/apache/ivy/Main.java               |  60 ++--
 src/java/org/apache/ivy/ant/BuildOBRTask.java   |   5 +-
 src/java/org/apache/ivy/ant/IvyBuildList.java   |  11 +-
 src/java/org/apache/ivy/ant/IvyBuildNumber.java |   9 +-
 .../org/apache/ivy/ant/IvyCacheFileset.java     |   6 +-
 src/java/org/apache/ivy/ant/IvyCacheTask.java   |   3 +-
 src/java/org/apache/ivy/ant/IvyConfigure.java   |   4 +-
 .../org/apache/ivy/ant/IvyDependencyTree.java   |   3 +-
 .../ivy/ant/IvyDependencyUpdateChecker.java     |   6 +-
 .../org/apache/ivy/ant/IvyPostResolveTask.java  |  10 +-
 .../org/apache/ivy/ant/IvyRepositoryReport.java |   5 +-
 src/java/org/apache/ivy/ant/IvyRetrieve.java    |   3 +-
 src/java/org/apache/ivy/core/IvyContext.java    |  63 ++---
 .../org/apache/ivy/core/IvyPatternHelper.java   |  49 ++--
 .../apache/ivy/core/cache/ArtifactOrigin.java   |   2 +-
 .../cache/DefaultRepositoryCacheManager.java    |  28 +-
 .../cache/DefaultResolutionCacheManager.java    |  27 +-
 .../core/cache/ModuleDescriptorMemoryCache.java |   8 +-
 .../ivy/core/cache/ParserSettingsMonitor.java   |  26 +-
 .../org/apache/ivy/core/check/CheckEngine.java  |  50 ++--
 .../apache/ivy/core/deliver/DeliverEngine.java  |  47 ++--
 .../org/apache/ivy/core/event/EventManager.java |  10 +-
 .../ivy/core/event/FilteredIvyListener.java     |   6 +-
 .../org/apache/ivy/core/event/IvyEvent.java     |   2 +-
 .../apache/ivy/core/event/IvyEventFilter.java   |  42 ++-
 .../event/publish/EndArtifactPublishEvent.java  |   3 -
 .../publish/StartArtifactPublishEvent.java      |   3 -
 .../apache/ivy/core/install/InstallEngine.java  |  49 ++--
 .../ivy/core/install/InstallEngineSettings.java |   4 +-
 .../apache/ivy/core/install/InstallOptions.java |   9 +-
 .../module/descriptor/AbstractArtifact.java     |   6 +-
 .../descriptor/AbstractIncludeExcludeRule.java  |   7 +-
 .../core/module/descriptor/Configuration.java   |  28 +-
 .../module/descriptor/ConfigurationGroup.java   |  12 +-
 .../descriptor/ConfigurationIntersection.java   |  12 +-
 .../core/module/descriptor/DefaultArtifact.java |   4 +-
 .../DefaultDependencyArtifactDescriptor.java    |   6 +-
 .../descriptor/DefaultDependencyDescriptor.java | 276 +++++++++----------
 .../module/descriptor/DefaultExcludeRule.java   |   2 +-
 .../descriptor/DefaultExtendsDescriptor.java    |   6 +-
 .../module/descriptor/DefaultIncludeRule.java   |   2 +-
 .../descriptor/DefaultModuleDescriptor.java     | 159 +++++------
 .../core/module/descriptor/ExtraInfoHolder.java |   4 +-
 .../ivy/core/module/descriptor/MDArtifact.java  |   8 +-
 .../module/descriptor/ModuleDescriptor.java     |   2 +-
 .../ivy/core/module/id/ArtifactRevisionId.java  |   5 +-
 .../ivy/core/module/id/MatcherLookup.java       |  40 +--
 .../org/apache/ivy/core/module/id/ModuleId.java |  14 +-
 .../ivy/core/module/id/ModuleRevisionId.java    |  10 +-
 .../apache/ivy/core/module/id/ModuleRules.java  |  29 +-
 .../ivy/core/module/status/StatusManager.java   |  44 ++-
 .../apache/ivy/core/pack/PackagingManager.java  |   7 +-
 .../apache/ivy/core/pack/PackingRegistry.java   |   2 +-
 .../org/apache/ivy/core/pack/ZipPacking.java    |  12 +-
 .../apache/ivy/core/publish/PublishEngine.java  |  22 +-
 .../ivy/core/report/ArtifactDownloadReport.java |   9 +-
 .../core/report/ConfigurationResolveReport.java |  35 +--
 .../apache/ivy/core/report/DownloadReport.java  |  15 +-
 .../apache/ivy/core/report/ResolveReport.java   |  66 +++--
 .../repository/RepositoryManagementEngine.java  |  72 +++--
 .../org/apache/ivy/core/resolve/IvyNode.java    |  82 +++---
 .../apache/ivy/core/resolve/IvyNodeCallers.java |  30 +-
 .../ivy/core/resolve/IvyNodeEviction.java       |  50 ++--
 .../apache/ivy/core/resolve/IvyNodeUsage.java   |  30 +-
 .../apache/ivy/core/resolve/ResolveData.java    |  57 ++--
 .../apache/ivy/core/resolve/ResolveEngine.java  | 180 ++++++------
 .../apache/ivy/core/resolve/ResolveOptions.java |   7 +-
 .../org/apache/ivy/core/resolve/VisitData.java  |   4 +-
 .../org/apache/ivy/core/resolve/VisitNode.java  |   6 +-
 .../ivy/core/retrieve/RetrieveEngine.java       |  71 +++--
 .../ivy/core/retrieve/RetrieveOptions.java      |   7 +-
 .../ivy/core/retrieve/RetrieveReport.java       |  12 +-
 .../apache/ivy/core/search/SearchEngine.java    | 132 +++++----
 .../apache/ivy/core/settings/IvySettings.java   |  56 ++--
 .../ivy/core/settings/XmlSettingsParser.java    | 176 ++++++------
 .../core/sort/CollectionOfModulesToSort.java    |   6 +-
 .../ivy/core/sort/ModuleDescriptorSorter.java   |   6 +-
 .../org/apache/ivy/core/sort/ModuleInSort.java  |  10 +-
 .../org/apache/ivy/core/sort/SortEngine.java    |  11 +-
 .../ivy/osgi/core/ManifestHeaderValue.java      |   2 +-
 .../apache/ivy/osgi/core/ManifestParser.java    |   2 +-
 .../ivy/osgi/filter/OSGiFilterParser.java       |   2 +-
 .../ivy/osgi/obr/xml/RequirementAdapter.java    |   4 +-
 .../apache/ivy/osgi/p2/P2ArtifactParser.java    |   2 +-
 .../apache/ivy/osgi/p2/P2CompositeParser.java   |   2 +-
 .../apache/ivy/osgi/p2/P2MetadataParser.java    |   2 +-
 .../org/apache/ivy/osgi/p2/XMLInputParser.java  |   2 +-
 .../ivy/osgi/repo/AbstractOSGiResolver.java     |   9 +-
 .../ivy/osgi/repo/EditableRepoDescriptor.java   |   9 +-
 .../ivy/osgi/repo/ModuleDescriptorWrapper.java  |   2 +-
 .../ivy/osgi/updatesite/UpdateSiteLoader.java   |   7 +-
 .../org/apache/ivy/osgi/util/ParseUtil.java     |   4 +-
 .../apache/ivy/osgi/util/VersionComparator.java |   2 +-
 .../circular/CircularDependencyHelper.java      |  23 +-
 .../LatestCompatibleConflictManager.java        |  10 +-
 .../plugins/conflict/LatestConflictManager.java |   2 +-
 .../plugins/latest/AbstractLatestStrategy.java  |   3 +-
 .../ivy/plugins/lock/DeleteOnExitHook.java      |   3 +-
 .../apache/ivy/plugins/parser/m2/PomReader.java |   2 +-
 .../parser/xml/XmlModuleDescriptorParser.java   |  12 +-
 .../parser/xml/XmlModuleDescriptorUpdater.java  |  62 ++---
 .../parser/xml/XmlModuleDescriptorWriter.java   | 201 ++++++--------
 .../ivy/plugins/report/XmlReportWriter.java     |   6 +-
 .../plugins/repository/sftp/SFTPRepository.java |  14 +-
 .../ssh/AbstractSshBasedRepository.java         |   8 +-
 .../apache/ivy/plugins/repository/ssh/Scp.java  |  10 +-
 .../ivy/plugins/repository/ssh/SshCache.java    |   1 -
 .../plugins/repository/ssh/SshRepository.java   |   2 +-
 .../plugins/repository/vfs/VfsRepository.java   |   2 +-
 .../ivy/plugins/repository/vfs/VfsResource.java |   2 +-
 .../repository/vsftp/VsftpRepository.java       |  26 +-
 .../resolver/AbstractPatternsBasedResolver.java |  11 +-
 .../ivy/plugins/resolver/AbstractResolver.java  |   1 +
 .../ivy/plugins/resolver/BasicResolver.java     |  10 +-
 .../ivy/plugins/resolver/ChainResolver.java     |   1 +
 .../plugins/resolver/FileSystemResolver.java    |  21 +-
 .../ivy/plugins/resolver/VsftpResolver.java     |   2 +-
 .../bouncycastle/OpenPGPSignatureGenerator.java |   7 +-
 .../ivy/plugins/trigger/AbstractTrigger.java    |   6 +-
 .../org/apache/ivy/plugins/trigger/Trigger.java |   3 +-
 .../plugins/version/ChainVersionMatcher.java    |   9 +-
 .../analyser/JarJarDependencyAnalyser.java      |  19 +-
 src/java/org/apache/ivy/util/Configurator.java  |  24 +-
 src/java/org/apache/ivy/util/Credentials.java   |  10 +-
 src/java/org/apache/ivy/util/FileUtil.java      |   4 +-
 src/java/org/apache/ivy/util/MemoryUtil.java    |   2 +-
 .../apache/ivy/util/MessageLoggerHelper.java    |   2 +-
 src/java/org/apache/ivy/util/StringUtils.java   |   7 +-
 .../org/apache/ivy/util/filter/AndFilter.java   |  14 +-
 .../apache/ivy/util/filter/FilterHelper.java    |   6 +-
 .../org/apache/ivy/util/filter/NoFilter.java    |   8 +-
 .../org/apache/ivy/util/filter/NotFilter.java   |  10 +-
 .../org/apache/ivy/util/filter/OrFilter.java    |  14 +-
 .../apache/ivy/util/url/HttpClientHandler.java  |   2 +-
 .../apache/ivy/util/url/URLHandlerRegistry.java |   2 +-
 .../ivy/plugins/resolver/CustomResolver.java    |   2 +-
 test/java/org/apache/ivy/TestHelper.java        |  36 +--
 .../org/apache/ivy/ant/AntCallTriggerTest.java  |   4 +-
 .../org/apache/ivy/ant/IvyCacheFilesetTest.java |  12 +-
 .../org/apache/ivy/ant/IvyConfigureTest.java    |  11 +-
 .../java/org/apache/ivy/ant/IvyDeliverTest.java |   9 +-
 .../java/org/apache/ivy/ant/IvyPublishTest.java |   8 +-
 .../org/apache/ivy/ant/IvyResourcesTest.java    |  12 +-
 test/java/org/apache/ivy/ant/IvyTaskTest.java   |   3 +-
 .../ivy/ant/testutil/AntTestListener.java       |  18 ++
 .../cache/ModuleDescriptorMemoryCacheTest.java  |  13 +-
 .../core/module/descriptor/IvyMakePomTest.java  |  23 +-
 .../core/module/id/ModuleRevisionIdTest.java    |  14 +-
 .../ivy/core/module/id/ModuleRulesTest.java     |  38 +--
 .../ivy/core/publish/PublishEventsTest.java     |  17 +-
 .../apache/ivy/core/retrieve/RetrieveTest.java  |  15 +-
 .../core/settings/XmlSettingsParserTest.java    |  36 +--
 .../ivy/osgi/core/OsgiLatestStrategyTest.java   |   8 +-
 .../osgi/updatesite/UpdateSiteLoaderTest.java   |   8 +-
 .../conflict/LatestConflictManagerTest.java     |  12 +-
 .../m2/PomModuleDescriptorParserTest.java       | 130 ++++-----
 .../xml/XmlModuleDescriptorParserTest.java      |  23 +-
 .../parser/xml/XmlModuleUpdaterTest.java        |  16 +-
 .../ivy/plugins/resolver/ChainResolverTest.java |  20 +-
 .../plugins/resolver/IBiblioResolverTest.java   |  16 +-
 .../plugins/resolver/IvyRepResolverTest.java    |  16 +-
 test/java/org/apache/ivy/util/CacheCleaner.java |   5 +-
 .../org/apache/ivy/util/ConfiguratorTest.java   |  10 +-
 .../apache/ivy/util/IvyPatternHelperTest.java   |   4 +-
 .../java/org/apache/ivy/util/TestXmlHelper.java |   9 +-
 .../ivy/util/url/ArtifactoryListingTest.java    |   8 +-
 168 files changed, 1788 insertions(+), 2013 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/.checkstyle
----------------------------------------------------------------------
diff --git a/.checkstyle b/.checkstyle
index 59fdb69..c6310ea 100644
--- a/.checkstyle
+++ b/.checkstyle
@@ -25,5 +25,6 @@
     <fileset name="Ivy Checkstyle config" enabled="true" check-config-name="Ivy Checkstyle Config" local="true">
         <file-match-pattern match-pattern="^src.java.*.java$" include-pattern="true"/>
         <file-match-pattern match-pattern="^src.example.*.java$" include-pattern="true"/>
+        <file-match-pattern match-pattern="^test.java.*.java$" include-pattern="true"/>
     </fileset>
 </fileset-config>

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/Ivy14.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/Ivy14.java b/src/java/org/apache/ivy/Ivy14.java
index 28bc4ca..5e1de65 100644
--- a/src/java/org/apache/ivy/Ivy14.java
+++ b/src/java/org/apache/ivy/Ivy14.java
@@ -26,6 +26,7 @@ import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import org.apache.ivy.core.deliver.DeliverOptions;
 import org.apache.ivy.core.deliver.PublishingDependencyRevisionResolver;
@@ -117,18 +118,18 @@ public class Ivy14 {
         deliver(mrid, revision, cache, destIvyPattern, status, pubdate, pdrResolver, validate, true);
     }
 
-    public Map determineArtifactsToCopy(ModuleId moduleId, String[] confs, File cache,
-            String destFilePattern, String destIvyPattern, Filter artifactFilter)
-            throws ParseException, IOException {
+    public Map<ArtifactDownloadReport, Set<String>> determineArtifactsToCopy(ModuleId moduleId,
+            String[] confs, File cache, String destFilePattern, String destIvyPattern,
+            Filter<Artifact> artifactFilter) throws ParseException, IOException {
         return ivy.getRetrieveEngine().determineArtifactsToCopy(
-            new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()),
-            destFilePattern,
+            new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()), destFilePattern,
             new RetrieveOptions().setConfs(confs).setDestIvyPattern(destIvyPattern)
                     .setArtifactFilter(artifactFilter));
     }
 
-    public Map determineArtifactsToCopy(ModuleId moduleId, String[] confs, File cache,
-            String destFilePattern, String destIvyPattern) throws ParseException, IOException {
+    public Map<ArtifactDownloadReport, Set<String>> determineArtifactsToCopy(ModuleId moduleId,
+            String[] confs, File cache, String destFilePattern, String destIvyPattern)
+            throws ParseException, IOException {
         return ivy.getRetrieveEngine().determineArtifactsToCopy(
             new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()), destFilePattern,
             new RetrieveOptions().setConfs(confs).setDestIvyPattern(destIvyPattern));
@@ -147,26 +148,20 @@ public class Ivy14 {
 
     public IvyNode[] getDependencies(ModuleDescriptor md, String[] confs, File cache, Date date,
             ResolveReport report, boolean validate, boolean transitive) {
-        return ivy.getResolveEngine().getDependencies(
-            md,
-            newResolveOptions(confs, null, cache, date, validate, false, transitive, false, true,
-                true, FilterHelper.NO_FILTER), report);
+        return ivy.getResolveEngine().getDependencies(md, newResolveOptions(confs, null, cache,
+            date, validate, false, transitive, false, true, true, FilterHelper.NO_FILTER), report);
     }
 
     public IvyNode[] getDependencies(ModuleDescriptor md, String[] confs, File cache, Date date,
             ResolveReport report, boolean validate) {
-        return ivy.getResolveEngine().getDependencies(
-            md,
-            newResolveOptions(confs, null, cache, date, validate, false, true, false, true, true,
-                FilterHelper.NO_FILTER), report);
+        return ivy.getResolveEngine().getDependencies(md, newResolveOptions(confs, null, cache,
+            date, validate, false, true, false, true, true, FilterHelper.NO_FILTER), report);
     }
 
     public IvyNode[] getDependencies(URL ivySource, String[] confs, File cache, Date date,
             boolean validate) throws ParseException, IOException {
-        return ivy.getResolveEngine().getDependencies(
-            ivySource,
-            newResolveOptions(confs, null, cache, date, validate, false, true, false, true, true,
-                FilterHelper.NO_FILTER));
+        return ivy.getResolveEngine().getDependencies(ivySource, newResolveOptions(confs, null,
+            cache, date, validate, false, true, false, true, true, FilterHelper.NO_FILTER));
     }
 
     public String getVariable(String name) {
@@ -174,11 +169,12 @@ public class Ivy14 {
     }
 
     public ResolveReport install(ModuleRevisionId mrid, String from, String to, boolean transitive,
-            boolean validate, boolean overwrite, Filter artifactFilter, File cache,
+            boolean validate, boolean overwrite, Filter<Artifact> artifactFilter, File cache,
             String matcherName) throws IOException {
-        return ivy.install(mrid, from, to, new InstallOptions().setTransitive(transitive)
-                .setValidate(validate).setOverwrite(overwrite).setArtifactFilter(artifactFilter)
-                .setMatcherName(matcherName));
+        return ivy.install(mrid, from, to,
+            new InstallOptions().setTransitive(transitive).setValidate(validate)
+                    .setOverwrite(overwrite).setArtifactFilter(artifactFilter)
+                    .setMatcherName(matcherName));
     }
 
     public void interrupt() {
@@ -225,36 +221,30 @@ public class Ivy14 {
         return ivy.listRevisions(org, module);
     }
 
-    public String[] listTokenValues(String token, Map otherTokenValues) {
+    public String[] listTokenValues(String token, Map<String, Object> otherTokenValues) {
         return ivy.listTokenValues(token, otherTokenValues);
     }
 
-    public Collection publish(ModuleDescriptor md, DependencyResolver resolver,
-            Collection srcArtifactPattern, String srcIvyPattern, Artifact[] extraArtifacts,
+    public Collection<Artifact> publish(ModuleDescriptor md, DependencyResolver resolver,
+            Collection<String> srcArtifactPattern, String srcIvyPattern, Artifact[] extraArtifacts,
             boolean overwrite, String conf) throws IOException {
-        return ivy.getPublishEngine().publish(
-            md,
-            srcArtifactPattern,
-            resolver,
+        return ivy.getPublishEngine().publish(md, srcArtifactPattern, resolver,
             new PublishOptions().setSrcIvyPattern(srcIvyPattern).setExtraArtifacts(extraArtifacts)
                     .setOverwrite(overwrite).setConfs(splitConfs(conf)));
     }
 
-    public Collection publish(ModuleRevisionId mrid, String pubrevision, File cache,
-            Collection srcArtifactPattern, String resolverName, String srcIvyPattern,
+    public Collection<Artifact> publish(ModuleRevisionId mrid, String pubrevision, File cache,
+            Collection<String> srcArtifactPattern, String resolverName, String srcIvyPattern,
             String status, Date pubdate, Artifact[] extraArtifacts, boolean validate,
             boolean overwrite, boolean update, String conf) throws IOException {
-        return ivy.publish(
-            mrid,
-            srcArtifactPattern,
-            resolverName,
+        return ivy.publish(mrid, srcArtifactPattern, resolverName,
             new PublishOptions().setStatus(status).setPubdate(pubdate).setPubrevision(pubrevision)
                     .setSrcIvyPattern(srcIvyPattern).setExtraArtifacts(extraArtifacts)
                     .setUpdate(update).setValidate(validate).setOverwrite(overwrite)
                     .setConfs(splitConfs(conf)));
     }
 
-    public Collection publish(ModuleRevisionId mrid, String pubrevision, File cache,
+    public Collection<Artifact> publish(ModuleRevisionId mrid, String pubrevision, File cache,
             String srcArtifactPattern, String resolverName, String srcIvyPattern, boolean validate,
             boolean overwrite) throws IOException {
         return ivy.publish(mrid, Collections.singleton(srcArtifactPattern), resolverName,
@@ -262,7 +252,7 @@ public class Ivy14 {
                     .setValidate(validate).setOverwrite(overwrite));
     }
 
-    public Collection publish(ModuleRevisionId mrid, String pubrevision, File cache,
+    public Collection<Artifact> publish(ModuleRevisionId mrid, String pubrevision, File cache,
             String srcArtifactPattern, String resolverName, String srcIvyPattern, boolean validate)
             throws IOException {
         return ivy.publish(mrid, Collections.singleton(srcArtifactPattern), resolverName,
@@ -270,14 +260,11 @@ public class Ivy14 {
                     .setValidate(validate));
     }
 
-    public Collection publish(ModuleRevisionId mrid, String pubrevision, File cache,
+    public Collection<Artifact> publish(ModuleRevisionId mrid, String pubrevision, File cache,
             String srcArtifactPattern, String resolverName, String srcIvyPattern, String status,
             Date pubdate, Artifact[] extraArtifacts, boolean validate, boolean overwrite,
             boolean update, String conf) throws IOException {
-        return ivy.publish(
-            mrid,
-            Collections.singleton(srcArtifactPattern),
-            resolverName,
+        return ivy.publish(mrid, Collections.singleton(srcArtifactPattern), resolverName,
             new PublishOptions().setStatus(status).setPubdate(pubdate).setPubrevision(pubrevision)
                     .setSrcIvyPattern(srcIvyPattern).setExtraArtifacts(extraArtifacts)
                     .setUpdate(update).setValidate(validate).setOverwrite(overwrite)
@@ -290,17 +277,15 @@ public class Ivy14 {
 
     public ResolveReport resolve(ModuleDescriptor md, String[] confs, File cache, Date date,
             boolean validate, boolean useCacheOnly, boolean transitive, boolean useOrigin,
-            boolean download, boolean outputReport, Filter artifactFilter) throws ParseException,
-            IOException {
-        return ivy.resolve(
-            md,
-            newResolveOptions(confs, null, cache, date, validate, useCacheOnly, transitive,
-                useOrigin, download, outputReport, artifactFilter));
+            boolean download, boolean outputReport, Filter<Artifact> artifactFilter)
+            throws ParseException, IOException {
+        return ivy.resolve(md, newResolveOptions(confs, null, cache, date, validate, useCacheOnly,
+            transitive, useOrigin, download, outputReport, artifactFilter));
     }
 
-    private ResolveOptions newResolveOptions(String[] confs, String revision, File cache,
-            Date date, boolean validate, boolean useCacheOnly, boolean transitive,
-            boolean useOrigin, boolean download, boolean outputReport, Filter artifactFilter) {
+    private ResolveOptions newResolveOptions(String[] confs, String revision, File cache, Date date,
+            boolean validate, boolean useCacheOnly, boolean transitive, boolean useOrigin,
+            boolean download, boolean outputReport, Filter<Artifact> artifactFilter) {
         if (useOrigin) {
             ivy.getSettings().useDeprecatedUseOrigin();
         }
@@ -311,98 +296,77 @@ public class Ivy14 {
 
     public ResolveReport resolve(ModuleDescriptor md, String[] confs, File cache, Date date,
             boolean validate, boolean useCacheOnly, boolean transitive, boolean download,
-            boolean outputReport, Filter artifactFilter) throws ParseException, IOException {
-        return ivy.resolve(
-            md,
-            newResolveOptions(confs, null, cache, date, validate, useCacheOnly, transitive, false,
-                download, outputReport, artifactFilter));
+            boolean outputReport, Filter<Artifact> artifactFilter)
+            throws ParseException, IOException {
+        return ivy.resolve(md, newResolveOptions(confs, null, cache, date, validate, useCacheOnly,
+            transitive, false, download, outputReport, artifactFilter));
     }
 
     public ResolveReport resolve(ModuleDescriptor md, String[] confs, File cache, Date date,
-            boolean validate, boolean useCacheOnly, boolean transitive, Filter artifactFilter)
-            throws ParseException, IOException {
-        return ivy.resolve(
-            md,
-            newResolveOptions(confs, null, cache, date, validate, useCacheOnly, transitive, false,
-                true, true, artifactFilter));
+            boolean validate, boolean useCacheOnly, boolean transitive,
+            Filter<Artifact> artifactFilter) throws ParseException, IOException {
+        return ivy.resolve(md, newResolveOptions(confs, null, cache, date, validate, useCacheOnly,
+            transitive, false, true, true, artifactFilter));
     }
 
     public ResolveReport resolve(ModuleDescriptor md, String[] confs, File cache, Date date,
-            boolean validate, boolean useCacheOnly, Filter artifactFilter) throws ParseException,
-            IOException {
-        return ivy.resolve(
-            md,
-            newResolveOptions(confs, null, cache, date, validate, useCacheOnly, true, false, true,
-                true, artifactFilter));
+            boolean validate, boolean useCacheOnly, Filter<Artifact> artifactFilter)
+            throws ParseException, IOException {
+        return ivy.resolve(md, newResolveOptions(confs, null, cache, date, validate, useCacheOnly,
+            true, false, true, true, artifactFilter));
     }
 
     public ResolveReport resolve(ModuleRevisionId mrid, String[] confs, boolean transitive,
             boolean changing, File cache, Date date, boolean validate, boolean useCacheOnly,
-            boolean useOrigin, Filter artifactFilter) throws ParseException, IOException {
-        return ivy.resolve(
-            mrid,
-            newResolveOptions(confs, null, cache, date, validate, useCacheOnly, transitive,
-                useOrigin, true, true, artifactFilter), changing);
+            boolean useOrigin, Filter<Artifact> artifactFilter) throws ParseException, IOException {
+        return ivy.resolve(mrid, newResolveOptions(confs, null, cache, date, validate, useCacheOnly,
+            transitive, useOrigin, true, true, artifactFilter), changing);
     }
 
     public ResolveReport resolve(ModuleRevisionId mrid, String[] confs, boolean transitive,
             boolean changing, File cache, Date date, boolean validate, boolean useCacheOnly,
-            Filter artifactFilter) throws ParseException, IOException {
-        return ivy.resolve(
-            mrid,
-            newResolveOptions(confs, null, cache, date, validate, useCacheOnly, transitive, false,
-                true, true, artifactFilter), changing);
+            Filter<Artifact> artifactFilter) throws ParseException, IOException {
+        return ivy.resolve(mrid, newResolveOptions(confs, null, cache, date, validate, useCacheOnly,
+            transitive, false, true, true, artifactFilter), changing);
     }
 
-    public ResolveReport resolve(ModuleRevisionId mrid, String[] confs) throws ParseException,
-            IOException {
-        return ivy.resolve(
-            mrid,
-            newResolveOptions(confs, null, ivy.getSettings().getDefaultCache(), null, true, false,
-                true, false, true, true, FilterHelper.NO_FILTER), false);
+    public ResolveReport resolve(ModuleRevisionId mrid, String[] confs)
+            throws ParseException, IOException {
+        return ivy.resolve(mrid, newResolveOptions(confs, null, ivy.getSettings().getDefaultCache(),
+            null, true, false, true, false, true, true, FilterHelper.NO_FILTER), false);
     }
 
     public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache,
             Date date, boolean validate, boolean useCacheOnly, boolean transitive,
-            boolean useOrigin, Filter artifactFilter) throws ParseException, IOException {
-        return ivy.resolve(
-            ivySource,
-            newResolveOptions(confs, revision, cache, date, validate, useCacheOnly, transitive,
-                useOrigin, true, true, artifactFilter));
+            boolean useOrigin, Filter<Artifact> artifactFilter) throws ParseException, IOException {
+        return ivy.resolve(ivySource, newResolveOptions(confs, revision, cache, date, validate,
+            useCacheOnly, transitive, useOrigin, true, true, artifactFilter));
     }
 
     public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache,
             Date date, boolean validate, boolean useCacheOnly, boolean transitive,
-            Filter artifactFilter) throws ParseException, IOException {
-        return ivy.resolve(
-            ivySource,
-            newResolveOptions(confs, revision, cache, date, validate, useCacheOnly, transitive,
-                false, true, true, artifactFilter));
+            Filter<Artifact> artifactFilter) throws ParseException, IOException {
+        return ivy.resolve(ivySource, newResolveOptions(confs, revision, cache, date, validate,
+            useCacheOnly, transitive, false, true, true, artifactFilter));
     }
 
     public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache,
-            Date date, boolean validate, boolean useCacheOnly, Filter artifactFilter)
+            Date date, boolean validate, boolean useCacheOnly, Filter<Artifact> artifactFilter)
             throws ParseException, IOException {
-        return ivy.resolve(
-            ivySource,
-            newResolveOptions(confs, revision, cache, date, validate, useCacheOnly, true, false,
-                true, true, artifactFilter));
+        return ivy.resolve(ivySource, newResolveOptions(confs, revision, cache, date, validate,
+            useCacheOnly, true, false, true, true, artifactFilter));
     }
 
     public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache,
             Date date, boolean validate, boolean useCacheOnly) throws ParseException, IOException {
-        return ivy.resolve(
-            ivySource,
-            newResolveOptions(confs, revision, cache, date, validate, useCacheOnly, true, false,
-                true, true, FilterHelper.NO_FILTER));
+        return ivy.resolve(ivySource, newResolveOptions(confs, revision, cache, date, validate,
+            useCacheOnly, true, false, true, true, FilterHelper.NO_FILTER));
     }
 
     public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache,
             Date date, boolean validate) throws ParseException, IOException {
-        return ivy.resolve(
-            ivySource,
-            newResolveOptions(confs, revision, cache, date, validate, false, true, false, true,
-                true, FilterHelper.NO_FILTER));
+        return ivy.resolve(ivySource, newResolveOptions(confs, revision, cache, date, validate,
+            false, true, false, true, true, FilterHelper.NO_FILTER));
     }
 
     public ResolveReport resolve(URL ivySource) throws ParseException, IOException {
@@ -410,7 +374,7 @@ public class Ivy14 {
     }
 
     public int retrieve(ModuleId moduleId, String[] confs, File cache, String destFilePattern,
-            String destIvyPattern, Filter artifactFilter, boolean sync, boolean useOrigin,
+            String destIvyPattern, Filter<Artifact> artifactFilter, boolean sync, boolean useOrigin,
             boolean makeSymlinks) {
         try {
             return ivy.retrieve(new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()),
@@ -424,7 +388,8 @@ public class Ivy14 {
     }
 
     public int retrieve(ModuleId moduleId, String[] confs, File cache, String destFilePattern,
-            String destIvyPattern, Filter artifactFilter, boolean sync, boolean useOrigin) {
+            String destIvyPattern, Filter<Artifact> artifactFilter, boolean sync,
+            boolean useOrigin) {
         try {
             return ivy.retrieve(new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()),
                 destFilePattern,
@@ -436,12 +401,11 @@ public class Ivy14 {
     }
 
     public int retrieve(ModuleId moduleId, String[] confs, File cache, String destFilePattern,
-            String destIvyPattern, Filter artifactFilter) {
+            String destIvyPattern, Filter<Artifact> artifactFilter) {
         try {
             return ivy.retrieve(new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()),
-                destFilePattern,
-                new RetrieveOptions().setConfs(confs).setDestIvyPattern(destIvyPattern)
-                        .setArtifactFilter(artifactFilter));
+                destFilePattern, new RetrieveOptions().setConfs(confs)
+                        .setDestIvyPattern(destIvyPattern).setArtifactFilter(artifactFilter));
         } catch (IOException e) {
             throw new RuntimeException(e);
         }
@@ -471,16 +435,15 @@ public class Ivy14 {
         ivy.setVariable(varName, value);
     }
 
-    public List sortModuleDescriptors(Collection moduleDescriptors) {
-        return ivy
-                .sortModuleDescriptors(moduleDescriptors, new SortOptions()
-                        .setNonMatchingVersionReporter(new SilentNonMatchingVersionReporter()));
+    public List<ModuleDescriptor> sortModuleDescriptors(
+            Collection<ModuleDescriptor> moduleDescriptors) {
+        return ivy.sortModuleDescriptors(moduleDescriptors, new SortOptions()
+                .setNonMatchingVersionReporter(new SilentNonMatchingVersionReporter()));
     }
 
-    public List sortNodes(Collection nodes) {
-        return ivy
-                .sortNodes(nodes, new SortOptions()
-                        .setNonMatchingVersionReporter(new SilentNonMatchingVersionReporter()));
+    public List<IvyNode> sortNodes(Collection<IvyNode> nodes) {
+        return ivy.sortNodes(nodes, new SortOptions()
+                .setNonMatchingVersionReporter(new SilentNonMatchingVersionReporter()));
     }
 
     public String substitute(String str) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/Main.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/Main.java b/src/java/org/apache/ivy/Main.java
index c256319..99690c1 100644
--- a/src/java/org/apache/ivy/Main.java
+++ b/src/java/org/apache/ivy/Main.java
@@ -30,7 +30,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.StringTokenizer;
@@ -278,8 +277,8 @@ public final class Main {
                         "working"));
             DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md,
                     ModuleRevisionId.newInstance(dep[0], dep[1], dep[2]), false, false, true);
-            for (int i = 0; i < confs.length; i++) {
-                dd.addDependencyConfiguration("default", confs[i]);
+            for (String conf : confs) {
+                dd.addDependencyConfiguration("default", conf);
             }
             md.addDependency(dd);
             XmlModuleDescriptorWriter.write(md, ivyfile);
@@ -319,8 +318,8 @@ public final class Main {
         }
         if (line.hasOption("retrieve")) {
             String retrievePattern = settings.substitute(line.getOptionValue("retrieve"));
-            if (retrievePattern.indexOf("[") == -1) {
-                retrievePattern = retrievePattern + "/lib/[conf]/[artifact].[ext]";
+            if (!retrievePattern.contains("[")) {
+                retrievePattern += "/lib/[conf]/[artifact].[ext]";
             }
             String ivyPattern = settings.substitute(line.getOptionValue("ivypattern"));
             ivy.retrieve(
@@ -366,7 +365,7 @@ public final class Main {
         }
         if (line.hasOption("main")) {
             // check if the option cp has been set
-            List fileList = getExtraClasspathFileList(line);
+            List<File> fileList = getExtraClasspathFileList(line);
 
             // merge -args and left over args
             String[] fargs = line.getOptionValues("args");
@@ -399,13 +398,12 @@ public final class Main {
      * @return a List of files to include as extra classpath entries, or <code>null</code> if no cp
      *         option was provided.
      */
-    private static List/* <File> */getExtraClasspathFileList(CommandLine line) {
-        List fileList = null;
+    private static List<File> getExtraClasspathFileList(CommandLine line) {
+        List<File> fileList = null;
         if (line.hasOption("cp")) {
-            fileList = new ArrayList/* <File> */();
-            String[] cpArray = line.getOptionValues("cp");
-            for (int index = 0; index < cpArray.length; index++) {
-                StringTokenizer tokenizer = new StringTokenizer(cpArray[index],
+            fileList = new ArrayList<>();
+            for (String cp : line.getOptionValues("cp")) {
+                StringTokenizer tokenizer = new StringTokenizer(cp,
                         System.getProperty("path.separator"));
                 while (tokenizer.hasMoreTokens()) {
                     String token = tokenizer.nextToken();
@@ -472,19 +470,18 @@ public final class Main {
             String outFile) {
         try {
             String pathSeparator = System.getProperty("path.separator");
-            StringBuffer buf = new StringBuffer();
-            Collection all = new LinkedHashSet();
+            StringBuilder buf = new StringBuilder();
+            Collection<ArtifactDownloadReport> all = new LinkedHashSet<>();
             ResolutionCacheManager cacheMgr = ivy.getResolutionCacheManager();
             XmlReportParser parser = new XmlReportParser();
-            for (int i = 0; i < confs.length; i++) {
+            for (String conf : confs) {
                 String resolveId = ResolveOptions.getDefaultResolveId(md);
-                File report = cacheMgr.getConfigurationResolveReportInCache(resolveId, confs[i]);
+                File report = cacheMgr.getConfigurationResolveReportInCache(resolveId, conf);
                 parser.parse(report);
 
                 all.addAll(Arrays.asList(parser.getArtifactReports()));
             }
-            for (Iterator iter = all.iterator(); iter.hasNext();) {
-                ArtifactDownloadReport artifact = (ArtifactDownloadReport) iter.next();
+            for (ArtifactDownloadReport artifact : all) {
                 if (artifact.getLocalFile() != null) {
                     buf.append(artifact.getLocalFile().getCanonicalPath());
                     buf.append(pathSeparator);
@@ -505,13 +502,12 @@ public final class Main {
 
     @SuppressWarnings("resource")
     private static void invoke(Ivy ivy, File cache, ModuleDescriptor md, String[] confs,
-            List fileList, String mainclass, String[] args) {
-        List urls = new ArrayList();
+            List<File> fileList, String mainclass, String[] args) {
+        List<URL> urls = new ArrayList<>();
 
         // Add option cp (extra classpath) urls
         if (fileList != null && fileList.size() > 0) {
-            for (Iterator iter = fileList.iterator(); iter.hasNext();) {
-                File file = (File) iter.next();
+            for (File file : fileList) {
                 try {
                     urls.add(file.toURI().toURL());
                 } catch (MalformedURLException e) {
@@ -521,19 +517,17 @@ public final class Main {
         }
 
         try {
-            Collection all = new LinkedHashSet();
+            Collection<ArtifactDownloadReport> all = new LinkedHashSet<>();
             ResolutionCacheManager cacheMgr = ivy.getResolutionCacheManager();
             XmlReportParser parser = new XmlReportParser();
-            for (int i = 0; i < confs.length; i++) {
+            for (String conf : confs) {
                 String resolveId = ResolveOptions.getDefaultResolveId(md);
-                File report = cacheMgr.getConfigurationResolveReportInCache(resolveId, confs[i]);
+                File report = cacheMgr.getConfigurationResolveReportInCache(resolveId, conf);
                 parser.parse(report);
 
                 all.addAll(Arrays.asList(parser.getArtifactReports()));
             }
-            for (Iterator iter = all.iterator(); iter.hasNext();) {
-                ArtifactDownloadReport artifact = (ArtifactDownloadReport) iter.next();
-
+            for (ArtifactDownloadReport artifact : all) {
                 if (artifact.getLocalFile() != null) {
                     urls.add(artifact.getLocalFile().toURI().toURL());
                 }
@@ -542,21 +536,19 @@ public final class Main {
             throw new RuntimeException("impossible to build ivy cache path: " + ex.getMessage(), ex);
         }
 
-        URLClassLoader classLoader = new URLClassLoader((URL[]) urls.toArray(new URL[urls.size()]),
+        URLClassLoader classLoader = new URLClassLoader(urls.toArray(new URL[urls.size()]),
                 Main.class.getClassLoader());
 
         try {
-            Class c = classLoader.loadClass(mainclass);
+            Class<?> c = classLoader.loadClass(mainclass);
 
-            Method mainMethod = c.getMethod("main", new Class[] {String[].class});
+            Method mainMethod = c.getMethod("main", String[].class);
 
             Thread.currentThread().setContextClassLoader(classLoader);
             mainMethod.invoke(null, new Object[] {(args == null ? new String[0] : args)});
         } catch (ClassNotFoundException cnfe) {
             throw new RuntimeException("Could not find class: " + mainclass, cnfe);
-        } catch (SecurityException e) {
-            throw new RuntimeException("Could not find main method: " + mainclass, e);
-        } catch (NoSuchMethodException e) {
+        } catch (SecurityException | NoSuchMethodException e) {
             throw new RuntimeException("Could not find main method: " + mainclass, e);
         } catch (IllegalAccessException e) {
             throw new RuntimeException("No permissions to invoke main method: " + mainclass, e);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/ant/BuildOBRTask.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/BuildOBRTask.java b/src/java/org/apache/ivy/ant/BuildOBRTask.java
index 226167a..35945ac 100644
--- a/src/java/org/apache/ivy/ant/BuildOBRTask.java
+++ b/src/java/org/apache/ivy/ant/BuildOBRTask.java
@@ -158,12 +158,9 @@ public class BuildOBRTask extends IvyCacheTask {
             prepareAndCheck();
             try {
                 it = new ArtifactReportManifestIterable(getArtifactReports(), sourceTypes);
-            } catch (ParseException e) {
+            } catch (ParseException | IOException e) {
                 throw new BuildException("Impossible to parse the artifact reports: "
                         + e.getMessage(), e);
-            } catch (IOException e) {
-                throw new BuildException("Impossible to read the artifact reports: "
-                        + e.getMessage(), e);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/ant/IvyBuildList.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyBuildList.java b/src/java/org/apache/ivy/ant/IvyBuildList.java
index 84cc0c6..9ff9b75 100644
--- a/src/java/org/apache/ivy/ant/IvyBuildList.java
+++ b/src/java/org/apache/ivy/ant/IvyBuildList.java
@@ -25,7 +25,6 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashSet;
 import java.util.List;
-import java.util.ListIterator;
 import java.util.Map;
 import java.util.Set;
 import java.util.StringTokenizer;
@@ -273,14 +272,12 @@ public class IvyBuildList extends IvyTask {
             sortedModules = keptModules;
         }
         StringBuilder order = new StringBuilder();
-        for (ListIterator<ModuleDescriptor> iter = sortedModules.listIterator(); iter.hasNext();) {
-            ModuleDescriptor md = iter.next();
-            order.append(md.getModuleRevisionId().getModuleId());
-            if (iter.hasNext()) {
+        for (ModuleDescriptor md : sortedModules) {
+            if (order.length() > 0) {
                 order.append(", ");
             }
-            File buildFile = buildFiles.get(md);
-            addBuildFile(path, buildFile);
+            order.append(md.getModuleRevisionId().getModuleId());
+            addBuildFile(path, buildFiles.get(md));
         }
         if (OnMissingDescriptor.TAIL.equals(onMissingDescriptor)) {
             for (File buildFile : noDescriptor) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/ant/IvyBuildNumber.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyBuildNumber.java b/src/java/org/apache/ivy/ant/IvyBuildNumber.java
index 8634472..3216532 100644
--- a/src/java/org/apache/ivy/ant/IvyBuildNumber.java
+++ b/src/java/org/apache/ivy/ant/IvyBuildNumber.java
@@ -153,10 +153,10 @@ public class IvyBuildNumber extends IvyTask {
         if (revision == null || revision.length() == 0) {
             revision = "latest.integration";
         } else if (!revision.endsWith("+")) {
-            revision = revision + "+";
+            revision += "+";
         }
         if (!prefix.endsWith(".") && prefix.length() > 0) {
-            prefix = prefix + ".";
+            prefix += ".";
         }
 
         SearchEngine searcher = new SearchEngine(settings);
@@ -205,13 +205,14 @@ public class IvyBuildNumber extends IvyTask {
 
         VersionMatcher matcher = settings.getVersionMatcher();
         LatestStrategy latestStrategy = settings.getLatestStrategy("latest-revision");
-        List sorted = latestStrategy.sort(infos);
+        List<ArtifactInfo> sorted = latestStrategy.sort(infos);
 
         ModuleRevisionId askedMrid = ModuleRevisionId.newInstance(organisation, module, branch,
             revision);
 
         String foundRevision = null;
-        for (ListIterator iter = sorted.listIterator(sorted.size()); iter.hasPrevious();) {
+        ListIterator<ArtifactInfo> iter = sorted.listIterator(sorted.size());
+        while (iter.hasPrevious()) {
             ResolvedModuleRevisionArtifactInfo info = (ResolvedModuleRevisionArtifactInfo) iter
                     .previous();
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/ant/IvyCacheFileset.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyCacheFileset.java b/src/java/org/apache/ivy/ant/IvyCacheFileset.java
index 56bcc6d..0c92804 100644
--- a/src/java/org/apache/ivy/ant/IvyCacheFileset.java
+++ b/src/java/org/apache/ivy/ant/IvyCacheFileset.java
@@ -167,11 +167,11 @@ public class IvyCacheFileset extends IvyCacheTask {
         if (file1 == null || file2 == null) {
             return null;
         }
-        final Iterator file1Parents = getParents(file1).iterator();
-        final Iterator file2Parents = getParents(file2.getAbsoluteFile()).iterator();
+        final Iterator<File> file1Parents = getParents(file1).iterator();
+        final Iterator<File> file2Parents = getParents(file2.getAbsoluteFile()).iterator();
         File result = null;
         while (file1Parents.hasNext() && file2Parents.hasNext()) {
-            File next = (File) file1Parents.next();
+            File next = file1Parents.next();
             if (next.equals(file2Parents.next())) {
                 result = next;
             } else {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/ant/IvyCacheTask.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyCacheTask.java b/src/java/org/apache/ivy/ant/IvyCacheTask.java
index 72c14a7..d053257 100644
--- a/src/java/org/apache/ivy/ant/IvyCacheTask.java
+++ b/src/java/org/apache/ivy/ant/IvyCacheTask.java
@@ -56,8 +56,7 @@ public abstract class IvyCacheTask extends IvyPostResolveTask {
         return ret;
     }
 
-    private Collection<ArtifactDownloadReport> getAllArtifactReports() throws ParseException,
-            IOException {
+    private Collection<ArtifactDownloadReport> getAllArtifactReports() throws ParseException {
         String[] confs = splitConfs(getConf());
         Collection<ArtifactDownloadReport> all = new LinkedHashSet<>();
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/ant/IvyConfigure.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyConfigure.java b/src/java/org/apache/ivy/ant/IvyConfigure.java
index f41cb5c..94747fa 100644
--- a/src/java/org/apache/ivy/ant/IvyConfigure.java
+++ b/src/java/org/apache/ivy/ant/IvyConfigure.java
@@ -48,8 +48,8 @@ public class IvyConfigure extends Task {
      */
     public static final String OVERRIDE_NOT_ALLOWED = "notallowed";
 
-    private static final Collection OVERRIDE_VALUES = Arrays.asList(OVERRIDE_TRUE,
-            OVERRIDE_FALSE, OVERRIDE_NOT_ALLOWED);
+    private static final Collection<String> OVERRIDE_VALUES = Arrays.asList(OVERRIDE_TRUE,
+        OVERRIDE_FALSE, OVERRIDE_NOT_ALLOWED);
 
     private String override = OVERRIDE_NOT_ALLOWED;
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/ant/IvyDependencyTree.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyDependencyTree.java b/src/java/org/apache/ivy/ant/IvyDependencyTree.java
index 7c30f25..1817063 100644
--- a/src/java/org/apache/ivy/ant/IvyDependencyTree.java
+++ b/src/java/org/apache/ivy/ant/IvyDependencyTree.java
@@ -117,8 +117,7 @@ public class IvyDependencyTree extends IvyPostResolveTask {
 
     private void populateDependencyTree(IvyNode dependency) {
         registerNodeIfNecessary(dependency.getId());
-        for (int i = 0; i < dependency.getAllCallers().length; i++) {
-            Caller caller = dependency.getAllCallers()[i];
+        for (Caller caller : dependency.getAllCallers()) {
             addDependency(caller.getModuleRevisionId(), dependency);
         }
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/ant/IvyDependencyUpdateChecker.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyDependencyUpdateChecker.java b/src/java/org/apache/ivy/ant/IvyDependencyUpdateChecker.java
index 1eb628d..e6499d5 100644
--- a/src/java/org/apache/ivy/ant/IvyDependencyUpdateChecker.java
+++ b/src/java/org/apache/ivy/ant/IvyDependencyUpdateChecker.java
@@ -51,13 +51,11 @@ public class IvyDependencyUpdateChecker extends IvyPostResolveTask {
                 originalModuleDescriptor.getModuleRevisionId(),
                 originalModuleDescriptor.getStatus(), originalModuleDescriptor.getPublicationDate());
         // copy configurations
-        for (int i = 0; i < originalModuleDescriptor.getConfigurations().length; i++) {
-            Configuration configuration = originalModuleDescriptor.getConfigurations()[i];
+        for (Configuration configuration : originalModuleDescriptor.getConfigurations()) {
             latestModuleDescriptor.addConfiguration(configuration);
         }
         // clone dependency and add new one with the requested revisionToCheck
-        for (int i = 0; i < originalModuleDescriptor.getDependencies().length; i++) {
-            DependencyDescriptor dependencyDescriptor = originalModuleDescriptor.getDependencies()[i];
+        for (DependencyDescriptor dependencyDescriptor : originalModuleDescriptor.getDependencies()) {
             ModuleRevisionId upToDateMrid = ModuleRevisionId.newInstance(
                 dependencyDescriptor.getDependencyRevisionId(), revisionToCheck);
             latestModuleDescriptor.addDependency(dependencyDescriptor.clone(upToDateMrid));

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/ant/IvyPostResolveTask.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyPostResolveTask.java b/src/java/org/apache/ivy/ant/IvyPostResolveTask.java
index bcca68c..36d2d2d 100644
--- a/src/java/org/apache/ivy/ant/IvyPostResolveTask.java
+++ b/src/java/org/apache/ivy/ant/IvyPostResolveTask.java
@@ -20,9 +20,11 @@ package org.apache.ivy.ant;
 import java.io.File;
 import java.util.Arrays;
 import java.util.HashSet;
+import java.util.Set;
 
 import org.apache.ivy.Ivy;
 import org.apache.ivy.core.cache.ResolutionCacheManager;
+import org.apache.ivy.core.module.descriptor.Artifact;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
 import org.apache.ivy.core.module.id.ModuleId;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
@@ -61,7 +63,7 @@ public abstract class IvyPostResolveTask extends IvyTask {
 
     private File file;
 
-    private Filter artifactFilter = null;
+    private Filter<Artifact> artifactFilter = null;
 
     private boolean useOrigin = false;
 
@@ -265,7 +267,7 @@ public abstract class IvyPostResolveTask extends IvyTask {
                 confs = splitConfs(conf);
             }
 
-            HashSet<String> rconfsSet = new HashSet<>();
+            Set<String> rconfsSet = new HashSet<>();
 
             // for each resolved configuration, check if the report still exists
             ResolutionCacheManager cache = getSettings().getResolutionCacheManager();
@@ -281,7 +283,7 @@ public abstract class IvyPostResolveTask extends IvyTask {
                 }
             }
 
-            HashSet<String> confsSet = new HashSet<>(Arrays.asList(confs));
+            Set<String> confsSet = new HashSet<>(Arrays.asList(confs));
             Message.debug("resolved configurations:   " + rconfsSet);
             Message.debug("asked configurations:      " + confsSet);
             confsSet.removeAll(rconfsSet);
@@ -384,7 +386,7 @@ public abstract class IvyPostResolveTask extends IvyTask {
         revision = rev;
     }
 
-    public Filter getArtifactFilter() {
+    public Filter<Artifact> getArtifactFilter() {
         return artifactFilter;
     }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/ant/IvyRepositoryReport.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyRepositoryReport.java b/src/java/org/apache/ivy/ant/IvyRepositoryReport.java
index da27edd..6ce7445 100644
--- a/src/java/org/apache/ivy/ant/IvyRepositoryReport.java
+++ b/src/java/org/apache/ivy/ant/IvyRepositoryReport.java
@@ -129,8 +129,7 @@ public class IvyRepositoryReport extends IvyTask {
         }
     }
 
-    private void genreport(ResolutionCacheManager cache, String organisation, String module)
-            throws IOException {
+    private void genreport(ResolutionCacheManager cache, String organisation, String module) {
         // first process the report with xslt
         XSLTProcess xslt = new XSLTProcess();
         xslt.setTaskName(getTaskName());
@@ -187,7 +186,7 @@ public class IvyRepositoryReport extends IvyTask {
     }
 
     private void gen(ResolutionCacheManager cache, String organisation, String module,
-            String style, String ext) throws IOException {
+            String style, String ext) {
         XSLTProcess xslt = new XSLTProcess();
         xslt.setTaskName(getTaskName());
         xslt.setProject(getProject());

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/ant/IvyRetrieve.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyRetrieve.java b/src/java/org/apache/ivy/ant/IvyRetrieve.java
index 0fc0f7f..f90403a 100644
--- a/src/java/org/apache/ivy/ant/IvyRetrieve.java
+++ b/src/java/org/apache/ivy/ant/IvyRetrieve.java
@@ -22,6 +22,7 @@ import java.util.Arrays;
 import java.util.Collection;
 
 import org.apache.ivy.core.LogOptions;
+import org.apache.ivy.core.module.descriptor.Artifact;
 import org.apache.ivy.core.retrieve.RetrieveOptions;
 import org.apache.ivy.core.retrieve.RetrieveReport;
 import org.apache.ivy.util.filter.Filter;
@@ -94,7 +95,7 @@ public class IvyRetrieve extends IvyPostResolveTask {
 
         pattern = getProperty(pattern, getSettings(), "ivy.retrieve.pattern");
         try {
-            Filter artifactFilter = getArtifactFilter();
+            Filter<Artifact> artifactFilter = getArtifactFilter();
             RetrieveReport report = getIvyInstance().retrieve(
                 getResolvedMrid(),
                 ((RetrieveOptions) new RetrieveOptions().setLog(getLog()))

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/IvyContext.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/IvyContext.java b/src/java/org/apache/ivy/core/IvyContext.java
index ab73511..b26d69e 100644
--- a/src/java/org/apache/ivy/core/IvyContext.java
+++ b/src/java/org/apache/ivy/core/IvyContext.java
@@ -41,13 +41,13 @@ import org.apache.ivy.util.MessageLogger;
  */
 public class IvyContext {
 
-    private static ThreadLocal/* <Stack<IvyContext>> */current = new ThreadLocal();
+    private static ThreadLocal<Stack<IvyContext>> current = new ThreadLocal<>();
 
     private Ivy defaultIvy;
 
-    private WeakReference/* <Ivy> */ivy = new WeakReference(null);
+    private WeakReference<Ivy> ivy = new WeakReference<>(null);
 
-    private Map contextMap = new HashMap();
+    private Map<String, Object> contextMap = new HashMap<>();
 
     private Thread operatingThread;
 
@@ -61,24 +61,24 @@ public class IvyContext {
     public IvyContext(IvyContext ctx) {
         defaultIvy = ctx.defaultIvy;
         ivy = ctx.ivy;
-        contextMap = new HashMap(ctx.contextMap);
+        contextMap = new HashMap<>(ctx.contextMap);
         operatingThread = ctx.operatingThread;
         resolveData = ctx.resolveData;
         dd = ctx.dd;
     }
 
     public static IvyContext getContext() {
-        Stack cur = getCurrentStack();
+        Stack<IvyContext> cur = getCurrentStack();
         if (cur.isEmpty()) {
             cur.push(new IvyContext());
         }
-        return (IvyContext) cur.peek();
+        return cur.peek();
     }
 
-    private static Stack/* <IvyContext> */getCurrentStack() {
-        Stack cur = (Stack) current.get();
+    private static Stack<IvyContext> getCurrentStack() {
+        Stack<IvyContext> cur = current.get();
         if (cur == null) {
-            cur = new Stack();
+            cur = new Stack<>();
             current.set(cur);
         }
         return cur;
@@ -133,7 +133,7 @@ public class IvyContext {
      * @return the popped context
      */
     public static IvyContext popContext() {
-        return (IvyContext) getCurrentStack().pop();
+        return getCurrentStack().pop();
     }
 
     /**
@@ -153,9 +153,9 @@ public class IvyContext {
      */
     public static Object peekInContextStack(String key) {
         Object value = null;
-        Stack contextStack = getCurrentStack();
+        Stack<IvyContext> contextStack = getCurrentStack();
         for (int i = contextStack.size() - 1; i >= 0 && value == null; i--) {
-            IvyContext ctx = (IvyContext) contextStack.get(i);
+            IvyContext ctx = contextStack.get(i);
             value = ctx.peek(key);
         }
         return value;
@@ -191,8 +191,7 @@ public class IvyContext {
      * @return the current ivy instance, or <code>null</code> if there is no current ivy instance.
      */
     public Ivy peekIvy() {
-        Ivy ivy = (Ivy) this.ivy.get();
-        return ivy;
+        return this.ivy.get();
     }
 
     private Ivy getDefaultIvy() {
@@ -209,7 +208,7 @@ public class IvyContext {
     }
 
     public void setIvy(Ivy ivy) {
-        this.ivy = new WeakReference(ivy);
+        this.ivy = new WeakReference<>(ivy);
         operatingThread = Thread.currentThread();
     }
 
@@ -221,13 +220,14 @@ public class IvyContext {
         return getSettings().getCircularDependencyStrategy();
     }
 
-    public Object get(String key) {
-        WeakReference ref = (WeakReference) contextMap.get(key);
-        return ref == null ? null : ref.get();
+    @SuppressWarnings("unchecked")
+    public <T> T get(String key) {
+        WeakReference<T> ref = (WeakReference<T>) contextMap.get(key);
+        return (ref == null) ? null : ref.get();
     }
 
-    public void set(String key, Object value) {
-        contextMap.put(key, new WeakReference(value));
+    public <T> void set(String key, T value) {
+        contextMap.put(key, new WeakReference<>(value));
     }
 
     /**
@@ -238,6 +238,7 @@ public class IvyContext {
      *            context key for the string
      * @return top object from the list (index 0) or null if no key or list empty
      */
+    @SuppressWarnings("unchecked")
     public Object peek(String key) {
         synchronized (contextMap) {
             Object o = contextMap.get(key);
@@ -245,11 +246,10 @@ public class IvyContext {
                 return null;
             }
             if (o instanceof List) {
-                if (((List) o).size() == 0) {
+                if (((List<Object>) o).size() == 0) {
                     return null;
                 }
-                Object ret = ((List) o).get(0);
-                return ret;
+                return ((List<Object>) o).get(0);
             } else {
                 throw new RuntimeException("Cannot top from non List object " + o);
             }
@@ -264,6 +264,7 @@ public class IvyContext {
      *            context key for the string
      * @return top object from the list (index 0) or null if no key or list empty
      */
+    @SuppressWarnings("unchecked")
     public Object pop(String key) {
         synchronized (contextMap) {
             Object o = contextMap.get(key);
@@ -271,11 +272,10 @@ public class IvyContext {
                 return null;
             }
             if (o instanceof List) {
-                if (((List) o).size() == 0) {
+                if (((List<Object>) o).size() == 0) {
                     return null;
                 }
-                Object ret = ((List) o).remove(0);
-                return ret;
+                return ((List<Object>) o).remove(0);
             } else {
                 throw new RuntimeException("Cannot pop from non List object " + o);
             }
@@ -293,6 +293,7 @@ public class IvyContext {
      *            expected value of the key
      * @return true if the r
      */
+    @SuppressWarnings("unchecked")
     public boolean pop(String key, Object expectedValue) {
         synchronized (contextMap) {
             Object o = contextMap.get(key);
@@ -300,14 +301,14 @@ public class IvyContext {
                 return false;
             }
             if (o instanceof List) {
-                if (((List) o).size() == 0) {
+                if (((List<Object>) o).size() == 0) {
                     return false;
                 }
-                Object top = ((List) o).get(0);
+                Object top = ((List<Object>) o).get(0);
                 if (!top.equals(expectedValue)) {
                     return false;
                 }
-                ((List) o).remove(0);
+                ((List<Object>) o).remove(0);
                 return true;
             } else {
                 throw new RuntimeException("Cannot pop from non List object " + o);
@@ -330,11 +331,11 @@ public class IvyContext {
     public void push(String key, Object value) {
         synchronized (contextMap) {
             if (!contextMap.containsKey(key)) {
-                contextMap.put(key, new LinkedList());
+                contextMap.put(key, new LinkedList<>());
             }
             Object o = contextMap.get(key);
             if (o instanceof List) {
-                ((List) o).add(0, value);
+                ((List<Object>) o).add(0, value);
             } else {
                 throw new RuntimeException("Cannot push to non List object " + o);
             }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/IvyPatternHelper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/IvyPatternHelper.java b/src/java/org/apache/ivy/core/IvyPatternHelper.java
index e8fb47e..70bebcd 100644
--- a/src/java/org/apache/ivy/core/IvyPatternHelper.java
+++ b/src/java/org/apache/ivy/core/IvyPatternHelper.java
@@ -19,7 +19,6 @@ package org.apache.ivy.core;
 
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Stack;
@@ -118,20 +117,19 @@ public final class IvyPatternHelper {
     }
 
     public static String substitute(String pattern, String org, String module, String revision,
-            String artifact, String type, String ext, String conf, Map extraModuleAttributes,
-            Map extraArtifactAttributes) {
+            String artifact, String type, String ext, String conf, Map<String, String> extraModuleAttributes,
+            Map<String, String> extraArtifactAttributes) {
         return substitute(pattern, org, module, null, revision, artifact, type, ext, conf,
                 null, extraModuleAttributes, extraArtifactAttributes);
     }
 
     public static String substitute(String pattern, String org, String module, String branch,
             String revision, String artifact, String type, String ext, String conf,
-            ArtifactOrigin origin, Map extraModuleAttributes, Map extraArtifactAttributes) {
-        Map tokens = new HashMap();
+            ArtifactOrigin origin, Map<String, String> extraModuleAttributes, Map<String, String> extraArtifactAttributes) {
+        Map<String, Object> tokens = new HashMap<>();
         if (extraModuleAttributes != null) {
-            for (Iterator entries = extraModuleAttributes.entrySet().iterator(); entries.hasNext();) {
-                Map.Entry entry = (Map.Entry) entries.next();
-                String token = (String) entry.getKey();
+            for (Map.Entry<String, String> entry : extraModuleAttributes.entrySet()) {
+                String token = entry.getKey();
                 if (token.indexOf(':') > 0) {
                     token = token.substring(token.indexOf(':') + 1);
                 }
@@ -139,10 +137,8 @@ public final class IvyPatternHelper {
             }
         }
         if (extraArtifactAttributes != null) {
-            for (Iterator entries = extraArtifactAttributes.entrySet().iterator(); entries
-                    .hasNext();) {
-                Map.Entry entry = (Map.Entry) entries.next();
-                String token = (String) entry.getKey();
+            for (Map.Entry<String, String> entry : extraArtifactAttributes.entrySet()) {
+                String token = entry.getKey();
                 if (token.indexOf(':') > 0) {
                     token = token.substring(token.indexOf(':') + 1);
                 }
@@ -172,16 +168,16 @@ public final class IvyPatternHelper {
 
     // CheckStyle:ParameterNumber ON
 
-    public static String substituteVariables(String pattern, Map variables) {
-        return substituteVariables(pattern, new IvyVariableContainerImpl(variables), new Stack());
+    public static String substituteVariables(String pattern, Map<String, String> variables) {
+        return substituteVariables(pattern, new IvyVariableContainerImpl(variables), new Stack<String>());
     }
 
     public static String substituteVariables(String pattern, IvyVariableContainer variables) {
-        return substituteVariables(pattern, variables, new Stack());
+        return substituteVariables(pattern, variables, new Stack<String>());
     }
 
     private static String substituteVariables(String pattern, IvyVariableContainer variables,
-            Stack substituting) {
+            Stack<String> substituting) {
         // if you supply null, null is what you get
         if (pattern == null) {
             return null;
@@ -201,7 +197,7 @@ public final class IvyPatternHelper {
             if (val != null) {
                 int index = substituting.indexOf(var);
                 if (index != -1) {
-                    List cycle = new ArrayList(substituting.subList(index, substituting.size()));
+                    List<String> cycle = new ArrayList<>(substituting.subList(index, substituting.size()));
                     cycle.add(var);
                     throw new IllegalArgumentException("cyclic variable definition: cycle = "
                             + cycle);
@@ -222,8 +218,9 @@ public final class IvyPatternHelper {
         }
     }
 
+    @SuppressWarnings({"rawtypes", "unchecked"})
     public static String substituteTokens(String pattern, Map tokens) {
-        Map tokensCopy = new HashMap(tokens);
+        Map<String, Object> tokensCopy = new HashMap<>(tokens);
         if (tokensCopy.containsKey(ORGANISATION_KEY) && !tokensCopy.containsKey(ORGANISATION_KEY2)) {
             tokensCopy.put(ORGANISATION_KEY2, tokensCopy.get(ORGANISATION_KEY));
         }
@@ -233,7 +230,7 @@ public final class IvyPatternHelper {
             tokensCopy.put(ORGANISATION_PATH_KEY, org == null ? "" : org.replace('.', '/'));
         }
 
-        StringBuffer buffer = new StringBuffer();
+        StringBuilder buffer = new StringBuilder();
 
         char[] chars = pattern.toCharArray();
 
@@ -367,12 +364,12 @@ public final class IvyPatternHelper {
         return "[" + token + "]";
     }
 
-    public static String substituteParams(String pattern, Map params) {
-        return substituteParams(pattern, new IvyVariableContainerImpl(params), new Stack());
+    public static String substituteParams(String pattern, Map<String, String> params) {
+        return substituteParams(pattern, new IvyVariableContainerImpl(params), new Stack<String>());
     }
 
     private static String substituteParams(String pattern, IvyVariableContainer params,
-            Stack substituting) {
+            Stack<String> substituting) {
         // TODO : refactor this with substituteVariables
         // if you supply null, null is what you get
         if (pattern == null) {
@@ -388,7 +385,7 @@ public final class IvyPatternHelper {
             if (val != null) {
                 int index = substituting.indexOf(var);
                 if (index != -1) {
-                    List cycle = new ArrayList(substituting.subList(index, substituting.size()));
+                    List<String> cycle = new ArrayList<>(substituting.subList(index, substituting.size()));
                     cycle.add(var);
                     throw new IllegalArgumentException("cyclic param definition: cycle = " + cycle);
                 }
@@ -420,7 +417,7 @@ public final class IvyPatternHelper {
 
         private String revision;
 
-        private Map extraModuleAttributes;
+        private Map<String, String> extraModuleAttributes;
 
         // artifact properties
         private String artifactName;
@@ -429,14 +426,14 @@ public final class IvyPatternHelper {
 
         private String artifactExt;
 
-        private Map extraArtifactAttributes;
+        private Map<String, String> extraArtifactAttributes;
 
         // cached origin;
         private ArtifactOrigin origin;
 
         public OriginalArtifactNameValue(String org, String moduleName, String branch,
                 String revision, String artifactName, String artifactType, String artifactExt,
-                Map extraModuleAttributes, Map extraArtifactAttributes) {
+                Map<String, String> extraModuleAttributes, Map<String, String> extraArtifactAttributes) {
             this.org = org;
             this.moduleName = moduleName;
             this.branch = branch;

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/cache/ArtifactOrigin.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/cache/ArtifactOrigin.java b/src/java/org/apache/ivy/core/cache/ArtifactOrigin.java
index b3449a2..e65a683 100644
--- a/src/java/org/apache/ivy/core/cache/ArtifactOrigin.java
+++ b/src/java/org/apache/ivy/core/cache/ArtifactOrigin.java
@@ -150,7 +150,7 @@ public class ArtifactOrigin {
         if (this == o) {
             return true;
         }
-        if (o == null || getClass() != o.getClass()) {
+        if (!(o instanceof ArtifactOrigin)) {
             return false;
         }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java b/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
index 1a1fa0f..c0d2eb5 100644
--- a/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
+++ b/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
@@ -119,7 +119,7 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
 
     private Boolean useOrigin;
 
-    private ModuleRules<Long> ttlRules = new ModuleRules<Long>();
+    private ModuleRules<Long> ttlRules = new ModuleRules<>();
 
     private Long defaultTTL = null;
 
@@ -127,7 +127,7 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
 
     private PackagingManager packagingManager = new PackagingManager();
 
-    private final List<ConfiguredTTL> configuredTTLs = new ArrayList<ConfiguredTTL>();
+    private final List<ConfiguredTTL> configuredTTLs = new ArrayList<>();
 
     public DefaultRepositoryCacheManager() {
     }
@@ -202,17 +202,17 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
 
     public long getDefaultTTL() {
         if (defaultTTL == null) {
-            defaultTTL = Long.valueOf(parseDuration(settings.getVariable("ivy.cache.ttl.default")));
+            defaultTTL = parseDuration(settings.getVariable("ivy.cache.ttl.default"));
         }
-        return defaultTTL.longValue();
+        return defaultTTL;
     }
 
     public void setDefaultTTL(long defaultTTL) {
-        this.defaultTTL = Long.valueOf(defaultTTL);
+        this.defaultTTL = defaultTTL;
     }
 
     public void setDefaultTTL(String defaultTTL) {
-        this.defaultTTL = Long.valueOf(parseDuration(defaultTTL));
+        this.defaultTTL = parseDuration(defaultTTL);
     }
 
     public String getDataFilePattern() {
@@ -254,7 +254,7 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
     }
 
     public void addTTL(Map<String, String> attributes, PatternMatcher matcher, long duration) {
-        ttlRules.defineRule(new MapMatcher(attributes, matcher), new Long(duration));
+        ttlRules.defineRule(new MapMatcher(attributes, matcher), duration);
     }
 
     public void addConfiguredTtl(final Map<String, String> attributes) {
@@ -330,7 +330,7 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
             return getSettings() != null && Boolean
                     .parseBoolean(getSettings().getVariable("ivy.resolver.default.check.modified"));
         }
-        return checkmodified.booleanValue();
+        return checkmodified;
     }
 
     public void setCheckmodified(boolean check) {
@@ -937,7 +937,7 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
 
     public long getTTL(ModuleRevisionId mrid) {
         Long ttl = ttlRules.getRule(mrid);
-        return ttl == null ? getDefaultTTL() : ttl.longValue();
+        return ttl == null ? getDefaultTTL() : ttl;
     }
 
     @Override
@@ -1128,7 +1128,7 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
                 }
             } else {
                 long start = System.currentTimeMillis();
-                origin.setLastChecked(new Long(start));
+                origin.setLastChecked(start);
                 try {
                     ResolvedResource artifactRef = new ResolvedResource(resource,
                             Ivy.getWorkingRevision());
@@ -1216,7 +1216,7 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
             ArtifactOrigin savedOrigin, ArtifactOrigin origin, long ttl) {
         long time = System.currentTimeMillis();
         if (savedOrigin.getLastChecked() != null
-                && (time - savedOrigin.getLastChecked().longValue()) < ttl) {
+                && (time - savedOrigin.getLastChecked()) < ttl) {
             // still in the ttl period, no need to check, trust the cache
             return archiveFile.exists() || !savedOrigin.isExists();
         }
@@ -1224,7 +1224,7 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
             // the the file doesn't exist in the cache, obviously not up to date
             return false;
         }
-        origin.setLastChecked(Long.valueOf(time));
+        origin.setLastChecked(time);
         // check if the local resource is up to date regarding the remote one
         return archiveFile.lastModified() >= resource.getLastModified();
     }
@@ -1580,7 +1580,7 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
 
     private static final class ConfiguredTTL {
         // attributes on the TTL, that don't contribute to module matching
-        private static final Set<String> attributesNotContributingToMatching = new HashSet<String>();
+        private static final Set<String> attributesNotContributingToMatching = new HashSet<>();
         static {
             attributesNotContributingToMatching.add("duration");
             attributesNotContributingToMatching.add("matcher");
@@ -1596,7 +1596,7 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
             if (attributes == null) {
                 this.attributes = Collections.emptyMap();
             } else {
-                final Map<String, String> attrs = new HashMap<String, String>(attributes);
+                final Map<String, String> attrs = new HashMap<>(attributes);
                 for (final String removable : attributesNotContributingToMatching) {
                     attrs.remove(removable);
                 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/cache/DefaultResolutionCacheManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/cache/DefaultResolutionCacheManager.java b/src/java/org/apache/ivy/core/cache/DefaultResolutionCacheManager.java
index d1ccfc3..2d08c44 100644
--- a/src/java/org/apache/ivy/core/cache/DefaultResolutionCacheManager.java
+++ b/src/java/org/apache/ivy/core/cache/DefaultResolutionCacheManager.java
@@ -136,7 +136,7 @@ public class DefaultResolutionCacheManager implements ResolutionCacheManager, Iv
         final String suffix = ".xml";
         return getResolutionCacheRoot().listFiles(new FilenameFilter() {
             public boolean accept(File dir, String name) {
-                return (name.startsWith(prefix) && name.endsWith(suffix));
+                return name.startsWith(prefix) && name.endsWith(suffix);
             }
         });
     }
@@ -195,22 +195,21 @@ public class DefaultResolutionCacheManager implements ResolutionCacheManager, Iv
 
     private void saveLocalParents(ModuleRevisionId baseMrevId, ModuleDescriptor md, File mdFile,
             Properties paths) throws ParseException, IOException {
-        ExtendsDescriptor[] parents = md.getInheritedDescriptors();
-        for (int i = 0; i < parents.length; i++) {
-            if (!parents[i].isLocal()) {
+        for (ExtendsDescriptor parent : md.getInheritedDescriptors()) {
+            if (!parent.isLocal()) {
                 // we store only local parents in the cache!
                 continue;
             }
 
-            ModuleDescriptor parent = parents[i].getParentMd();
+            ModuleDescriptor parentMd = parent.getParentMd();
             ModuleRevisionId pRevId = ModuleRevisionId.newInstance(baseMrevId,
                 baseMrevId.getRevision() + "-parent." + paths.size());
             File parentFile = getResolvedIvyFileInCache(pRevId);
-            parent.toIvyFile(parentFile);
+            parentMd.toIvyFile(parentFile);
 
-            paths.setProperty(mdFile.getName() + "|" + parents[i].getLocation(),
+            paths.setProperty(mdFile.getName() + "|" + parent.getLocation(),
                 parentFile.getAbsolutePath());
-            saveLocalParents(baseMrevId, parent, parentFile, paths);
+            saveLocalParents(baseMrevId, parentMd, parentFile, paths);
         }
     }
 
@@ -226,9 +225,9 @@ public class DefaultResolutionCacheManager implements ResolutionCacheManager, Iv
 
         private ParserSettings delegate;
 
-        private Map parentPaths;
+        private Map<Object, Object> parentPaths;
 
-        public CacheParserSettings(ParserSettings delegate, Map parentPaths) {
+        public CacheParserSettings(ParserSettings delegate, Map<Object, Object> parentPaths) {
             this.delegate = delegate;
             this.parentPaths = parentPaths;
         }
@@ -237,7 +236,7 @@ public class DefaultResolutionCacheManager implements ResolutionCacheManager, Iv
             return delegate.substitute(value);
         }
 
-        public Map substitute(Map strings) {
+        public Map<String, String> substitute(Map<String, String> strings) {
             return delegate.substitute(strings);
         }
 
@@ -288,18 +287,18 @@ public class DefaultResolutionCacheManager implements ResolutionCacheManager, Iv
 
     private static final class MapURLResolver extends RelativeUrlResolver {
 
-        private Map paths;
+        private Map<Object, Object> paths;
 
         private RelativeUrlResolver delegate;
 
-        private MapURLResolver(Map paths, RelativeUrlResolver delegate) {
+        private MapURLResolver(Map<Object, Object> paths, RelativeUrlResolver delegate) {
             this.paths = paths;
             this.delegate = delegate;
         }
 
         public URL getURL(URL context, String url) throws MalformedURLException {
             String path = context.getPath();
-            if (path.indexOf('/') >= 0) {
+            if (path.contains("/")) {
                 String file = path.substring(path.lastIndexOf('/') + 1);
 
                 if (paths.containsKey(file + "|" + url)) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/cache/ModuleDescriptorMemoryCache.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/cache/ModuleDescriptorMemoryCache.java b/src/java/org/apache/ivy/core/cache/ModuleDescriptorMemoryCache.java
index cd2b0bd..357c130 100644
--- a/src/java/org/apache/ivy/core/cache/ModuleDescriptorMemoryCache.java
+++ b/src/java/org/apache/ivy/core/cache/ModuleDescriptorMemoryCache.java
@@ -37,7 +37,7 @@ class ModuleDescriptorMemoryCache {
 
     private final int maxSize;
 
-    private final LinkedHashMap/* <File,CacheEntry> */valueMap;
+    private final LinkedHashMap<File, CacheEntry> valueMap;
 
     /**
      * Create a cache of the given size
@@ -46,7 +46,7 @@ class ModuleDescriptorMemoryCache {
      */
     public ModuleDescriptorMemoryCache(int size) {
         this.maxSize = size;
-        this.valueMap = new LinkedHashMap(size);
+        this.valueMap = new LinkedHashMap<>(size);
     }
 
     public ModuleDescriptor get(File ivyFile, ParserSettings ivySettings, boolean validated,
@@ -76,7 +76,7 @@ class ModuleDescriptorMemoryCache {
             // cache is disabled
             return null;
         }
-        CacheEntry entry = (CacheEntry) valueMap.get(ivyFile);
+        CacheEntry entry = valueMap.get(ivyFile);
         if (entry != null) {
             if (entry.isStale(validated, ivySettings)) {
                 Message.debug("Entry is found in the ModuleDescriptorCache but entry should be "
@@ -104,7 +104,7 @@ class ModuleDescriptorMemoryCache {
         }
         if (valueMap.size() >= maxSize) {
             Message.debug("ModuleDescriptorCache is full, remove one entry");
-            Iterator it = valueMap.values().iterator();
+            Iterator<CacheEntry> it = valueMap.values().iterator();
             it.next();
             it.remove();
         }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/69207179/src/java/org/apache/ivy/core/cache/ParserSettingsMonitor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/cache/ParserSettingsMonitor.java b/src/java/org/apache/ivy/core/cache/ParserSettingsMonitor.java
index c0a971d..f383578 100644
--- a/src/java/org/apache/ivy/core/cache/ParserSettingsMonitor.java
+++ b/src/java/org/apache/ivy/core/cache/ParserSettingsMonitor.java
@@ -19,10 +19,8 @@ package org.apache.ivy.core.cache;
 
 import java.io.File;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
-import java.util.Map.Entry;
 
 import org.apache.ivy.core.RelativeUrlResolver;
 import org.apache.ivy.core.module.id.ModuleId;
@@ -50,11 +48,11 @@ class ParserSettingsMonitor {
 
     private ParserSettings delegatedSettings;
 
-    private final Map/* <String,String> */substitutes;
+    private final Map<String, String> substitutes;
 
     public ParserSettingsMonitor(ParserSettings settings) {
         this.delegatedSettings = settings;
-        this.substitutes = new HashMap();
+        this.substitutes = new HashMap<>();
     }
 
     /**
@@ -79,13 +77,10 @@ class ParserSettingsMonitor {
      * Only the info that was actually used is compared.
      */
     public boolean hasChanged(ParserSettings newSettings) {
-        for (Iterator it = substitutes.entrySet().iterator(); it.hasNext();) {
-            Map.Entry entry = (Entry) it.next();
-            String key = (String) entry.getKey();
-            Object oldValue = entry.getValue();
-            String newValue = newSettings.substitute(key);
-            if (!oldValue.equals(newValue)) {
-                Message.debug("settings variable has changed for : " + entry.getKey());
+        for (Map.Entry<String, String> entry : substitutes.entrySet()) {
+            String key = entry.getKey();
+            if (!entry.getValue().equals(newSettings.substitute(key))) {
+                Message.debug("settings variable has changed for : " + key);
                 return true;
             }
         }
@@ -134,11 +129,10 @@ class ParserSettingsMonitor {
             return delegatedSettings.getContextNamespace();
         }
 
-        public Map substitute(Map strings) {
-            Map substituted = new LinkedHashMap();
-            for (Iterator it = strings.entrySet().iterator(); it.hasNext();) {
-                Map.Entry entry = (Map.Entry) it.next();
-                substituted.put(entry.getKey(), substitute((String) entry.getValue()));
+        public Map<String, String> substitute(Map<String, String> strings) {
+            Map<String, String> substituted = new LinkedHashMap<>();
+            for (Map.Entry<String, String> entry : strings.entrySet()) {
+                substituted.put(entry.getKey(), substitute(entry.getValue()));
             }
             return substituted;
         }