ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jaiki...@apache.org
Subject [2/2] ant-ivy git commit: Generics + foreach loops and Java 7 syntax in ant and tools packages
Date Thu, 29 Jun 2017 06:29:25 GMT
Generics + foreach loops and Java 7 syntax in ant and tools packages

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

Branch: refs/heads/master
Commit: 9235380f05e88de1a881950cb21a3d254585d5df
Parents: 041e956
Author: twogee <g.grigelionis@gmail.com>
Authored: Thu Jun 15 20:40:48 2017 +0200
Committer: Jaikiran Pai <jaikiran@apache.org>
Committed: Thu Jun 29 11:58:45 2017 +0530

----------------------------------------------------------------------
 .../org/apache/ivy/ant/AntBuildTrigger.java     | 15 ++---
 src/java/org/apache/ivy/ant/AntCallTrigger.java | 13 ++---
 .../apache/ivy/ant/AntWorkspaceResolver.java    | 25 ++++----
 src/java/org/apache/ivy/ant/FixDepsTask.java    |  4 +-
 src/java/org/apache/ivy/ant/IvyAntSettings.java | 16 ++---
 .../apache/ivy/ant/IvyAntVariableContainer.java | 18 +++---
 .../org/apache/ivy/ant/IvyArtifactProperty.java | 13 ++---
 .../org/apache/ivy/ant/IvyArtifactReport.java   | 59 ++++++++-----------
 src/java/org/apache/ivy/ant/IvyBuildList.java   | 61 +++++++++-----------
 .../org/apache/ivy/ant/IvyCacheFileset.java     | 11 ++--
 src/java/org/apache/ivy/ant/IvyCachePath.java   | 15 ++---
 src/java/org/apache/ivy/ant/IvyCacheTask.java   | 14 ++---
 src/java/org/apache/ivy/ant/IvyCheck.java       |  9 ++-
 src/java/org/apache/ivy/ant/IvyCleanCache.java  |  4 +-
 src/java/org/apache/ivy/ant/IvyConfigure.java   |  4 +-
 src/java/org/apache/ivy/ant/IvyDependency.java  |  8 +--
 .../org/apache/ivy/ant/IvyDependencyConf.java   | 12 ++--
 .../org/apache/ivy/ant/IvyDependencyTree.java   | 13 ++---
 .../ivy/ant/IvyDependencyUpdateChecker.java     | 59 ++++++-------------
 .../apache/ivy/ant/IvyExtractFromSources.java   | 37 +++++-------
 src/java/org/apache/ivy/ant/IvyInfo.java        | 49 +++++++---------
 src/java/org/apache/ivy/ant/IvyListModules.java |  6 +-
 src/java/org/apache/ivy/ant/IvyMakePom.java     | 15 +++--
 .../org/apache/ivy/ant/IvyPostResolveTask.java  | 32 +++++-----
 src/java/org/apache/ivy/ant/IvyPublish.java     |  6 +-
 src/java/org/apache/ivy/ant/IvyReport.java      | 21 +++----
 .../org/apache/ivy/ant/IvyRepositoryReport.java | 48 +++++++--------
 src/java/org/apache/ivy/ant/IvyResolve.java     |  6 +-
 src/java/org/apache/ivy/ant/IvyResources.java   | 14 ++---
 src/java/org/apache/ivy/ant/IvyRetrieve.java    |  4 +-
 src/java/org/apache/ivy/ant/IvyTask.java        | 18 +++---
 src/java/org/apache/ivy/ant/IvyVar.java         |  8 +--
 .../org/apache/ivy/core/event/IvyEvent.java     |  6 +-
 .../core/settings/IvyVariableContainerImpl.java | 12 ++--
 .../analyser/JarJarDependencyAnalyser.java      | 15 ++---
 .../ivy/tools/analyser/JarModuleFinder.java     | 28 ++++-----
 .../ivy/tools/analyser/RepositoryAnalyser.java  | 10 ++--
 37 files changed, 299 insertions(+), 409 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/src/java/org/apache/ivy/ant/AntBuildTrigger.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/AntBuildTrigger.java b/src/java/org/apache/ivy/ant/AntBuildTrigger.java
index 1950333..735fe23 100644
--- a/src/java/org/apache/ivy/ant/AntBuildTrigger.java
+++ b/src/java/org/apache/ivy/ant/AntBuildTrigger.java
@@ -20,7 +20,6 @@ package org.apache.ivy.ant;
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.ivy.core.IvyContext;
@@ -62,7 +61,7 @@ public class AntBuildTrigger extends AbstractTrigger implements Trigger {
 
     private String target = null;
 
-    private Collection builds = new ArrayList();
+    private Collection<String> builds = new ArrayList<>();
 
     private String buildFilePattern;
 
@@ -91,14 +90,12 @@ public class AntBuildTrigger extends AbstractTrigger implements Trigger {
                 if (target != null) {
                     ant.setTarget(target);
                 }
-                Map atts = event.getAttributes();
-                for (Iterator iter = atts.keySet().iterator(); iter.hasNext();) {
-                    String key = (String) iter.next();
-                    String value = (String) atts.get(key);
-                    if (value != null) {
+                Map<String, String> atts = event.getAttributes();
+                for (Map.Entry<String, String> entry : atts.entrySet()) {
+                    if (entry.getValue() != null) {
                         Property p = ant.createProperty();
-                        p.setName(prefix == null ? key : prefix + key);
-                        p.setValue(value);
+                        p.setName(prefix == null ? entry.getKey() : prefix + entry.getKey());
+                        p.setValue(entry.getValue());
                     }
                 }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/src/java/org/apache/ivy/ant/AntCallTrigger.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/AntCallTrigger.java b/src/java/org/apache/ivy/ant/AntCallTrigger.java
index 0770dbd..9544e39 100644
--- a/src/java/org/apache/ivy/ant/AntCallTrigger.java
+++ b/src/java/org/apache/ivy/ant/AntCallTrigger.java
@@ -19,7 +19,6 @@ package org.apache.ivy.ant;
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.ivy.core.IvyContext;
@@ -55,7 +54,7 @@ public class AntCallTrigger extends AbstractTrigger implements Trigger {
 
     private String target = null;
 
-    private Collection calls = new ArrayList();
+    private Collection<IvyEvent> calls = new ArrayList<>();
 
     private String prefix;
 
@@ -73,16 +72,14 @@ public class AntCallTrigger extends AbstractTrigger implements Trigger {
             call.setProject(project);
             call.setTaskName("antcall");
 
-            Map attributes = event.getAttributes();
+            Map<String, String> attributes = event.getAttributes();
             String target = IvyPatternHelper.substituteTokens(getTarget(), attributes);
             call.setTarget(target);
 
-            for (Iterator iter = attributes.keySet().iterator(); iter.hasNext();) {
-                String key = (String) iter.next();
-                String value = (String) attributes.get(key);
+            for (Map.Entry<String, String> entry : attributes.entrySet()) {
                 Property p = call.createParam();
-                p.setName(prefix == null ? key : prefix + key);
-                p.setValue(value == null ? "" : value);
+                p.setName(prefix == null ? entry.getKey() : prefix + entry.getKey());
+                p.setValue(entry.getValue() == null ? "" : entry.getValue());
             }
 
             Message.verbose("triggering ant call: target=" + target + " for " + event);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/src/java/org/apache/ivy/ant/AntWorkspaceResolver.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/AntWorkspaceResolver.java b/src/java/org/apache/ivy/ant/AntWorkspaceResolver.java
index 14fd0b1..5166a7b 100644
--- a/src/java/org/apache/ivy/ant/AntWorkspaceResolver.java
+++ b/src/java/org/apache/ivy/ant/AntWorkspaceResolver.java
@@ -25,7 +25,6 @@ import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -45,6 +44,7 @@ import org.apache.ivy.plugins.resolver.AbstractWorkspaceResolver;
 import org.apache.ivy.util.Message;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.types.DataType;
+import org.apache.tools.ant.types.Resource;
 import org.apache.tools.ant.types.ResourceCollection;
 import org.apache.tools.ant.types.resources.FileResource;
 
@@ -77,7 +77,7 @@ public class AntWorkspaceResolver extends DataType {
         }
     }
 
-    private List<ResourceCollection> allResources = new ArrayList<ResourceCollection>();
+    private List<ResourceCollection> allResources = new ArrayList<>();
 
     private boolean haltOnError = true;
 
@@ -85,7 +85,7 @@ public class AntWorkspaceResolver extends DataType {
 
     private String name;
 
-    private List<WorkspaceArtifact> artifacts = new ArrayList<WorkspaceArtifact>();
+    private List<WorkspaceArtifact> artifacts = new ArrayList<>();
 
     public void setName(String name) {
         this.name = name;
@@ -129,10 +129,10 @@ public class AntWorkspaceResolver extends DataType {
 
         private synchronized Map<ModuleDescriptor, File> getModuleDescriptors() {
             if (md2IvyFile == null) {
-                md2IvyFile = new HashMap<ModuleDescriptor, File>();
+                md2IvyFile = new HashMap<>();
                 for (ResourceCollection resources : allResources) {
-                    for (Iterator it = resources.iterator(); it.hasNext();) {
-                        File ivyFile = ((FileResource) it.next()).getFile();
+                    for (Resource resource : resources) {
+                        File ivyFile = ((FileResource) resource).getFile();
                         try {
                             ModuleDescriptor md = ModuleDescriptorParserRegistry.getInstance()
                                     .parseDescriptor(getParserSettings(), ivyFile.toURI().toURL(),
@@ -156,8 +156,7 @@ public class AntWorkspaceResolver extends DataType {
 
         public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data)
                 throws ParseException {
-            Map<ModuleDescriptor, File> mds = getModuleDescriptors();
-            for (Entry<ModuleDescriptor, File> md : mds.entrySet()) {
+            for (Entry<ModuleDescriptor, File> md : getModuleDescriptors().entrySet()) {
                 ResolvedModuleRevision rmr = checkCandidate(dd, md.getKey(),
                     getProjectName(md.getValue()));
                 if (rmr != null) {
@@ -169,7 +168,7 @@ public class AntWorkspaceResolver extends DataType {
 
         @Override
         protected List<Artifact> createWorkspaceArtifacts(ModuleDescriptor md) {
-            List<Artifact> res = new ArrayList<Artifact>();
+            List<Artifact> res = new ArrayList<>();
 
             for (WorkspaceArtifact wa : artifacts) {
                 String name = wa.name;
@@ -209,10 +208,10 @@ public class AntWorkspaceResolver extends DataType {
         public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
             // Not much to do here - downloads are not required for workspace projects.
             DownloadReport dr = new DownloadReport();
-            for (int i = 0; i < artifacts.length; i++) {
-                ArtifactDownloadReport adr = new ArtifactDownloadReport(artifacts[i]);
+            for (Artifact artifact : artifacts) {
+                ArtifactDownloadReport adr = new ArtifactDownloadReport(artifact);
                 dr.addArtifactReport(adr);
-                URL url = artifacts[i].getUrl();
+                URL url = artifact.getUrl();
                 if (url == null || !url.getProtocol().equals("file")) {
                     // this is not an artifact managed by this resolver
                     adr.setDownloadStatus(DownloadStatus.FAILED);
@@ -227,7 +226,7 @@ public class AntWorkspaceResolver extends DataType {
                 adr.setLocalFile(f);
                 adr.setDownloadStatus(DownloadStatus.NO);
                 adr.setSize(0);
-                Message.verbose("\t[IN WORKSPACE] " + artifacts[i]);
+                Message.verbose("\t[IN WORKSPACE] " + artifact);
             }
             return dr;
         }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/src/java/org/apache/ivy/ant/FixDepsTask.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/FixDepsTask.java b/src/java/org/apache/ivy/ant/FixDepsTask.java
index 8695cb8..63772ca 100644
--- a/src/java/org/apache/ivy/ant/FixDepsTask.java
+++ b/src/java/org/apache/ivy/ant/FixDepsTask.java
@@ -32,7 +32,7 @@ public class FixDepsTask extends IvyPostResolveTask {
 
     private File dest;
 
-    private List<Keep> keeps = new ArrayList<Keep>();
+    private List<Keep> keeps = new ArrayList<>();
 
     public void setToFile(File dest) {
         this.dest = dest;
@@ -73,7 +73,7 @@ public class FixDepsTask extends IvyPostResolveTask {
 
         ResolveReport report = getResolvedReport();
 
-        List<ModuleId> midToKeep = new ArrayList<ModuleId>();
+        List<ModuleId> midToKeep = new ArrayList<>();
         for (Keep keep : keeps) {
             midToKeep.add(ModuleId.newInstance(keep.org, keep.module));
         }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/src/java/org/apache/ivy/ant/IvyAntSettings.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyAntSettings.java b/src/java/org/apache/ivy/ant/IvyAntSettings.java
index 9f169d6..6672b10 100644
--- a/src/java/org/apache/ivy/ant/IvyAntSettings.java
+++ b/src/java/org/apache/ivy/ant/IvyAntSettings.java
@@ -304,10 +304,7 @@ public class IvyAntSettings extends DataType {
             }
             ivyAntVariableContainer.updateProject(id);
             ivyEngine = ivy;
-        } catch (ParseException e) {
-            throw new BuildException("impossible to configure ivy:settings with given "
-                    + (file != null ? "file: " + file : "url: " + url) + " : " + e, e);
-        } catch (IOException e) {
+        } catch (ParseException | IOException e) {
             throw new BuildException("impossible to configure ivy:settings with given "
                     + (file != null ? "file: " + file : "url: " + url) + " : " + e, e);
         } finally {
@@ -354,15 +351,14 @@ public class IvyAntSettings extends DataType {
                 new File(getProject().getBaseDir(), settingsFileName),
                 new File(getProject().getBaseDir(), "ivyconf.xml"), new File(settingsFileName),
                 new File("ivyconf.xml")};
-        for (int i = 0; i < settingsLocations.length; i++) {
-            file = settingsLocations[i];
-            task.log("searching settings file: trying " + file, Project.MSG_VERBOSE);
-            if (file.exists()) {
+        for (File settingsFile : settingsLocations) {
+            task.log("searching settings file: trying " + settingsFile, Project.MSG_VERBOSE);
+            if (settingsFile.exists()) {
+                file = settingsFile;
                 break;
             }
         }
-        if (!file.exists()) {
-            file = null;
+        if (file == null) {
             if (Boolean.valueOf(getProject().getProperty("ivy.14.compatible"))) {
                 task.log("no settings file found, using Ivy 1.4 default...", Project.MSG_VERBOSE);
                 url = IvySettings.getDefault14SettingsURL();

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/src/java/org/apache/ivy/ant/IvyAntVariableContainer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyAntVariableContainer.java b/src/java/org/apache/ivy/ant/IvyAntVariableContainer.java
index f9dc77f..e1c1d54 100644
--- a/src/java/org/apache/ivy/ant/IvyAntVariableContainer.java
+++ b/src/java/org/apache/ivy/ant/IvyAntVariableContainer.java
@@ -18,7 +18,6 @@
 package org.apache.ivy.ant;
 
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Map.Entry;
 
@@ -30,7 +29,7 @@ import org.apache.tools.ant.taskdefs.Property;
 
 class IvyAntVariableContainer extends IvyVariableContainerImpl implements IvyVariableContainer {
 
-    private Map overwrittenProperties = new HashMap();
+    private Map<String, String> overwrittenProperties = new HashMap<>();
 
     private Project project;
 
@@ -39,7 +38,7 @@ class IvyAntVariableContainer extends IvyVariableContainerImpl implements IvyVar
     }
 
     public String getVariable(String name) {
-        String r = (String) overwrittenProperties.get(name);
+        String r = overwrittenProperties.get(name);
         if (r == null) {
             r = project.getProperty(name);
         }
@@ -73,14 +72,12 @@ class IvyAntVariableContainer extends IvyVariableContainerImpl implements IvyVar
      *            be used as property names suffix
      */
     public void updateProject(String id) {
-        Map r = new HashMap(super.getVariables());
+        Map<String, String> r = new HashMap<>(super.getVariables());
         r.putAll(overwrittenProperties);
-        for (Iterator it = r.entrySet().iterator(); it.hasNext();) {
-            Entry entry = (Entry) it.next();
-
-            setPropertyIfNotSet((String) entry.getKey(), (String) entry.getValue());
+        for (Entry<String, String> entry : r.entrySet()) {
+            setPropertyIfNotSet(entry.getKey(), entry.getValue());
             if (id != null) {
-                setPropertyIfNotSet((String) entry.getKey() + "." + id, (String) entry.getValue());
+                setPropertyIfNotSet(entry.getKey() + "." + id, entry.getValue());
             }
         }
 
@@ -102,7 +99,8 @@ class IvyAntVariableContainer extends IvyVariableContainerImpl implements IvyVar
     @SuppressWarnings("unchecked")
     public Object clone() {
         IvyAntVariableContainer result = (IvyAntVariableContainer) super.clone();
-        result.overwrittenProperties = (HashMap) ((HashMap) this.overwrittenProperties).clone();
+        result.overwrittenProperties = (HashMap<String, String>) ((HashMap<String, String>) this.overwrittenProperties)
+                .clone();
         return result;
     }
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/src/java/org/apache/ivy/ant/IvyArtifactProperty.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyArtifactProperty.java b/src/java/org/apache/ivy/ant/IvyArtifactProperty.java
index 5c598f9..5308158 100644
--- a/src/java/org/apache/ivy/ant/IvyArtifactProperty.java
+++ b/src/java/org/apache/ivy/ant/IvyArtifactProperty.java
@@ -62,23 +62,20 @@ public class IvyArtifactProperty extends IvyPostResolveTask {
 
         try {
             ResolutionCacheManager cacheMgr = getIvyInstance().getResolutionCacheManager();
-            String[] confs = splitConfs(getConf());
             String resolveId = getResolveId();
             if (resolveId == null) {
                 resolveId = ResolveOptions.getDefaultResolveId(getResolvedModuleId());
             }
             XmlReportParser parser = new XmlReportParser();
-            for (int i = 0; i < confs.length; i++) {
-                File report = cacheMgr.getConfigurationResolveReportInCache(resolveId, confs[i]);
+            for (String conf : splitConfs(getConf())) {
+                File report = cacheMgr.getConfigurationResolveReportInCache(resolveId, conf);
                 parser.parse(report);
 
-                Artifact[] artifacts = parser.getArtifacts();
-                for (int j = 0; j < artifacts.length; j++) {
-                    Artifact artifact = artifacts[j];
+                for (Artifact artifact : parser.getArtifacts()) {
                     String name = IvyPatternHelper.substitute(getSettings().substitute(getName()),
-                        artifact, confs[i]);
+                            artifact, conf);
                     String value = IvyPatternHelper.substitute(
-                        getSettings().substitute(getValue()), artifact, confs[i]);
+                            getSettings().substitute(getValue()), artifact, conf);
                     setProperty(name, value);
                 }
             }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/src/java/org/apache/ivy/ant/IvyArtifactReport.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyArtifactReport.java b/src/java/org/apache/ivy/ant/IvyArtifactReport.java
index cc55d43..aff8c4c 100644
--- a/src/java/org/apache/ivy/ant/IvyArtifactReport.java
+++ b/src/java/org/apache/ivy/ant/IvyArtifactReport.java
@@ -23,7 +23,6 @@ import java.io.IOException;
 import java.text.ParseException;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
@@ -86,28 +85,26 @@ public class IvyArtifactReport extends IvyPostResolveTask {
             String[] confs = splitConfs(getConf());
             ModuleDescriptor md = null;
             if (getResolveId() != null) {
-                md = (ModuleDescriptor) getResolvedDescriptor(getResolveId());
+                md = getResolvedDescriptor(getResolveId());
             } else {
-                md = (ModuleDescriptor) getResolvedDescriptor(getOrganisation(), getModule(), false);
+                md = getResolvedDescriptor(getOrganisation(), getModule(), false);
             }
-            IvyNode[] dependencies = getIvyInstance().getResolveEngine().getDependencies(
-                md,
+            IvyNode[] dependencies = getIvyInstance().getResolveEngine().getDependencies(md,
                 ((ResolveOptions) new ResolveOptions().setLog(getLog())).setConfs(confs)
                         .setResolveId(getResolveId()).setValidate(doValidate(getSettings())), null);
 
-            Map artifactsToCopy = getIvyInstance().getRetrieveEngine().determineArtifactsToCopy(
-                ModuleRevisionId.newInstance(getOrganisation(), getModule(), getRevision()),
-                pattern,
-                ((RetrieveOptions) new RetrieveOptions().setLog(getLog())).setConfs(confs)
-                        .setResolveId(getResolveId()));
+            Map<ArtifactDownloadReport, Set<String>> artifactsToCopy = getIvyInstance().getRetrieveEngine()
+                    .determineArtifactsToCopy(ModuleRevisionId.newInstance(getOrganisation(),
+                            getModule(), getRevision()), pattern,
+                            ((RetrieveOptions) new RetrieveOptions().setLog(getLog()))
+                                    .setConfs(confs).setResolveId(getResolveId()));
 
-            Map moduleRevToArtifactsMap = new HashMap();
-            for (Iterator iter = artifactsToCopy.keySet().iterator(); iter.hasNext();) {
-                ArtifactDownloadReport artifact = (ArtifactDownloadReport) iter.next();
-                Set moduleRevArtifacts = (Set) moduleRevToArtifactsMap.get(artifact.getArtifact()
+            Map<ModuleRevisionId, Set<ArtifactDownloadReport>> moduleRevToArtifactsMap = new HashMap<>();
+            for (ArtifactDownloadReport artifact : artifactsToCopy.keySet()) {
+                Set<ArtifactDownloadReport> moduleRevArtifacts = moduleRevToArtifactsMap.get(artifact.getArtifact()
                         .getModuleRevisionId());
                 if (moduleRevArtifacts == null) {
-                    moduleRevArtifacts = new HashSet();
+                    moduleRevArtifacts = new HashSet<>();
                     moduleRevToArtifactsMap.put(artifact.getArtifact().getModuleRevisionId(),
                         moduleRevArtifacts);
                 }
@@ -123,29 +120,28 @@ public class IvyArtifactReport extends IvyPostResolveTask {
         }
     }
 
-    private void generateXml(IvyNode[] dependencies, Map moduleRevToArtifactsMap,
-            Map artifactsToCopy) {
+    private void generateXml(IvyNode[] dependencies,
+                             Map<ModuleRevisionId, Set<ArtifactDownloadReport>> moduleRevToArtifactsMap,
+                             Map<ArtifactDownloadReport, Set<String>> artifactsToCopy) {
         try {
-            FileOutputStream fileOutputStream = new FileOutputStream(tofile);
-            try {
+            try (FileOutputStream fileOutputStream = new FileOutputStream(tofile)) {
                 TransformerHandler saxHandler = createTransformerHandler(fileOutputStream);
 
                 saxHandler.startDocument();
                 saxHandler.startElement(null, "modules", "modules", new AttributesImpl());
 
-                for (int i = 0; i < dependencies.length; i++) {
-                    IvyNode dependency = dependencies[i];
-                    if (dependency.getModuleRevision() == null || dependency.isCompletelyEvicted()) {
+                for (IvyNode dependency : dependencies) {
+                    if (dependency.getModuleRevision() == null
+                            || dependency.isCompletelyEvicted()) {
                         continue;
                     }
 
                     startModule(saxHandler, dependency);
 
-                    Set artifactsOfModuleRev = (Set) moduleRevToArtifactsMap.get(dependency
+                    Set<ArtifactDownloadReport> artifactsOfModuleRev = moduleRevToArtifactsMap.get(dependency
                             .getModuleRevision().getId());
                     if (artifactsOfModuleRev != null) {
-                        for (Iterator iter = artifactsOfModuleRev.iterator(); iter.hasNext();) {
-                            ArtifactDownloadReport artifact = (ArtifactDownloadReport) iter.next();
+                        for (ArtifactDownloadReport artifact : artifactsOfModuleRev) {
 
                             RepositoryCacheManager cache = dependency.getModuleRevision()
                                     .getArtifactResolver().getRepositoryCacheManager();
@@ -155,10 +151,7 @@ public class IvyArtifactReport extends IvyPostResolveTask {
                             writeOriginLocationIfPresent(cache, saxHandler, artifact);
                             writeCacheLocationIfPresent(cache, saxHandler, artifact);
 
-                            Set artifactDestPaths = (Set) artifactsToCopy.get(artifact);
-                            for (Iterator iterator = artifactDestPaths.iterator(); iterator
-                                    .hasNext();) {
-                                String artifactDestPath = (String) iterator.next();
+                            for (String artifactDestPath : artifactsToCopy.get(artifact)) {
                                 writeRetrieveLocation(saxHandler, artifactDestPath);
                             }
                             saxHandler.endElement(null, "artifact", "artifact");
@@ -168,14 +161,8 @@ public class IvyArtifactReport extends IvyPostResolveTask {
                 }
                 saxHandler.endElement(null, "modules", "modules");
                 saxHandler.endDocument();
-            } finally {
-                fileOutputStream.close();
             }
-        } catch (SAXException e) {
-            throw new BuildException("impossible to generate report", e);
-        } catch (TransformerConfigurationException e) {
-            throw new BuildException("impossible to generate report", e);
-        } catch (IOException e) {
+        } catch (SAXException | IOException | TransformerConfigurationException e) {
             throw new BuildException("impossible to generate report", e);
         }
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/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 bdc9ab9..b0cbf98 100644
--- a/src/java/org/apache/ivy/ant/IvyBuildList.java
+++ b/src/java/org/apache/ivy/ant/IvyBuildList.java
@@ -65,7 +65,7 @@ public class IvyBuildList extends IvyTask {
 
     public static final String DESCRIPTOR_REQUIRED = "required";
 
-    private List<FileSet> buildFileSets = new ArrayList<FileSet>();
+    private List<FileSet> buildFileSets = new ArrayList<>();
 
     private String reference;
 
@@ -168,12 +168,12 @@ public class IvyBuildList extends IvyTask {
 
         Path path = new Path(getProject());
 
-        Map<ModuleDescriptor, File> buildFiles = new HashMap<ModuleDescriptor, File>();
-        List<File> independent = new ArrayList<File>();
-        List<File> noDescriptor = new ArrayList<File>();
-        Collection<ModuleDescriptor> mds = new ArrayList<ModuleDescriptor>();
+        Map<ModuleDescriptor, File> buildFiles = new HashMap<>();
+        List<File> independent = new ArrayList<>();
+        List<File> noDescriptor = new ArrayList<>();
+        Collection<ModuleDescriptor> mds = new ArrayList<>();
 
-        Set<String> rootModuleNames = new LinkedHashSet<String>();
+        Set<String> rootModuleNames = new LinkedHashSet<>();
         if (!"*".equals(root)) {
             StringTokenizer st = new StringTokenizer(root, delimiter);
             while (st.hasMoreTokens()) {
@@ -181,7 +181,7 @@ public class IvyBuildList extends IvyTask {
             }
         }
 
-        Set<String> leafModuleNames = new LinkedHashSet<String>();
+        Set<String> leafModuleNames = new LinkedHashSet<>();
         if (!"*".equals(leaf)) {
             StringTokenizer st = new StringTokenizer(leaf, delimiter);
             while (st.hasMoreTokens()) {
@@ -189,7 +189,7 @@ public class IvyBuildList extends IvyTask {
             }
         }
 
-        Set<String> restartFromModuleNames = new LinkedHashSet<String>();
+        Set<String> restartFromModuleNames = new LinkedHashSet<>();
         if (!"*".equals(restartFrom)) {
             StringTokenizer st = new StringTokenizer(restartFrom, delimiter);
             // Only accept one (first) module
@@ -198,9 +198,8 @@ public class IvyBuildList extends IvyTask {
 
         for (FileSet fs : buildFileSets) {
             DirectoryScanner ds = fs.getDirectoryScanner(getProject());
-            String[] builds = ds.getIncludedFiles();
-            for (int i = 0; i < builds.length; i++) {
-                File buildFile = new File(ds.getBasedir(), builds[i]);
+            for (String build : ds.getIncludedFiles()) {
+                File buildFile = new File(ds.getBasedir(), build);
                 File ivyFile = getIvyFileFor(buildFile);
                 if (!ivyFile.exists()) {
                     onMissingDescriptor(buildFile, ivyFile, noDescriptor);
@@ -261,7 +260,7 @@ public class IvyBuildList extends IvyTask {
         // so they are not removed from build path.
         if (!restartFromModuleDescriptors.isEmpty()) {
             boolean foundRestartFrom = false;
-            List<ModuleDescriptor> keptModules = new ArrayList<ModuleDescriptor>();
+            List<ModuleDescriptor> keptModules = new ArrayList<>();
             ModuleDescriptor restartFromModuleDescriptor = restartFromModuleDescriptors.get(0);
             for (ModuleDescriptor md : sortedModules) {
                 if (md.equals(restartFromModuleDescriptor)) {
@@ -273,7 +272,7 @@ public class IvyBuildList extends IvyTask {
             }
             sortedModules = keptModules;
         }
-        StringBuffer order = new StringBuffer();
+        StringBuilder order = new StringBuilder();
         for (ListIterator<ModuleDescriptor> iter = sortedModules.listIterator(); iter.hasNext();) {
             ModuleDescriptor md = iter.next();
             order.append(md.getModuleRevisionId().getModuleId());
@@ -305,13 +304,8 @@ public class IvyBuildList extends IvyTask {
                 Message.warn("a module has no module descriptor. " + "Build file: " + buildFile
                         + ". Expected descriptor: " + ivyFile);
             }
-            Message.verbose("no descriptor for "
-                    + buildFile
-                    + ": descriptor="
-                    + ivyFile
-                    + ": adding it at the "
-                    + (OnMissingDescriptor.TAIL.equals(onMissingDescriptor) ? "tail" : "head"
-                            + " of the path"));
+            Message.verbose(String.format("no descriptor for %s: descriptor=%s: adding it at the %s of the path",
+                    buildFile, ivyFile, (OnMissingDescriptor.TAIL.equals(onMissingDescriptor) ? "tail" : "head")));
             Message.verbose("\t(change onMissingDescriptor if you want to take another action");
             noDescriptor.add(buildFile);
         }
@@ -319,8 +313,8 @@ public class IvyBuildList extends IvyTask {
 
     private List<ModuleDescriptor> convertModuleNamesToModuleDescriptors(
             Collection<ModuleDescriptor> mds, Set<String> moduleNames, String kind) {
-        List<ModuleDescriptor> result = new ArrayList<ModuleDescriptor>();
-        Set<String> foundModuleNames = new HashSet<String>();
+        List<ModuleDescriptor> result = new ArrayList<>();
+        Set<String> foundModuleNames = new HashSet<>();
 
         for (ModuleDescriptor md : mds) {
             String name = md.getModuleRevisionId().getModuleId().getName();
@@ -331,10 +325,10 @@ public class IvyBuildList extends IvyTask {
         }
 
         if (foundModuleNames.size() < moduleNames.size()) {
-            Set<String> missingModules = new HashSet<String>(moduleNames);
+            Set<String> missingModules = new HashSet<>(moduleNames);
             missingModules.removeAll(foundModuleNames);
 
-            StringBuffer missingNames = new StringBuffer();
+            StringBuilder missingNames = new StringBuilder();
             String sep = "";
             for (String name : missingModules) {
                 missingNames.append(sep);
@@ -361,13 +355,13 @@ public class IvyBuildList extends IvyTask {
      */
     private Collection<ModuleDescriptor> filterModulesFromRoot(Collection<ModuleDescriptor> mds,
             List<ModuleDescriptor> rootmds) {
-        Map<ModuleId, ModuleDescriptor> moduleIdMap = new HashMap<ModuleId, ModuleDescriptor>();
+        Map<ModuleId, ModuleDescriptor> moduleIdMap = new HashMap<>();
         for (ModuleDescriptor md : mds) {
             moduleIdMap.put(md.getModuleRevisionId().getModuleId(), md);
         }
 
         // recursively process the nodes
-        Set<ModuleDescriptor> toKeep = new LinkedHashSet<ModuleDescriptor>();
+        Set<ModuleDescriptor> toKeep = new LinkedHashSet<>();
 
         for (ModuleDescriptor rootmd : rootmds) {
             processFilterNodeFromRoot(rootmd, toKeep, moduleIdMap);
@@ -404,10 +398,8 @@ public class IvyBuildList extends IvyTask {
     private void processFilterNodeFromRoot(ModuleDescriptor node, Set<ModuleDescriptor> toKeep,
             Map<ModuleId, ModuleDescriptor> moduleIdMap) {
         // toKeep.add(node);
-
-        DependencyDescriptor[] deps = node.getDependencies();
-        for (int i = 0; i < deps.length; i++) {
-            ModuleId id = deps[i].getDependencyId();
+        for (DependencyDescriptor dep : node.getDependencies()) {
+            ModuleId id = dep.getDependencyId();
             ModuleDescriptor md = moduleIdMap.get(id);
             // we test if this module id has a module descriptor, and if it isn't already in the
             // toKeep Set, in which there's probably a circular dependency
@@ -432,13 +424,13 @@ public class IvyBuildList extends IvyTask {
      */
     private Collection<ModuleDescriptor> filterModulesFromLeaf(Collection<ModuleDescriptor> mds,
             List<ModuleDescriptor> leafmds) {
-        Map<ModuleId, ModuleDescriptor> moduleIdMap = new HashMap<ModuleId, ModuleDescriptor>();
+        Map<ModuleId, ModuleDescriptor> moduleIdMap = new HashMap<>();
         for (ModuleDescriptor md : mds) {
             moduleIdMap.put(md.getModuleRevisionId().getModuleId(), md);
         }
 
         // recursively process the nodes
-        Set<ModuleDescriptor> toKeep = new LinkedHashSet<ModuleDescriptor>();
+        Set<ModuleDescriptor> toKeep = new LinkedHashSet<>();
         for (ModuleDescriptor leafmd : leafmds) {
             // With the excludeleaf attribute set to true, take the rootmd out of the toKeep set.
             if (excludeLeaf) {
@@ -472,9 +464,8 @@ public class IvyBuildList extends IvyTask {
     private void processFilterNodeFromLeaf(ModuleDescriptor node, Set<ModuleDescriptor> toKeep,
             Map<ModuleId, ModuleDescriptor> moduleIdMap) {
         for (ModuleDescriptor md : moduleIdMap.values()) {
-            DependencyDescriptor[] deps = md.getDependencies();
-            for (int i = 0; i < deps.length; i++) {
-                ModuleId id = deps[i].getDependencyId();
+            for (DependencyDescriptor dep : md.getDependencies()) {
+                ModuleId id = dep.getDependencyId();
                 if (node.getModuleRevisionId().getModuleId().equals(id) && !toKeep.contains(md)) {
                     toKeep.add(md);
                     if (!getOnlydirectdep()) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/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 fb526ad..56bcc6d 100644
--- a/src/java/org/apache/ivy/ant/IvyCacheFileset.java
+++ b/src/java/org/apache/ivy/ant/IvyCacheFileset.java
@@ -29,6 +29,7 @@ import org.apache.tools.ant.DirectoryScanner;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.types.FileSet;
 import org.apache.tools.ant.types.PatternSet.NameEntry;
+import org.apache.tools.ant.types.Resource;
 
 /**
  * Creates an ant fileset consisting in all artifacts found during a resolve. Note that this task is
@@ -94,7 +95,7 @@ public class IvyCacheFileset extends IvyCacheTask {
      *
      * @param artifactDownloadReports The artifact download reports for which the common base directory of the artifacts
      *                                has to be determined
-     * @return
+     * @return File
      */
     File requireCommonBaseDir(final List<ArtifactDownloadReport> artifactDownloadReports) {
         File base = null;
@@ -196,8 +197,8 @@ public class IvyCacheFileset extends IvyCacheTask {
 
         private DirectoryScanner ds = new EmptyDirectoryScanner();
 
-        public Iterator iterator() {
-            return new EmptyIterator();
+        public Iterator<Resource> iterator() {
+            return new EmptyIterator<>();
         }
 
         public Object clone() {
@@ -213,13 +214,13 @@ public class IvyCacheFileset extends IvyCacheTask {
         }
     }
 
-    private static class EmptyIterator implements Iterator {
+    private static class EmptyIterator<T> implements Iterator<T> {
 
         public boolean hasNext() {
             return false;
         }
 
-        public Object next() {
+        public T next() {
             throw new NoSuchElementException("EmptyFileSet Iterator");
         }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/src/java/org/apache/ivy/ant/IvyCachePath.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyCachePath.java b/src/java/org/apache/ivy/ant/IvyCachePath.java
index d4b7843..1a7b6eb 100644
--- a/src/java/org/apache/ivy/ant/IvyCachePath.java
+++ b/src/java/org/apache/ivy/ant/IvyCachePath.java
@@ -18,7 +18,6 @@
 package org.apache.ivy.ant;
 
 import java.io.File;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.ivy.core.report.ArtifactDownloadReport;
@@ -73,11 +72,10 @@ public class IvyCachePath extends IvyCacheTask {
         try {
             Path path = new Path(getProject());
             getProject().addReference(pathid, path);
-            for (Iterator iter = getArtifactReports().iterator(); iter.hasNext();) {
-                ArtifactDownloadReport a = (ArtifactDownloadReport) iter.next();
-                File f = a.getLocalFile();
-                if (a.getUnpackedLocalFile() != null) {
-                    f = a.getUnpackedLocalFile();
+            for (ArtifactDownloadReport adr : getArtifactReports()) {
+                File f = adr.getLocalFile();
+                if (adr.getUnpackedLocalFile() != null) {
+                    f = adr.getUnpackedLocalFile();
                 }
                 addToPath(path, f);
             }
@@ -98,13 +96,12 @@ public class IvyCachePath extends IvyCacheTask {
             return;
         }
         BundleInfo bundleInfo = ManifestParser.parseManifest(manifest);
-        List/* <String> */cp = bundleInfo.getClasspath();
+        List<String> cp = bundleInfo.getClasspath();
         if (cp == null) {
             path.createPathElement().setLocation(f);
             return;
         }
-        for (int i = 0; i < cp.size(); i++) {
-            String p = (String) cp.get(i);
+        for (String p : cp) {
             if (p.equals(".")) {
                 path.createPathElement().setLocation(f);
             } else {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/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 e8de729..72c14a7 100644
--- a/src/java/org/apache/ivy/ant/IvyCacheTask.java
+++ b/src/java/org/apache/ivy/ant/IvyCacheTask.java
@@ -46,7 +46,7 @@ public abstract class IvyCacheTask extends IvyPostResolveTask {
     protected List<ArtifactDownloadReport> getArtifactReports() throws BuildException,
             ParseException, IOException {
         Collection<ArtifactDownloadReport> artifacts = getAllArtifactReports();
-        List<ArtifactDownloadReport> ret = new ArrayList<ArtifactDownloadReport>();
+        List<ArtifactDownloadReport> ret = new ArrayList<>();
         for (ArtifactDownloadReport artifactReport : artifacts) {
             if (getArtifactFilter().accept(artifactReport.getArtifact())) {
                 ret.add(artifactReport);
@@ -59,16 +59,16 @@ public abstract class IvyCacheTask extends IvyPostResolveTask {
     private Collection<ArtifactDownloadReport> getAllArtifactReports() throws ParseException,
             IOException {
         String[] confs = splitConfs(getConf());
-        Collection<ArtifactDownloadReport> all = new LinkedHashSet<ArtifactDownloadReport>();
+        Collection<ArtifactDownloadReport> all = new LinkedHashSet<>();
 
         ResolveReport report = getResolvedReport();
         if (report != null) {
             Message.debug("using internal report instance to get artifacts list");
-            for (int i = 0; i < confs.length; i++) {
+            for (String conf : confs) {
                 ConfigurationResolveReport configurationReport = report
-                        .getConfigurationReport(confs[i]);
+                        .getConfigurationReport(conf);
                 if (configurationReport == null) {
-                    throw new BuildException("bad confs provided: " + confs[i]
+                    throw new BuildException("bad confs provided: " + conf
                             + " not found among " + Arrays.asList(report.getConfigurations()));
                 }
                 Set<ModuleRevisionId> revisions = configurationReport.getModuleRevisionIds();
@@ -87,9 +87,9 @@ public abstract class IvyCacheTask extends IvyPostResolveTask {
             if (resolvedId == null) {
                 resolvedId = ResolveOptions.getDefaultResolveId(getResolvedModuleId());
             }
-            for (int i = 0; i < confs.length; i++) {
+            for (String conf : confs) {
                 File reportFile = cacheMgr.getConfigurationResolveReportInCache(resolvedId,
-                    confs[i]);
+                        conf);
                 parser.parse(reportFile);
 
                 ArtifactDownloadReport[] aReports = parser.getArtifactReports();

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/src/java/org/apache/ivy/ant/IvyCheck.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyCheck.java b/src/java/org/apache/ivy/ant/IvyCheck.java
index dda9c7f..50a353e 100644
--- a/src/java/org/apache/ivy/ant/IvyCheck.java
+++ b/src/java/org/apache/ivy/ant/IvyCheck.java
@@ -38,7 +38,7 @@ import org.apache.tools.ant.types.FileSet;
 public class IvyCheck extends IvyTask {
     private File file = null;
 
-    private List filesets = new ArrayList();
+    private final List<FileSet> filesets = new ArrayList<>();
 
     private String resolvername;
 
@@ -76,15 +76,14 @@ public class IvyCheck extends IvyTask {
                     Message.verbose("checked " + file + ": OK");
                 }
             }
-            for (int i = 0; i < filesets.size(); i++) {
-                FileSet fs = (FileSet) filesets.get(i);
+            for (FileSet fs : filesets) {
                 DirectoryScanner ds = fs.getDirectoryScanner(getProject());
 
                 File fromDir = fs.getDir(getProject());
 
                 String[] srcFiles = ds.getIncludedFiles();
-                for (int j = 0; j < srcFiles.length; j++) {
-                    File file = new File(fromDir, srcFiles[j]);
+                for (String srcFile : srcFiles) {
+                    File file = new File(fromDir, srcFile);
                     if (ivy.check(file.toURI().toURL(), resolvername)) {
                         Message.verbose("checked " + file + ": OK");
                     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/src/java/org/apache/ivy/ant/IvyCleanCache.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyCleanCache.java b/src/java/org/apache/ivy/ant/IvyCleanCache.java
index c4b0c07..6e1612f 100644
--- a/src/java/org/apache/ivy/ant/IvyCleanCache.java
+++ b/src/java/org/apache/ivy/ant/IvyCleanCache.java
@@ -70,8 +70,8 @@ public class IvyCleanCache extends IvyTask {
         }
         if (ALL.equals(getCache())) {
             RepositoryCacheManager[] caches = settings.getRepositoryCacheManagers();
-            for (int i = 0; i < caches.length; i++) {
-                caches[i].clean();
+            for (RepositoryCacheManager cache : caches) {
+                cache.clean();
             }
         } else if (!NONE.equals(getCache())) {
             RepositoryCacheManager cache = settings.getRepositoryCacheManager(getCache());

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/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 6926d02..f41cb5c 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(new String[] {OVERRIDE_TRUE,
-            OVERRIDE_FALSE, OVERRIDE_NOT_ALLOWED});
+    private static final Collection 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/9235380f/src/java/org/apache/ivy/ant/IvyDependency.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyDependency.java b/src/java/org/apache/ivy/ant/IvyDependency.java
index 051a55a..3682dc1 100644
--- a/src/java/org/apache/ivy/ant/IvyDependency.java
+++ b/src/java/org/apache/ivy/ant/IvyDependency.java
@@ -31,13 +31,13 @@ import org.apache.tools.ant.BuildException;
 
 public class IvyDependency {
 
-    private List<IvyDependencyConf> confs = new ArrayList<IvyDependencyConf>();
+    private List<IvyDependencyConf> confs = new ArrayList<>();
 
-    private List<IvyDependencyArtifact> artifacts = new ArrayList<IvyDependencyArtifact>();
+    private List<IvyDependencyArtifact> artifacts = new ArrayList<>();
 
-    private List<IvyDependencyExclude> excludes = new ArrayList<IvyDependencyExclude>();
+    private List<IvyDependencyExclude> excludes = new ArrayList<>();
 
-    private List<IvyDependencyInclude> includes = new ArrayList<IvyDependencyInclude>();
+    private List<IvyDependencyInclude> includes = new ArrayList<>();
 
     private String org;
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/src/java/org/apache/ivy/ant/IvyDependencyConf.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyDependencyConf.java b/src/java/org/apache/ivy/ant/IvyDependencyConf.java
index c42c956..f197b6b 100644
--- a/src/java/org/apache/ivy/ant/IvyDependencyConf.java
+++ b/src/java/org/apache/ivy/ant/IvyDependencyConf.java
@@ -18,14 +18,13 @@
 package org.apache.ivy.ant;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
 
 public class IvyDependencyConf {
 
-    private List/* <IvyDependencyConfMapped> */mappeds = new ArrayList();
+    private final List<IvyDependencyConfMapped> mappeds = new ArrayList<>();
 
     public static class IvyDependencyConfMapped {
         private String name;
@@ -50,14 +49,11 @@ public class IvyDependencyConf {
 
     void addConf(DefaultDependencyDescriptor dd, String masterConf) {
         if (mapped != null) {
-            String[] mappeds = mapped.split(",");
-            for (int i = 0; i < mappeds.length; i++) {
-                dd.addDependencyConfiguration(masterConf, mappeds[i].trim());
+            for (String map : mapped.split(",")) {
+                dd.addDependencyConfiguration(masterConf, map.trim());
             }
         }
-        Iterator itMappeds = mappeds.iterator();
-        while (itMappeds.hasNext()) {
-            IvyDependencyConfMapped m = (IvyDependencyConfMapped) itMappeds.next();
+        for (IvyDependencyConfMapped m : mappeds) {
             dd.addDependencyConfiguration(masterConf, m.name);
         }
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/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 e2e5978..7c30f25 100644
--- a/src/java/org/apache/ivy/ant/IvyDependencyTree.java
+++ b/src/java/org/apache/ivy/ant/IvyDependencyTree.java
@@ -20,7 +20,6 @@ package org.apache.ivy.ant;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -58,21 +57,21 @@ public class IvyDependencyTree extends IvyPostResolveTask {
 
     private void printDependencies(final ModuleRevisionId mrid, final List<IvyNode> dependencyList, final int indent,
                                    final Set<ModuleRevisionId> ancestors) {
-        for (final Iterator iterator = dependencyList.iterator(); iterator.hasNext();) {
+        for (IvyNode dependency : dependencyList) {
             final Set<ModuleRevisionId> ancestorsForCurrentDep = new HashSet<>(ancestors);
             // previous ancestors plus the module to whom these dependencies belong to
             ancestorsForCurrentDep.add(mrid);
-            final IvyNode dependency = (IvyNode) iterator.next();
             final boolean evicted = dependency.isEvicted(getConf());
             if (evicted && !showEvicted) {
                 continue;
             }
+            final boolean isLastDependency = dependencyList.indexOf(dependency) == dependencyList.size() - 1;
             final StringBuilder sb = new StringBuilder();
             final ModuleRevisionId dependencyMrid = dependency.getId();
             final boolean circular = ancestorsForCurrentDep.contains(dependencyMrid);
             if (indent > 0) {
                 for (int i = 0; i < indent; i++) {
-                    if (i == indent - 1 && !iterator.hasNext() && !hasDependencies(dependency)) {
+                    if (i == indent - 1 && isLastDependency && !hasDependencies(dependency)) {
                         sb.append("   ");
                     } else {
                         sb.append("|  ");
@@ -80,11 +79,7 @@ public class IvyDependencyTree extends IvyPostResolveTask {
 
                 }
             }
-            if (iterator.hasNext()) {
-                sb.append("+- ");
-            } else {
-                sb.append("\\- ");
-            }
+            sb.append(isLastDependency ? "\\- " : "+- ");
             if (!evicted && circular) {
                 // log and skip processing the (transitive) dependencies of this dependency
                 sb.append("(circularly depends on) ").append(dependencyMrid);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/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 83dd5ef..1eb628d 100644
--- a/src/java/org/apache/ivy/ant/IvyDependencyUpdateChecker.java
+++ b/src/java/org/apache/ivy/ant/IvyDependencyUpdateChecker.java
@@ -20,7 +20,6 @@ package org.apache.ivy.ant;
 import java.io.IOException;
 import java.text.ParseException;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.ivy.core.module.descriptor.Configuration;
@@ -82,9 +81,7 @@ public class IvyDependencyUpdateChecker extends IvyPostResolveTask {
                 displayMissingDependencyOnLatest(getResolvedReport(), latestReport);
             }
 
-        } catch (ParseException e) {
-            throw new BuildException("impossible to resolve dependencies:\n\t" + e, e);
-        } catch (IOException e) {
+        } catch (ParseException | IOException e) {
             throw new BuildException("impossible to resolve dependencies:\n\t" + e, e);
         }
 
@@ -93,11 +90,8 @@ public class IvyDependencyUpdateChecker extends IvyPostResolveTask {
     private void displayDependencyUpdates(ResolveReport originalReport, ResolveReport latestReport) {
         log("Dependencies updates available :");
         boolean dependencyUpdateDetected = false;
-        for (Iterator iterator = latestReport.getDependencies().iterator(); iterator.hasNext();) {
-            IvyNode latest = (IvyNode) iterator.next();
-            for (Iterator iterator2 = originalReport.getDependencies().iterator(); iterator2
-                    .hasNext();) {
-                IvyNode originalDependency = (IvyNode) iterator2.next();
+        for (IvyNode latest : latestReport.getDependencies()) {
+            for (IvyNode originalDependency : originalReport.getDependencies()) {
                 if (originalDependency.getModuleId().equals(latest.getModuleId())) {
                     if (!originalDependency.getResolvedId().getRevision()
                             .equals(latest.getResolvedId().getRevision())) {
@@ -105,18 +99,13 @@ public class IvyDependencyUpdateChecker extends IvyPostResolveTask {
                         // (unfortunately .isTransitive() methods do not have the same meaning)
                         boolean isTransitiveDependency = latest.getDependencyDescriptor(latest
                                 .getRoot()) == null;
-                        if ((!isTransitiveDependency) || (isTransitiveDependency && showTransitive)) {
-                            StringBuffer sb = new StringBuffer();
-                            sb.append("\t")//
-                                    .append(originalDependency.getResolvedId().getOrganisation()) //
-                                    .append('#')//
-                                    .append(originalDependency.getResolvedId().getName())//
-                                    .append(isTransitiveDependency ? " (transitive)" : "") //
-                                    .append("\t")//
-                                    .append(originalDependency.getResolvedId().getRevision())//
-                                    .append(" -> ")//
-                                    .append(latest.getResolvedId().getRevision());
-                            log(sb.toString());
+                        if (!isTransitiveDependency || showTransitive) {
+                            log(String.format("\t%s#%s%s\t%s -> %s",
+                                    originalDependency.getResolvedId().getOrganisation(),
+                                    originalDependency.getResolvedId().getName(),
+                                    isTransitiveDependency ? " (transitive)" : "",
+                                    originalDependency.getResolvedId().getRevision(),
+                                    latest.getResolvedId().getRevision()));
                             dependencyUpdateDetected = true;
                         }
                     }
@@ -131,16 +120,10 @@ public class IvyDependencyUpdateChecker extends IvyPostResolveTask {
 
     private void displayMissingDependencyOnLatest(ResolveReport originalReport,
             ResolveReport latestReport) {
-        List/* <ModuleRevisionId> */listOfMissingDependencyOnLatest = new ArrayList/*
-                                                                                    * <ModuleRevisionId
-                                                                                    * >
-                                                                                    */();
-        for (Iterator iterator = originalReport.getDependencies().iterator(); iterator.hasNext();) {
-            IvyNode originalDependency = (IvyNode) iterator.next();
+        List<ModuleRevisionId> listOfMissingDependencyOnLatest = new ArrayList<>();
+        for (IvyNode originalDependency : originalReport.getDependencies()) {
             boolean dependencyFound = false;
-            for (Iterator iterator2 = latestReport.getDependencies().iterator(); iterator2
-                    .hasNext();) {
-                IvyNode latest = (IvyNode) iterator2.next();
+            for (IvyNode latest : latestReport.getDependencies()) {
                 if (originalDependency.getModuleId().equals(latest.getModuleId())) {
                     dependencyFound = true;
                 }
@@ -152,8 +135,7 @@ public class IvyDependencyUpdateChecker extends IvyPostResolveTask {
 
         if (listOfMissingDependencyOnLatest.size() > 0) {
             log("List of missing dependency on latest resolve :");
-            for (Iterator iterator = listOfMissingDependencyOnLatest.iterator(); iterator.hasNext();) {
-                ModuleRevisionId moduleRevisionId = (ModuleRevisionId) iterator.next();
+            for (ModuleRevisionId moduleRevisionId : listOfMissingDependencyOnLatest) {
                 log("\t" + moduleRevisionId.toString());
             }
         }
@@ -161,14 +143,10 @@ public class IvyDependencyUpdateChecker extends IvyPostResolveTask {
 
     private void displayNewDependencyOnLatest(ResolveReport originalReport,
             ResolveReport latestReport) {
-        List/* <ModuleRevisionId> */listOfNewDependencyOnLatest = new ArrayList/* <ModuleRevisionId> */();
-        for (Iterator iterator = latestReport.getDependencies().iterator(); iterator.hasNext();) {
-            IvyNode latest = (IvyNode) iterator.next();
-
+        List<ModuleRevisionId> listOfNewDependencyOnLatest = new ArrayList<>();
+        for (IvyNode latest : latestReport.getDependencies()) {
             boolean dependencyFound = false;
-            for (Iterator iterator2 = originalReport.getDependencies().iterator(); iterator2
-                    .hasNext();) {
-                IvyNode originalDependency = (IvyNode) iterator2.next();
+            for (IvyNode originalDependency : originalReport.getDependencies()) {
                 if (originalDependency.getModuleId().equals(latest.getModuleId())) {
                     dependencyFound = true;
                 }
@@ -179,8 +157,7 @@ public class IvyDependencyUpdateChecker extends IvyPostResolveTask {
         }
         if (listOfNewDependencyOnLatest.size() > 0) {
             log("List of new dependency on latest resolve :");
-            for (Iterator iterator = listOfNewDependencyOnLatest.iterator(); iterator.hasNext();) {
-                ModuleRevisionId moduleRevisionId = (ModuleRevisionId) iterator.next();
+            for (ModuleRevisionId moduleRevisionId : listOfNewDependencyOnLatest) {
                 log("\t" + moduleRevisionId.toString());
             }
         }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/src/java/org/apache/ivy/ant/IvyExtractFromSources.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyExtractFromSources.java b/src/java/org/apache/ivy/ant/IvyExtractFromSources.java
index 62e4228..588c2a6 100644
--- a/src/java/org/apache/ivy/ant/IvyExtractFromSources.java
+++ b/src/java/org/apache/ivy/ant/IvyExtractFromSources.java
@@ -27,7 +27,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -67,9 +66,10 @@ public class IvyExtractFromSources extends Task {
 
     private String status;
 
-    private List ignoredPackaged = new ArrayList(); // List (String package)
+    private final List<String> ignoredPackaged = new ArrayList<>(); // List (String package)
 
-    private Map mapping = new HashMap(); // Map (String package -> ModuleRevisionId)
+    private final Map<String, ModuleRevisionId> mapping = new HashMap<>();
+    // Map(String package -> ModuleRevisionId)
 
     private Concat concat = new Concat();
 
@@ -132,35 +132,28 @@ public class IvyExtractFromSources extends Task {
         Writer out = new StringWriter();
         concat.setWriter(out);
         concat.execute();
-        Set importsSet = new HashSet(Arrays.asList(out.toString().split("\n")));
-        Set dependencies = new HashSet();
-        for (Iterator iter = importsSet.iterator(); iter.hasNext();) {
-            String pack = ((String) iter.next()).trim();
-            ModuleRevisionId mrid = getMapping(pack);
+        Set<String> importsSet = new HashSet<>(Arrays.asList(out.toString().split("\n")));
+        Set<ModuleRevisionId> dependencies = new HashSet<>();
+        for (String pack : importsSet) {
+            ModuleRevisionId mrid = getMapping(pack.trim());
             if (mrid != null) {
                 dependencies.add(mrid);
             }
         }
         try {
             PrintWriter writer = new PrintWriter(new FileOutputStream(to));
-            writer.println("<ivy-module version=\"1.0\">");
-            writer.println("\t<info organisation=\"" + organisation + "\"");
-            writer.println("\t       module=\"" + module + "\"");
+            writer.println(String.format("<ivy-module version=\"1.0\">%n\t<info organisation=\"%s\"%n\t       module=\"%s\"",
+                    organisation, module));
             if (revision != null) {
                 writer.println("\t       revision=\"" + revision + "\"");
             }
-            if (status != null) {
-                writer.println("\t       status=\"" + status + "\"");
-            } else {
-                writer.println("\t       status=\"integration\"");
-            }
-            writer.println("\t/>");
+            writer.println(String.format("\t       status=\"%s\"%n\t/>",
+                    (status == null) ? "integration" : status));
             if (!dependencies.isEmpty()) {
                 writer.println("\t<dependencies>");
-                for (Iterator iter = dependencies.iterator(); iter.hasNext();) {
-                    ModuleRevisionId mrid = (ModuleRevisionId) iter.next();
-                    writer.println("\t\t<dependency org=\"" + mrid.getOrganisation() + "\" name=\""
-                            + mrid.getName() + "\" rev=\"" + mrid.getRevision() + "\"/>");
+                for (ModuleRevisionId mrid : dependencies) {
+                    writer.println(String.format("\t\t<dependency org=\"%s\" name=\"%s\" rev=\"%s\"/>",
+                            mrid.getOrganisation(), mrid.getName(), mrid.getRevision()));
                 }
                 writer.println("\t</dependencies>");
             }
@@ -183,7 +176,7 @@ public class IvyExtractFromSources extends Task {
             if (ignoredPackaged.contains(pack)) {
                 return null;
             }
-            ret = (ModuleRevisionId) mapping.get(pack);
+            ret = mapping.get(pack);
             int lastDotIndex = pack.lastIndexOf('.');
             if (lastDotIndex != -1) {
                 pack = pack.substring(0, lastDotIndex);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/src/java/org/apache/ivy/ant/IvyInfo.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyInfo.java b/src/java/org/apache/ivy/ant/IvyInfo.java
index 0bbf939..df5c880 100644
--- a/src/java/org/apache/ivy/ant/IvyInfo.java
+++ b/src/java/org/apache/ivy/ant/IvyInfo.java
@@ -21,10 +21,9 @@ import java.io.File;
 import java.net.MalformedURLException;
 import java.text.ParseException;
 import java.util.ArrayList;
-import java.util.Iterator;
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
 
 import org.apache.ivy.Ivy;
 import org.apache.ivy.core.module.descriptor.Artifact;
@@ -162,50 +161,44 @@ public class IvyInfo extends IvyTask {
                 Long.toString(md.getPublicationDate().getTime()));
         }
 
-        Map extra = mrid.getExtraAttributes();
-        for (Iterator iter = extra.entrySet().iterator(); iter.hasNext();) {
-            Entry entry = (Entry) iter.next();
+        Map<String, String> extra = mrid.getExtraAttributes();
+        for (Map.Entry<String, String> entry : extra.entrySet()) {
             getProject().setProperty(property + ".extra." + entry.getKey(),
-                (String) entry.getValue());
+                    entry.getValue());
         }
 
         getProject().setProperty(property + ".configurations",
             mergeConfs(md.getConfigurationsNames()));
 
         // store the public configurations in a separate property
-        Configuration[] configs = md.getConfigurations();
-        List publicConfigsList = new ArrayList();
-        for (int i = 0; i < configs.length; i++) {
-            String name = configs[i].getName();
-            if (Visibility.PUBLIC.equals(configs[i].getVisibility())) {
+        List<String> publicConfigsList = new ArrayList<>();
+        for (Configuration config : md.getConfigurations()) {
+            String name = config.getName();
+            if (Visibility.PUBLIC.equals(config.getVisibility())) {
                 publicConfigsList.add(name);
             }
 
-            if (configs[i].getDescription() != null) {
+            if (config.getDescription() != null) {
                 getProject().setProperty(property + ".configuration." + name + ".desc",
-                    configs[i].getDescription());
+                    config.getDescription());
             }
         }
-        String[] publicConfigs = (String[]) publicConfigsList.toArray(new String[publicConfigsList
-                .size()]);
+        String[] publicConfigs = publicConfigsList.toArray(new String[publicConfigsList.size()]);
         getProject().setProperty(property + ".public.configurations", mergeConfs(publicConfigs));
 
-        Artifact[] artifacts = md.getAllArtifacts();
-        for (int i = 0; i < artifacts.length; i++) {
-            int id = i + 1;
-            getProject()
-                    .setProperty(property + ".artifact." + id + ".name", artifacts[i].getName());
-            getProject()
-                    .setProperty(property + ".artifact." + id + ".type", artifacts[i].getType());
-            getProject().setProperty(property + ".artifact." + id + ".ext", artifacts[i].getExt());
+        List<Artifact> artifacts = Arrays.asList(md.getAllArtifacts());
+        for (Artifact artifact : artifacts) {
+            int id = artifacts.indexOf(artifact) + 1;
+            getProject().setProperty(property + ".artifact." + id + ".name", artifact.getName());
+            getProject().setProperty(property + ".artifact." + id + ".type", artifact.getType());
+            getProject().setProperty(property + ".artifact." + id + ".ext", artifact.getExt());
             getProject().setProperty(property + ".artifact." + id + ".conf",
-                mergeConfs(artifacts[i].getConfigurations()));
+                mergeConfs(artifact.getConfigurations()));
 
-            Map artiExtra = artifacts[i].getExtraAttributes();
-            for (Iterator iter = artiExtra.entrySet().iterator(); iter.hasNext();) {
-                Entry entry = (Entry) iter.next();
+            Map<String, String> artiExtra = artifact.getExtraAttributes();
+            for (Map.Entry<String, String> entry : artiExtra.entrySet()) {
                 getProject().setProperty(property + ".artifact." + id + ".extra." + entry.getKey(),
-                    (String) entry.getValue());
+                    entry.getValue());
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/src/java/org/apache/ivy/ant/IvyListModules.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyListModules.java b/src/java/org/apache/ivy/ant/IvyListModules.java
index a516571..30975bb 100644
--- a/src/java/org/apache/ivy/ant/IvyListModules.java
+++ b/src/java/org/apache/ivy/ant/IvyListModules.java
@@ -149,9 +149,9 @@ public class IvyListModules extends IvyTask {
                 patternMatcher);
         }
 
-        for (int i = 0; i < mrids.length; i++) {
-            String name = IvyPatternHelper.substitute(settings.substitute(property), mrids[i]);
-            String value = IvyPatternHelper.substitute(settings.substitute(this.value), mrids[i]);
+        for (ModuleRevisionId mrid : mrids) {
+            String name = IvyPatternHelper.substitute(settings.substitute(property), mrid);
+            String value = IvyPatternHelper.substitute(settings.substitute(this.value), mrid);
             getProject().setProperty(name, value);
         }
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/src/java/org/apache/ivy/ant/IvyMakePom.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyMakePom.java b/src/java/org/apache/ivy/ant/IvyMakePom.java
index 395a4ad..892b8f2 100644
--- a/src/java/org/apache/ivy/ant/IvyMakePom.java
+++ b/src/java/org/apache/ivy/ant/IvyMakePom.java
@@ -151,9 +151,9 @@ public class IvyMakePom extends IvyTask {
 
     private String description;
 
-    private List<Mapping> mappings = new ArrayList<Mapping>();
+    private List<Mapping> mappings = new ArrayList<>();
 
-    private List<Dependency> dependencies = new ArrayList<Dependency>();
+    private List<Dependency> dependencies = new ArrayList<>();
 
     public File getPomFile() {
         return pomFile;
@@ -282,12 +282,11 @@ public class IvyMakePom extends IvyTask {
     }
 
     private Map<String, String> getMappingsMap() {
-        Map<String, String> mappingsMap = new LinkedHashMap<String, String>();
+        Map<String, String> mappingsMap = new LinkedHashMap<>();
         for (Mapping mapping : mappings) {
-            String[] mappingConfs = splitConfs(mapping.getConf());
-            for (int i = 0; i < mappingConfs.length; i++) {
-                if (!mappingsMap.containsKey(mappingConfs[i])) {
-                    mappingsMap.put(mappingConfs[i], mapping.getScope());
+            for (String mappingConf : splitConfs(mapping.getConf())) {
+                if (!mappingsMap.containsKey(mappingConf)) {
+                    mappingsMap.put(mappingConf, mapping.getScope());
                 }
             }
         }
@@ -295,7 +294,7 @@ public class IvyMakePom extends IvyTask {
     }
 
     private List<ExtraDependency> getDependencies() {
-        List<ExtraDependency> result = new ArrayList<ExtraDependency>();
+        List<ExtraDependency> result = new ArrayList<>();
         for (Dependency dependency : dependencies) {
             result.add(new ExtraDependency(dependency.getGroup(), dependency.getArtifact(),
                     dependency.getVersion(), dependency.getScope(), dependency.getType(),

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/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 757b724..bcca68c 100644
--- a/src/java/org/apache/ivy/ant/IvyPostResolveTask.java
+++ b/src/java/org/apache/ivy/ant/IvyPostResolveTask.java
@@ -20,7 +20,6 @@ package org.apache.ivy.ant;
 import java.io.File;
 import java.util.Arrays;
 import java.util.HashSet;
-import java.util.Iterator;
 
 import org.apache.ivy.Ivy;
 import org.apache.ivy.core.cache.ResolutionCacheManager;
@@ -212,12 +211,9 @@ public abstract class IvyPostResolveTask extends IvyTask {
     protected void ensureResolved(IvySettings settings) {
         String requestedConfigs = getProperty(getConf(), settings, "ivy.resolved.configurations");
 
-        String[] confs = null;
-        if (getResolveId() != null) {
-            confs = getConfsToResolve(getResolveId(), requestedConfigs);
-        } else {
-            confs = getConfsToResolve(getOrganisation(), getModule(), requestedConfigs, false);
-        }
+        String[] confs = (getResolveId() == null)
+                ? getConfsToResolve(getOrganisation(), getModule(), requestedConfigs, false)
+                : getConfsToResolve(getResolveId(), requestedConfigs);
 
         if (confs.length > 0) {
             IvyResolve resolve = setupResolve(isHaltonfailure(), isUseOrigin());
@@ -230,13 +226,13 @@ public abstract class IvyPostResolveTask extends IvyTask {
     }
 
     protected String[] getConfsToResolve(String org, String module, String conf, boolean strict) {
-        ModuleDescriptor reference = (ModuleDescriptor) getResolvedDescriptor(org, module, strict);
+        ModuleDescriptor reference = getResolvedDescriptor(org, module, strict);
         String[] rconfs = getResolvedConfigurations(org, module, strict);
         return getConfsToResolve(reference, conf, rconfs);
     }
 
     protected String[] getConfsToResolve(String resolveId, String conf) {
-        ModuleDescriptor reference = (ModuleDescriptor) getResolvedDescriptor(resolveId, false);
+        ModuleDescriptor reference = getResolvedDescriptor(resolveId, false);
         if (reference == null) {
             // assume the module has been resolved outside this build, resolve the required
             // configurations again
@@ -247,8 +243,7 @@ public abstract class IvyPostResolveTask extends IvyTask {
                 return splitConfs(conf);
             }
         }
-        String[] rconfs = (String[]) getProject().getReference(
-            "ivy.resolved.configurations.ref." + resolveId);
+        String[] rconfs = getProject().getReference("ivy.resolved.configurations.ref." + resolveId);
         return getConfsToResolve(reference, conf, rconfs);
     }
 
@@ -270,29 +265,28 @@ public abstract class IvyPostResolveTask extends IvyTask {
                 confs = splitConfs(conf);
             }
 
-            HashSet rconfsSet = new HashSet(Arrays.asList(rconfs));
+            HashSet<String> rconfsSet = new HashSet<>();
 
             // for each resolved configuration, check if the report still exists
             ResolutionCacheManager cache = getSettings().getResolutionCacheManager();
-            for (Iterator it = rconfsSet.iterator(); it.hasNext();) {
-                String resolvedConf = (String) it.next();
+            for (String resolvedConf : rconfs) {
                 String resolveId = getResolveId();
                 if (resolveId == null) {
                     resolveId = ResolveOptions.getDefaultResolveId(reference);
                 }
                 File report = cache.getConfigurationResolveReportInCache(resolveId, resolvedConf);
-                if (!report.exists()) {
-                    // the report doesn't exist any longer, we have to recreate it...
-                    it.remove();
+                // if the report does not exist any longer, we have to recreate it...
+                if (report.exists()) {
+                    rconfsSet.add(resolvedConf);
                 }
             }
 
-            HashSet confsSet = new HashSet(Arrays.asList(confs));
+            HashSet<String> confsSet = new HashSet<>(Arrays.asList(confs));
             Message.debug("resolved configurations:   " + rconfsSet);
             Message.debug("asked configurations:      " + confsSet);
             confsSet.removeAll(rconfsSet);
             Message.debug("to resolve configurations: " + confsSet);
-            return (String[]) confsSet.toArray(new String[confsSet.size()]);
+            return confsSet.toArray(new String[confsSet.size()]);
         } else {
             Message.debug("module already resolved, no configuration to resolve");
             return new String[0];

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/src/java/org/apache/ivy/ant/IvyPublish.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyPublish.java b/src/java/org/apache/ivy/ant/IvyPublish.java
index 9795231..4815b30 100644
--- a/src/java/org/apache/ivy/ant/IvyPublish.java
+++ b/src/java/org/apache/ivy/ant/IvyPublish.java
@@ -61,7 +61,7 @@ public class IvyPublish extends IvyTask {
 
     private String publishResolverName = null;
 
-    private List<String> artifactspattern = new ArrayList<String>();
+    private List<String> artifactspattern = new ArrayList<>();
 
     private File deliveryList;
 
@@ -81,7 +81,7 @@ public class IvyPublish extends IvyTask {
 
     private boolean forcedeliver;
 
-    private Collection<Artifact> artifacts = new ArrayList<Artifact>();
+    private Collection<Artifact> artifacts = new ArrayList<>();
 
     private String pubBranch;
 
@@ -391,7 +391,7 @@ public class IvyPublish extends IvyTask {
 
         private String type;
 
-        private Map<String, String> extra = new HashMap<String, String>();
+        private Map<String, String> extra = new HashMap<>();
 
         public String[] getConfigurations() {
             return null;

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/src/java/org/apache/ivy/ant/IvyReport.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyReport.java b/src/java/org/apache/ivy/ant/IvyReport.java
index 6ac9d09..b4d4112 100644
--- a/src/java/org/apache/ivy/ant/IvyReport.java
+++ b/src/java/org/apache/ivy/ant/IvyReport.java
@@ -27,7 +27,6 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.text.ParseException;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 import javax.xml.transform.Source;
@@ -79,7 +78,7 @@ public class IvyReport extends IvyTask {
 
     private String xslext = "html";
 
-    private List params = new ArrayList();
+    private final List<XSLTProcess.Param> params = new ArrayList<>();
 
     private String resolveId;
 
@@ -223,14 +222,14 @@ public class IvyReport extends IvyTask {
 
     private void genxml(String[] confs) throws IOException {
         ResolutionCacheManager cacheMgr = getIvyInstance().getResolutionCacheManager();
-        for (int i = 0; i < confs.length; i++) {
-            File xml = cacheMgr.getConfigurationResolveReportInCache(resolveId, confs[i]);
+        for (String config : confs) {
+            File xml = cacheMgr.getConfigurationResolveReportInCache(resolveId, config);
 
             File out;
             if (todir != null) {
-                out = new File(todir, getOutputPattern(confs[i], "xml"));
+                out = new File(todir, getOutputPattern(config, "xml"));
             } else {
-                out = getProject().resolveFile(getOutputPattern(confs[i], "xml"));
+                out = getProject().resolveFile(getOutputPattern(config, "xml"));
             }
 
             FileUtil.copy(xml, out, null);
@@ -322,16 +321,14 @@ public class IvyReport extends IvyTask {
             transformer.setParameter("extension", xslext);
 
             // add the provided XSLT parameters
-            for (Iterator it = params.iterator(); it.hasNext();) {
-                XSLTProcess.Param param = (XSLTProcess.Param) it.next();
+            for (XSLTProcess.Param param : params) {
                 transformer.setParameter(param.getName(), param.getExpression());
             }
 
             // create the report
-            for (int i = 0; i < confs.length; i++) {
-                File reportFile = cacheMgr
-                        .getConfigurationResolveReportInCache(resolveId, confs[i]);
-                File outFile = new File(out, getOutputPattern(confs[i], ext));
+            for (String config : confs) {
+                File reportFile = cacheMgr.getConfigurationResolveReportInCache(resolveId, config);
+                File outFile = new File(out, getOutputPattern(config, ext));
 
                 log("Processing " + reportFile + " to " + outFile);
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/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 86efbf8..da27edd 100644
--- a/src/java/org/apache/ivy/ant/IvyRepositoryReport.java
+++ b/src/java/org/apache/ivy/ant/IvyRepositoryReport.java
@@ -21,7 +21,6 @@ import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
@@ -71,7 +70,7 @@ public class IvyRepositoryReport extends IvyTask {
 
     private String xslext = "html";
 
-    private List params = new ArrayList();
+    private final List<XSLTProcess.Param> params = new ArrayList<>();
 
     public void doExecute() throws BuildException {
         Ivy ivy = getIvyInstance();
@@ -86,27 +85,22 @@ public class IvyRepositoryReport extends IvyTask {
         } else if (module == null && !PatternMatcher.EXACT.equals(matcher)) {
             module = PatternMatcher.ANY_EXPRESSION;
         }
-        ModuleRevisionId mrid = ModuleRevisionId.newInstance(organisation, module, revision);
+        ModuleRevisionId moduleRevisionId = ModuleRevisionId.newInstance(organisation, module, revision);
 
         try {
-            ModuleRevisionId criteria = null;
-
-            if ((revision == null) || settings.getVersionMatcher().isDynamic(mrid)) {
-                criteria = new ModuleRevisionId(new ModuleId(organisation, module), branch, "*");
-            } else {
-                criteria = new ModuleRevisionId(new ModuleId(organisation, module), branch,
-                        revision);
-            }
+            ModuleRevisionId criteria = (revision == null) || settings.getVersionMatcher().isDynamic(moduleRevisionId)
+                    ? new ModuleRevisionId(new ModuleId(organisation, module), branch, "*")
+                    : new ModuleRevisionId(new ModuleId(organisation, module), branch, revision);
 
             ModuleRevisionId[] mrids = ivy.listModules(criteria, settings.getMatcher(matcher));
 
             // replace all found revisions with the original requested revision
-            Set modules = new HashSet();
-            for (int i = 0; i < mrids.length; i++) {
-                modules.add(ModuleRevisionId.newInstance(mrids[i], revision));
+            Set<ModuleRevisionId> modules = new HashSet<>();
+            for (ModuleRevisionId mrid : mrids) {
+                modules.add(ModuleRevisionId.newInstance(mrid, revision));
             }
 
-            mrids = (ModuleRevisionId[]) modules.toArray(new ModuleRevisionId[modules.size()]);
+            mrids = modules.toArray(new ModuleRevisionId[modules.size()]);
             ModuleDescriptor md = DefaultModuleDescriptor.newCallerInstance(mrids, true, false);
             String resolveId = ResolveOptions.getDefaultResolveId(md);
             ResolveReport report = ivy.resolve(md, new ResolveOptions().setResolveId(resolveId)
@@ -115,24 +109,23 @@ public class IvyRepositoryReport extends IvyTask {
             ResolutionCacheManager cacheMgr = getIvyInstance().getResolutionCacheManager();
             new XmlReportOutputter().output(report, cacheMgr, new ResolveOptions());
             if (graph) {
-                gengraph(cacheMgr, md.getModuleRevisionId().getOrganisation(), md
-                        .getModuleRevisionId().getName());
+                gengraph(cacheMgr, md.getModuleRevisionId().getOrganisation(),
+                        md.getModuleRevisionId().getName());
             }
             if (dot) {
-                gendot(cacheMgr, md.getModuleRevisionId().getOrganisation(), md
-                        .getModuleRevisionId().getName());
+                gendot(cacheMgr, md.getModuleRevisionId().getOrganisation(),
+                        md.getModuleRevisionId().getName());
             }
             if (xml) {
-
                 FileUtil.copy(cacheMgr.getConfigurationResolveReportInCache(resolveId, "default"),
                     new File(getTodir(), outputname + ".xml"), null);
             }
             if (xsl) {
-                genreport(cacheMgr, md.getModuleRevisionId().getOrganisation(), md
-                        .getModuleRevisionId().getName());
+                genreport(cacheMgr, md.getModuleRevisionId().getOrganisation(),
+                        md.getModuleRevisionId().getName());
             }
         } catch (Exception e) {
-            throw new BuildException("impossible to generate graph for " + mrid + ": " + e, e);
+            throw new BuildException("impossible to generate graph for " + moduleRevisionId + ": " + e, e);
         }
     }
 
@@ -150,13 +143,12 @@ public class IvyRepositoryReport extends IvyTask {
 
         xslt.setStyle(xslFile);
 
-        XSLTProcess.Param param = xslt.createParam();
-        param.setName("extension");
-        param.setExpression(xslext);
+        XSLTProcess.Param xslExt = xslt.createParam();
+        xslExt.setName("extension");
+        xslExt.setExpression(xslext);
 
         // add the provided XSLT parameters
-        for (Iterator it = params.iterator(); it.hasNext();) {
-            param = (XSLTProcess.Param) it.next();
+        for (XSLTProcess.Param param : params) {
             XSLTProcess.Param realParam = xslt.createParam();
             realParam.setName(param.getName());
             realParam.setExpression(param.getExpression());

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/9235380f/src/java/org/apache/ivy/ant/IvyResolve.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/ant/IvyResolve.java b/src/java/org/apache/ivy/ant/IvyResolve.java
index 8e42f71..92513d8 100644
--- a/src/java/org/apache/ivy/ant/IvyResolve.java
+++ b/src/java/org/apache/ivy/ant/IvyResolve.java
@@ -90,11 +90,11 @@ public class IvyResolve extends IvyTask {
 
     private boolean checkIfChanged = true; // for backward compatibility
 
-    private List<IvyDependency> dependencies = new ArrayList<IvyDependency>();
+    private List<IvyDependency> dependencies = new ArrayList<>();
 
-    private List<IvyExclude> excludes = new ArrayList<IvyExclude>();
+    private List<IvyExclude> excludes = new ArrayList<>();
 
-    private List<IvyConflict> conflicts = new ArrayList<IvyConflict>();
+    private List<IvyConflict> conflicts = new ArrayList<>();
 
     public boolean isUseOrigin() {
         return useOrigin;


Mime
View raw message