Generics and Java 7 syntax in plugins package

This closes github.com/apache/ant-ivy PR #48


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

Branch: refs/heads/master
Commit: d9665bfc1819077c7a41d0c132a27ba4b08d94ea
Parents: 0c0ee35
Author: twogee <[email protected]>
Authored: Thu Jun 29 14:36:29 2017 +0200
Committer: Jaikiran Pai <[email protected]>
Committed: Sat Jul 1 20:15:29 2017 +0530

----------------------------------------------------------------------
 .../AbstractLogCircularDependencyStrategy.java  |   2 +-
 .../circular/CircularDependencyHelper.java      |  22 ++-
 .../plugins/conflict/FixedConflictManager.java  |   2 +-
 .../LatestCompatibleConflictManager.java        |  18 +--
 .../plugins/conflict/LatestConflictManager.java |   4 +-
 .../latest/ComparatorLatestStrategy.java        |   2 +-
 .../plugins/latest/LatestRevisionStrategy.java  |  10 +-
 .../ivy/plugins/latest/LatestTimeStrategy.java  |   4 +-
 .../plugins/latest/WorkspaceLatestStrategy.java |   4 +-
 .../ivy/plugins/lock/DeleteOnExitHook.java      |   6 +-
 .../ivy/plugins/lock/FileBasedLockStrategy.java |  44 +++---
 .../ivy/plugins/matcher/GlobPatternMatcher.java |   3 +-
 .../apache/ivy/plugins/matcher/MapMatcher.java  |   2 +-
 .../plugins/matcher/RegexpPatternMatcher.java   |   3 +-
 .../namespace/MRIDTransformationRule.java       |  14 +-
 .../apache/ivy/plugins/namespace/Namespace.java |   9 +-
 .../parser/AbstractModuleDescriptorParser.java  |  71 ++++-----
 .../parser/ModuleDescriptorParserRegistry.java  |   2 +-
 .../parser/m2/DefaultPomDependencyMgt.java      |   8 +-
 .../parser/m2/PomModuleDescriptorBuilder.java   |  45 +++---
 .../parser/m2/PomModuleDescriptorWriter.java    |  73 +++++----
 .../apache/ivy/plugins/parser/m2/PomReader.java |  18 +--
 .../ivy/plugins/parser/m2/PomWriterOptions.java |  10 +-
 .../ivy/plugins/parser/xml/UpdateOptions.java   |  13 +-
 .../parser/xml/XmlModuleDescriptorParser.java   | 104 +++++-------
 .../parser/xml/XmlModuleDescriptorUpdater.java  | 134 ++++++++--------
 .../parser/xml/XmlModuleDescriptorWriter.java   | 136 +++++++---------
 .../ivy/plugins/report/LogReportOutputter.java  |  46 +++---
 .../ivy/plugins/report/XmlReportOutputter.java  |   4 +-
 .../ivy/plugins/report/XmlReportParser.java     |  25 ++-
 .../ivy/plugins/report/XmlReportWriter.java     | 157 ++++++++-----------
 .../RepositoryCopyProgressListener.java         |   2 +-
 .../plugins/repository/file/FileRepository.java |  15 +-
 .../plugins/repository/jar/JarRepository.java   |  19 ++-
 .../plugins/repository/sftp/SFTPRepository.java |  84 +++-------
 .../ssh/AbstractSshBasedRepository.java         |   4 +-
 .../apache/ivy/plugins/repository/ssh/Scp.java  |  21 ++-
 .../ivy/plugins/repository/ssh/SshCache.java    |  16 +-
 .../plugins/repository/ssh/SshRepository.java   |  29 ++--
 .../repository/url/ChainedRepository.java       |  21 +--
 .../plugins/repository/url/URLRepository.java   |  38 ++---
 .../plugins/repository/vfs/VfsRepository.java   |  17 +-
 .../repository/vsftp/VsftpRepository.java       |   4 +-
 .../resolver/AbstractPatternsBasedResolver.java |  34 ++--
 .../ivy/plugins/resolver/AbstractResolver.java  |   2 +-
 .../resolver/AbstractWorkspaceResolver.java     | 113 ++++++-------
 .../ivy/plugins/resolver/BasicResolver.java     |  28 ++--
 .../ivy/plugins/resolver/CacheResolver.java     |  18 +--
 .../ivy/plugins/resolver/ChainResolver.java     |  29 ++--
 .../ivy/plugins/resolver/DualResolver.java      |   2 +-
 .../plugins/resolver/FileSystemResolver.java    |   2 +-
 .../ivy/plugins/resolver/IBiblioResolver.java   |  15 +-
 .../ivy/plugins/resolver/IvyRepResolver.java    |   4 +-
 .../plugins/resolver/MirroredURLResolver.java   |  11 +-
 .../plugins/resolver/RepositoryResolver.java    |  23 ++-
 .../ivy/plugins/resolver/VfsResolver.java       |   2 +-
 .../resolver/packager/PackagerCacheEntry.java   |   9 +-
 .../resolver/packager/PackagerResolver.java     |  12 +-
 .../plugins/resolver/util/FileURLLister.java    |   6 +-
 .../plugins/resolver/util/ResolverHelper.java   |  18 +--
 .../bouncycastle/OpenPGPSignatureGenerator.java |   6 +-
 .../plugins/version/AbstractVersionMatcher.java |   2 +-
 .../plugins/version/ChainVersionMatcher.java    |  27 ++--
 .../plugins/version/LatestVersionMatcher.java   |   2 +-
 .../org/apache/ivy/plugins/version/Match.java   |   6 +-
 .../plugins/version/PatternVersionMatcher.java  |  22 +--
 .../ivy/plugins/version/SubVersionMatcher.java  |   2 +-
 .../ivy/plugins/version/VersionMatcher.java     |  14 +-
 .../plugins/version/VersionRangeMatcher.java    |  14 +-
 69 files changed, 745 insertions(+), 943 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/src/java/org/apache/ivy/plugins/circular/AbstractLogCircularDependencyStrategy.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/ivy/plugins/circular/AbstractLogCircularDependencyStrategy.java
 
b/src/java/org/apache/ivy/plugins/circular/AbstractLogCircularDependencyStrategy.java
index 4d42173..677f412 100644
--- 
a/src/java/org/apache/ivy/plugins/circular/AbstractLogCircularDependencyStrategy.java
+++ 
b/src/java/org/apache/ivy/plugins/circular/AbstractLogCircularDependencyStrategy.java
@@ -32,7 +32,7 @@ public abstract class AbstractLogCircularDependencyStrategy 
extends
         super(name);
     }
 
-    private Collection/* <String> */circularDependencies = new HashSet();
+    private final Collection<String> circularDependencies = new HashSet<>();
 
     public void handleCircularDependency(ModuleRevisionId[] mrids) {
         String circularDependencyId = getCircularDependencyId(mrids);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/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 123dd96..0c99d98 100644
--- a/src/java/org/apache/ivy/plugins/circular/CircularDependencyHelper.java
+++ b/src/java/org/apache/ivy/plugins/circular/CircularDependencyHelper.java
@@ -18,7 +18,6 @@
 package org.apache.ivy.plugins.circular;
 
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
@@ -40,14 +39,14 @@ public final class CircularDependencyHelper {
      * @return a string representation of this circular dependency graph
      */
     public static String formatMessage(final ModuleRevisionId[] mrids) {
-        Set alreadyAdded = new HashSet();
-        StringBuffer buff = new StringBuffer();
-        buff.append(mrids[0]);
-        alreadyAdded.add(mrids[0]);
-        for (int i = 1; i < mrids.length; i++) {
-            buff.append("->");
-            if (alreadyAdded.add(mrids[i])) {
-                buff.append(mrids[i]);
+        Set<ModuleRevisionId> alreadyAdded = new HashSet<>();
+        StringBuilder buff = new StringBuilder();
+        for (ModuleRevisionId mrid : mrids) {
+            if (buff.length() > 0) {
+                buff.append("->");
+            }
+            if (alreadyAdded.add(mrid)) {
+                buff.append(mrid);
             } else {
                 buff.append("...");
                 break;
@@ -65,11 +64,10 @@ public final class CircularDependencyHelper {
      *            a List&lt;ModuleDescriptor&gt;
      * @return String
      */
-    public static String formatMessageFromDescriptors(List loopElements) {
+    public static String formatMessageFromDescriptors(List<ModuleDescriptor> 
loopElements) {
         ModuleRevisionId[] mrids = new ModuleRevisionId[loopElements.size()];
         int pos = 0;
-        for (Iterator it = loopElements.iterator(); it.hasNext();) {
-            ModuleDescriptor descriptor = (ModuleDescriptor) it.next();
+        for (ModuleDescriptor descriptor: loopElements) {
             mrids[pos] = descriptor.getModuleRevisionId();
             pos++;
         }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/src/java/org/apache/ivy/plugins/conflict/FixedConflictManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/conflict/FixedConflictManager.java 
b/src/java/org/apache/ivy/plugins/conflict/FixedConflictManager.java
index b178fb1..44953a7 100644
--- a/src/java/org/apache/ivy/plugins/conflict/FixedConflictManager.java
+++ b/src/java/org/apache/ivy/plugins/conflict/FixedConflictManager.java
@@ -33,7 +33,7 @@ public class FixedConflictManager extends 
AbstractConflictManager {
     }
 
     public Collection<IvyNode> resolveConflicts(IvyNode parent, 
Collection<IvyNode> conflicts) {
-        Collection<IvyNode> resolved = new 
ArrayList<IvyNode>(conflicts.size());
+        Collection<IvyNode> resolved = new ArrayList<>(conflicts.size());
         for (IvyNode node : conflicts) {
             String revision = node.getResolvedId().getRevision();
             if (revisions.contains(revision)) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/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 e7b0ff6..73f4951 100644
--- 
a/src/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManager.java
+++ 
b/src/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManager.java
@@ -103,7 +103,7 @@ public class LatestCompatibleConflictManager extends 
LatestConflictManager {
                 it.next();
                 return Collections.singleton(it.next());
             }
-            Collection<IvyNode> newConflicts = new 
LinkedHashSet<IvyNode>(conflicts);
+            Collection<IvyNode> newConflicts = new LinkedHashSet<>(conflicts);
             newConflicts.remove(node);
             return super.resolveConflicts(parent, newConflicts);
         } else {
@@ -159,7 +159,7 @@ public class LatestCompatibleConflictManager extends 
LatestConflictManager {
         // but returning a boolean make the calling code cleaner
         try {
             IvyNodeArtifactInfo latest = (IvyNodeArtifactInfo) 
getStrategy().findLatest(
-                toArtifactInfo(Arrays.asList(new IvyNode[] {node, other})), 
null);
+                toArtifactInfo(Arrays.asList(node, other)), null);
             if (latest != null) {
                 IvyNode latestNode = latest.getNode();
                 IvyNode oldestNode = latestNode == node ? other : node;
@@ -185,12 +185,12 @@ public class LatestCompatibleConflictManager extends 
LatestConflictManager {
 
     private void 
blackListIncompatibleCallerAndRestartResolveIfPossible(IvySettings settings,
             IvyNode parent, IvyNode selected, IvyNode evicted) {
-        Stack<IvyNode> callerStack = new Stack<IvyNode>();
+        Stack<IvyNode> callerStack = new Stack<>();
         callerStack.push(evicted);
         Collection<IvyNodeBlacklist> toBlacklist = blackListIncompatibleCaller(
             settings.getVersionMatcher(), parent, selected, evicted, 
callerStack);
         if (toBlacklist != null) {
-            final StringBuffer blacklisted = new StringBuffer();
+            final StringBuilder blacklisted = new StringBuilder();
             for (Iterator<IvyNodeBlacklist> iterator = toBlacklist.iterator(); 
iterator.hasNext();) {
                 IvyNodeBlacklist blacklist = iterator.next();
                 blacklist.getBlacklistedNode().blacklist(blacklist);
@@ -255,16 +255,16 @@ public class LatestCompatibleConflictManager extends 
LatestConflictManager {
     private Collection<IvyNodeBlacklist> 
blackListIncompatibleCaller(VersionMatcher versionMatcher,
             IvyNode conflictParent, IvyNode selectedNode, IvyNode evictedNode,
             Stack<IvyNode> callerStack) {
-        Collection<IvyNodeBlacklist> blacklisted = new 
ArrayList<IvyNodeBlacklist>();
+        Collection<IvyNodeBlacklist> blacklisted = new ArrayList<>();
         IvyNode node = callerStack.peek();
         String rootModuleConf = 
conflictParent.getData().getReport().getConfiguration();
         Caller[] callers = node.getCallers(rootModuleConf);
-        for (int i = 0; i < callers.length; i++) {
-            IvyNode callerNode = 
node.findNode(callers[i].getModuleRevisionId());
+        for (Caller caller : callers) {
+            IvyNode callerNode = node.findNode(caller.getModuleRevisionId());
             if (callerNode.isBlacklisted(rootModuleConf)) {
                 continue;
             }
-            if 
(versionMatcher.isDynamic(callers[i].getAskedDependencyId(node.getData()))) {
+            if 
(versionMatcher.isDynamic(caller.getAskedDependencyId(node.getData()))) {
                 blacklisted.add(new IvyNodeBlacklist(conflictParent, 
selectedNode, evictedNode,
                         node, rootModuleConf));
                 if (node.isEvicted(rootModuleConf)
@@ -292,7 +292,7 @@ public class LatestCompatibleConflictManager extends 
LatestConflictManager {
     public void handleAllBlacklistedRevisions(DependencyDescriptor dd,
             Collection<ModuleRevisionId> foundBlacklisted) {
         ResolveData resolveData = IvyContext.getContext().getResolveData();
-        Collection<IvyNode> blacklisted = new HashSet<IvyNode>();
+        Collection<IvyNode> blacklisted = new HashSet<>();
         for (ModuleRevisionId mrid : foundBlacklisted) {
             blacklisted.add(resolveData.getNode(mrid));
         }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/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 04db4c8..2237acf 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<IvyNode>();
+        ArrayList<IvyNode> unevicted = new ArrayList<>();
         for (IvyNode node : conflicts) {
             if (!node.isCompletelyEvicted()) {
                 unevicted.add(node);
@@ -127,7 +127,7 @@ public class LatestConflictManager extends 
AbstractConflictManager {
     }
 
     protected ArtifactInfo[] toArtifactInfo(Collection<IvyNode> conflicts) {
-        List<ArtifactInfo> artifacts = new 
ArrayList<ArtifactInfo>(conflicts.size());
+        List<ArtifactInfo> artifacts = new ArrayList<>(conflicts.size());
         for (IvyNode node : conflicts) {
             artifacts.add(new IvyNodeArtifactInfo(node));
         }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/src/java/org/apache/ivy/plugins/latest/ComparatorLatestStrategy.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/ivy/plugins/latest/ComparatorLatestStrategy.java 
b/src/java/org/apache/ivy/plugins/latest/ComparatorLatestStrategy.java
index 4adc5a3..87a94f0 100644
--- a/src/java/org/apache/ivy/plugins/latest/ComparatorLatestStrategy.java
+++ b/src/java/org/apache/ivy/plugins/latest/ComparatorLatestStrategy.java
@@ -35,7 +35,7 @@ public class ComparatorLatestStrategy extends 
AbstractLatestStrategy {
     }
 
     public List<ArtifactInfo> sort(ArtifactInfo[] infos) {
-        List<ArtifactInfo> ret = new 
ArrayList<ArtifactInfo>(Arrays.asList(infos));
+        List<ArtifactInfo> ret = new ArrayList<>(Arrays.asList(infos));
         Collections.sort(ret, comparator);
         return ret;
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/src/java/org/apache/ivy/plugins/latest/LatestRevisionStrategy.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/latest/LatestRevisionStrategy.java 
b/src/java/org/apache/ivy/plugins/latest/LatestRevisionStrategy.java
index 7fc3293..8398868 100644
--- a/src/java/org/apache/ivy/plugins/latest/LatestRevisionStrategy.java
+++ b/src/java/org/apache/ivy/plugins/latest/LatestRevisionStrategy.java
@@ -154,10 +154,10 @@ public class LatestRevisionStrategy extends 
ComparatorLatestStrategy {
 
     private static final Map<String, Integer> DEFAULT_SPECIAL_MEANINGS;
     static {
-        DEFAULT_SPECIAL_MEANINGS = new HashMap<String, Integer>();
-        DEFAULT_SPECIAL_MEANINGS.put("dev", new Integer(-1));
-        DEFAULT_SPECIAL_MEANINGS.put("rc", new Integer(1));
-        DEFAULT_SPECIAL_MEANINGS.put("final", new Integer(2));
+        DEFAULT_SPECIAL_MEANINGS = new HashMap<>();
+        DEFAULT_SPECIAL_MEANINGS.put("dev", -1);
+        DEFAULT_SPECIAL_MEANINGS.put("rc", 1);
+        DEFAULT_SPECIAL_MEANINGS.put("final", 2);
     }
 
     private final Comparator<ModuleRevisionId> mridComparator = new 
MridComparator();
@@ -180,7 +180,7 @@ public class LatestRevisionStrategy extends 
ComparatorLatestStrategy {
 
     public synchronized Map<String, Integer> getSpecialMeanings() {
         if (specialMeanings == null) {
-            specialMeanings = new HashMap<String, Integer>();
+            specialMeanings = new HashMap<>();
             if (isUsedefaultspecialmeanings()) {
                 specialMeanings.putAll(DEFAULT_SPECIAL_MEANINGS);
             }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/src/java/org/apache/ivy/plugins/latest/LatestTimeStrategy.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/latest/LatestTimeStrategy.java 
b/src/java/org/apache/ivy/plugins/latest/LatestTimeStrategy.java
index 7ae7b6c..a8ace2c 100644
--- a/src/java/org/apache/ivy/plugins/latest/LatestTimeStrategy.java
+++ b/src/java/org/apache/ivy/plugins/latest/LatestTimeStrategy.java
@@ -22,9 +22,7 @@ import java.util.Comparator;
 public class LatestTimeStrategy extends ComparatorLatestStrategy {
     private static final Comparator<ArtifactInfo> COMPARATOR = new 
Comparator<ArtifactInfo>() {
         public int compare(ArtifactInfo o1, ArtifactInfo o2) {
-            long d1 = o1.getLastModified();
-            long d2 = o2.getLastModified();
-            return new Long(d1).compareTo(new Long(d2));
+            return Long.compare(o1.getLastModified(), o2.getLastModified());
         }
 
     };

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/src/java/org/apache/ivy/plugins/latest/WorkspaceLatestStrategy.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/ivy/plugins/latest/WorkspaceLatestStrategy.java 
b/src/java/org/apache/ivy/plugins/latest/WorkspaceLatestStrategy.java
index 97ab192..61ef1f7 100644
--- a/src/java/org/apache/ivy/plugins/latest/WorkspaceLatestStrategy.java
+++ b/src/java/org/apache/ivy/plugins/latest/WorkspaceLatestStrategy.java
@@ -37,8 +37,8 @@ public class WorkspaceLatestStrategy extends 
AbstractLatestStrategy {
     public List<ArtifactInfo> sort(ArtifactInfo[] infos) {
         List<ArtifactInfo> sorted = delegate.sort(infos);
 
-        List<ArtifactInfo> head = new ArrayList<ArtifactInfo>();
-        List<ArtifactInfo> tail = new ArrayList<ArtifactInfo>();
+        List<ArtifactInfo> head = new ArrayList<>();
+        List<ArtifactInfo> tail = new ArrayList<>();
 
         for (ArtifactInfo ai : sorted) {
             String rev = ai.getRevision();

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/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 ea3fe40..c77d536 100644
--- a/src/java/org/apache/ivy/plugins/lock/DeleteOnExitHook.java
+++ b/src/java/org/apache/ivy/plugins/lock/DeleteOnExitHook.java
@@ -31,7 +31,7 @@ final class DeleteOnExitHook {
         });
     }
 
-    private static LinkedHashSet files = new LinkedHashSet();
+    private static final LinkedHashSet<File> files = new LinkedHashSet<>();
 
     private DeleteOnExitHook() {
     }
@@ -45,9 +45,9 @@ final class DeleteOnExitHook {
     }
 
     static synchronized void runHook() {
-        Iterator itr = files.iterator();
+        Iterator<File> itr = files.iterator();
         while (itr.hasNext()) {
-            ((File) itr.next()).delete();
+            itr.next().delete();
             itr.remove();
         }
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/src/java/org/apache/ivy/plugins/lock/FileBasedLockStrategy.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/lock/FileBasedLockStrategy.java 
b/src/java/org/apache/ivy/plugins/lock/FileBasedLockStrategy.java
index 142898c..2e31b2f 100644
--- a/src/java/org/apache/ivy/plugins/lock/FileBasedLockStrategy.java
+++ b/src/java/org/apache/ivy/plugins/lock/FileBasedLockStrategy.java
@@ -21,8 +21,6 @@ import java.io.File;
 import java.io.IOException;
 import java.io.RandomAccessFile;
 import java.nio.channels.FileLock;
-import java.util.Enumeration;
-import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
@@ -44,7 +42,7 @@ public abstract class FileBasedLockStrategy extends 
AbstractLockStrategy {
      * Lock counter list must be static: locks are implicitly shared to the 
entire process, so the
      * list too much be.
      */
-    private static ConcurrentMap/* <File, Map<Thread, Integer>> 
*/currentLockHolders = new ConcurrentHashMap();
+    private static ConcurrentMap<File, ConcurrentMap<Thread, Integer>> 
currentLockHolders = new ConcurrentHashMap<>();
 
     protected FileBasedLockStrategy() {
         this(new CreateFileLocker(false), false);
@@ -151,15 +149,15 @@ public abstract class FileBasedLockStrategy extends 
AbstractLockStrategy {
      *            thread for which lock status is being queried
      */
     private int hasLock(File file, Thread forThread) {
-        Map locksPerThread = (Map) currentLockHolders.get(file);
+        ConcurrentMap<Thread, Integer> locksPerThread = 
currentLockHolders.get(file);
         if (locksPerThread == null) {
             return 0;
         }
         if (locksPerThread.isEmpty()) {
             return 0;
         }
-        Integer counterObj = (Integer) locksPerThread.get(forThread);
-        int counter = counterObj == null ? 0 : counterObj.intValue();
+        Integer counterObj = locksPerThread.get(forThread);
+        int counter = (counterObj == null) ? 0 : counterObj;
         if (counter > 0) {
             return counter;
         } else {
@@ -180,14 +178,14 @@ public abstract class FileBasedLockStrategy extends 
AbstractLockStrategy {
      * @return number of times this thread has grabbed the lock
      */
     private int incrementLock(File file, Thread forThread) {
-        Map locksPerThread = (Map) currentLockHolders.get(file);
+        ConcurrentMap<Thread, Integer> locksPerThread = 
currentLockHolders.get(file);
         if (locksPerThread == null) {
-            locksPerThread = new ConcurrentHashMap();
+            locksPerThread = new ConcurrentHashMap<>();
             currentLockHolders.put(file, locksPerThread);
         }
-        Integer c = (Integer) locksPerThread.get(forThread);
-        int holdLocks = c == null ? 1 : c.intValue() + 1;
-        locksPerThread.put(forThread, new Integer(holdLocks));
+        Integer c = locksPerThread.get(forThread);
+        int holdLocks = (c == null) ? 1 : c + 1;
+        locksPerThread.put(forThread, holdLocks);
         return holdLocks;
     }
 
@@ -205,18 +203,18 @@ public abstract class FileBasedLockStrategy extends 
AbstractLockStrategy {
      * @return remaining depth of this lock
      */
     private int decrementLock(File file, Thread forThread) {
-        ConcurrentHashMap locksPerThread = (ConcurrentHashMap) 
currentLockHolders.get(file);
+        ConcurrentMap<Thread, Integer> locksPerThread = 
currentLockHolders.get(file);
         if (locksPerThread == null) {
             throw new RuntimeException("Calling decrementLock on a thread 
which holds no locks");
         }
-        Integer c = (Integer) locksPerThread.get(forThread);
-        int oldHeldLocks = c == null ? 0 : c.intValue();
+        Integer c = locksPerThread.get(forThread);
+        int oldHeldLocks = (c == null) ? 0 : c;
         if (oldHeldLocks <= 0) {
             throw new RuntimeException("Calling decrementLock on a thread 
which holds no locks");
         }
         int newHeldLocks = oldHeldLocks - 1;
         if (newHeldLocks > 0) {
-            locksPerThread.put(forThread, new Integer(newHeldLocks));
+            locksPerThread.put(forThread, newHeldLocks);
         } else {
             locksPerThread.remove(forThread);
         }
@@ -231,22 +229,20 @@ public abstract class FileBasedLockStrategy extends 
AbstractLockStrategy {
      */
     protected String getCurrentLockHolderNames(File file) {
         StringBuilder sb = new StringBuilder();
-        ConcurrentHashMap m = (ConcurrentHashMap) currentLockHolders.get(file);
+        ConcurrentMap<Thread, Integer> m = currentLockHolders.get(file);
         if (m == null) {
             return "(NULL)";
         }
-        Enumeration threads = m.keys();
-        while (threads.hasMoreElements()) {
-            Thread t = (Thread) threads.nextElement();
-            sb.append(t.toString());
-            if (threads.hasMoreElements()) {
+        for (Thread t : m.keySet()) {
+            if (sb.length() > 0) {
                 sb.append(", ");
             }
+            sb.append(t.toString());
         }
         return sb.toString();
     }
 
-    public static interface FileLocker {
+    public interface FileLocker {
         boolean tryLock(File f);
 
         void unlock(File f);
@@ -294,7 +290,7 @@ public abstract class FileBasedLockStrategy extends 
AbstractLockStrategy {
      */
     public static class NIOFileLocker implements FileLocker {
 
-        private Map locks = new ConcurrentHashMap();
+        private ConcurrentMap<File, LockData> locks = new 
ConcurrentHashMap<>();
 
         private boolean debugLocking;
 
@@ -341,7 +337,7 @@ public abstract class FileBasedLockStrategy extends 
AbstractLockStrategy {
 
         public void unlock(File file) {
             synchronized (this) {
-                LockData data = (LockData) locks.get(file);
+                LockData data = locks.get(file);
                 if (data == null) {
                     throw new IllegalArgumentException("file not previously 
locked: " + file);
                 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/src/java/org/apache/ivy/plugins/matcher/GlobPatternMatcher.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/matcher/GlobPatternMatcher.java 
b/src/java/org/apache/ivy/plugins/matcher/GlobPatternMatcher.java
index 9e9b22a..b49cd20 100644
--- a/src/java/org/apache/ivy/plugins/matcher/GlobPatternMatcher.java
+++ b/src/java/org/apache/ivy/plugins/matcher/GlobPatternMatcher.java
@@ -91,8 +91,7 @@ public/* @Immutable */final class GlobPatternMatcher extends 
AbstractPatternMatc
             Boolean result = Boolean.TRUE;
 
             char[] expressionChars = expression.toCharArray();
-            for (int i = 0; i < expressionChars.length; i++) {
-                char ch = expressionChars[i];
+            for (char ch : expressionChars) {
                 if (ch == '*' || ch == '?' || ch == '[' || ch == ']') {
                     result = Boolean.FALSE;
                     break;

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/src/java/org/apache/ivy/plugins/matcher/MapMatcher.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/matcher/MapMatcher.java 
b/src/java/org/apache/ivy/plugins/matcher/MapMatcher.java
index 540d8f9..e90512e 100644
--- a/src/java/org/apache/ivy/plugins/matcher/MapMatcher.java
+++ b/src/java/org/apache/ivy/plugins/matcher/MapMatcher.java
@@ -23,7 +23,7 @@ import java.util.Map;
 import java.util.Map.Entry;
 
 public class MapMatcher {
-    private Map<String, Matcher> matchers = new HashMap<String, Matcher>();
+    private Map<String, Matcher> matchers = new HashMap<>();
 
     private PatternMatcher pm;
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/src/java/org/apache/ivy/plugins/matcher/RegexpPatternMatcher.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/matcher/RegexpPatternMatcher.java 
b/src/java/org/apache/ivy/plugins/matcher/RegexpPatternMatcher.java
index ce1c706..0e1df11 100644
--- a/src/java/org/apache/ivy/plugins/matcher/RegexpPatternMatcher.java
+++ b/src/java/org/apache/ivy/plugins/matcher/RegexpPatternMatcher.java
@@ -76,8 +76,7 @@ public final/* @Immutable */class RegexpPatternMatcher 
extends AbstractPatternMa
             Boolean result = Boolean.TRUE;
 
             char[] expressionChars = expression.toCharArray();
-            for (int i = 0; i < expressionChars.length; i++) {
-                char ch = expressionChars[i];
+            for (char ch : expressionChars) {
                 if (!Character.isLetterOrDigit(ch) && 
!Character.isWhitespace(ch) && ('-' != ch)
                         && ('_' != ch)) {
                     result = Boolean.FALSE;

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/src/java/org/apache/ivy/plugins/namespace/MRIDTransformationRule.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/ivy/plugins/namespace/MRIDTransformationRule.java 
b/src/java/org/apache/ivy/plugins/namespace/MRIDTransformationRule.java
index 7efe380..cbd19d5 100644
--- a/src/java/org/apache/ivy/plugins/namespace/MRIDTransformationRule.java
+++ b/src/java/org/apache/ivy/plugins/namespace/MRIDTransformationRule.java
@@ -18,7 +18,6 @@
 package org.apache.ivy.plugins.namespace;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -78,13 +77,13 @@ public class MRIDTransformationRule implements 
NamespaceTransformer {
                 return rule;
             }
             String res = rule == null ? "$" + ruleType + "0" : rule;
-            for (int i = 0; i < TYPES.length; i++) {
-                if (TYPES[i].equals(type)) {
+            for (String tp : TYPES) {
+                if (tp.equals(type)) {
                     res = res.replaceAll("([^\\\\])\\$" + type, "$1\\$");
                     res = res.replaceAll("^\\$" + type, "\\$");
                 } else {
-                    res = res.replaceAll("([^\\\\])\\$" + TYPES[i], 
"$1\\\\\\$" + TYPES[i]);
-                    res = res.replaceAll("^\\$" + TYPES[i], "\\\\\\$" + 
TYPES[i]);
+                    res = res.replaceAll("([^\\\\])\\$" + tp, "$1\\\\\\$" + 
tp);
+                    res = res.replaceAll("^\\$" + tp, "\\\\\\$" + tp);
                 }
             }
 
@@ -107,7 +106,7 @@ public class MRIDTransformationRule implements 
NamespaceTransformer {
         }
     }
 
-    private List src = new ArrayList();
+    private final List<MRIDRule> src = new ArrayList<>();
 
     private MRIDRule dest;
 
@@ -124,8 +123,7 @@ public class MRIDTransformationRule implements 
NamespaceTransformer {
 
     public ModuleRevisionId transform(ModuleRevisionId mrid) {
         MridRuleMatcher matcher = new MridRuleMatcher();
-        for (Iterator iter = src.iterator(); iter.hasNext();) {
-            MRIDRule rule = (MRIDRule) iter.next();
+        for (MRIDRule rule : src) {
             if (matcher.match(rule, mrid)) {
                 ModuleRevisionId destMrid = matcher.apply(dest, mrid);
                 Message.debug("found matching namespace rule: " + rule + ". 
Applied " + dest

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/src/java/org/apache/ivy/plugins/namespace/Namespace.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/namespace/Namespace.java 
b/src/java/org/apache/ivy/plugins/namespace/Namespace.java
index 43c61a9..9b2e6e2 100644
--- a/src/java/org/apache/ivy/plugins/namespace/Namespace.java
+++ b/src/java/org/apache/ivy/plugins/namespace/Namespace.java
@@ -18,7 +18,6 @@
 package org.apache.ivy.plugins.namespace;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.ivy.core.module.id.ModuleRevisionId;
@@ -29,7 +28,7 @@ public class Namespace {
         SYSTEM_NAMESPACE = new Namespace();
     }
 
-    private List/* <NamespaceRule> */rules = new ArrayList();
+    private final List<NamespaceRule> rules = new ArrayList<>();
 
     private String name;
 
@@ -40,8 +39,7 @@ public class Namespace {
             if (mrid == null) {
                 return null;
             }
-            for (Iterator iter = rules.iterator(); iter.hasNext();) {
-                NamespaceRule rule = (NamespaceRule) iter.next();
+            for (NamespaceRule rule : rules) {
                 ModuleRevisionId nmrid = rule.getFromSystem().transform(mrid);
                 if (chainRules) {
                     mrid = nmrid;
@@ -62,8 +60,7 @@ public class Namespace {
             if (mrid == null) {
                 return null;
             }
-            for (Iterator iter = rules.iterator(); iter.hasNext();) {
-                NamespaceRule rule = (NamespaceRule) iter.next();
+            for (NamespaceRule rule : rules) {
                 ModuleRevisionId nmrid = rule.getToSystem().transform(mrid);
                 if (chainRules) {
                     mrid = nmrid;

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/src/java/org/apache/ivy/plugins/parser/AbstractModuleDescriptorParser.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/ivy/plugins/parser/AbstractModuleDescriptorParser.java 
b/src/java/org/apache/ivy/plugins/parser/AbstractModuleDescriptorParser.java
index 104ffb6..40dd925 100644
--- a/src/java/org/apache/ivy/plugins/parser/AbstractModuleDescriptorParser.java
+++ b/src/java/org/apache/ivy/plugins/parser/AbstractModuleDescriptorParser.java
@@ -69,7 +69,7 @@ public abstract class AbstractModuleDescriptorParser 
implements ModuleDescriptor
 
         private Resource res;
 
-        private List<String> errors = new ArrayList<String>();
+        private List<String> errors = new ArrayList<>();
 
         private DefaultModuleDescriptor md;
 
@@ -132,57 +132,55 @@ public abstract class AbstractModuleDescriptorParser 
implements ModuleDescriptor
             parseDepsConfs(conf, dd, useDefaultMappingToGuessRightOperand, 
true);
         }
 
-        protected void parseDepsConfs(String[] conf, 
DefaultDependencyDescriptor dd,
+        protected void parseDepsConfs(String[] confs, 
DefaultDependencyDescriptor dd,
                 boolean useDefaultMappingToGuessRightOperand, boolean 
evaluateConditions) {
             replaceConfigurationWildcards(md);
-            for (int i = 0; i < conf.length; i++) {
-                String[] ops = conf[i].split("->");
+            for (String conf : confs) {
+                String[] ops = conf.split("->");
                 if (ops.length == 1) {
                     String[] modConfs = ops[0].split(",");
                     if (!useDefaultMappingToGuessRightOperand) {
-                        for (int j = 0; j < modConfs.length; j++) {
-                            dd.addDependencyConfiguration(modConfs[j].trim(), 
modConfs[j].trim());
+                        for (String modConf : modConfs) {
+                            dd.addDependencyConfiguration(modConf.trim(), 
modConf.trim());
                         }
                     } else {
-                        for (int j = 0; j < modConfs.length; j++) {
+                        for (String modConf : modConfs) {
                             String[] depConfs = 
getDefaultConfMappingDescriptor()
-                                    .getDependencyConfigurations(modConfs[j]);
+                                    .getDependencyConfigurations(modConf);
                             if (depConfs.length > 0) {
-                                for (int k = 0; k < depConfs.length; k++) {
+                                for (String depConf : depConfs) {
                                     String mappedDependency = 
evaluateConditions ? evaluateCondition(
-                                        depConfs[k].trim(), dd) : 
depConfs[k].trim();
+                                            depConf.trim(), dd) : 
depConf.trim();
                                     if (mappedDependency != null) {
-                                        
dd.addDependencyConfiguration(modConfs[j].trim(),
-                                            mappedDependency);
+                                        
dd.addDependencyConfiguration(modConf.trim(),
+                                                mappedDependency);
                                     }
                                 }
                             } else {
                                 // no default mapping found for this 
configuration, map
                                 // configuration to itself
-                                
dd.addDependencyConfiguration(modConfs[j].trim(),
-                                    modConfs[j].trim());
+                                dd.addDependencyConfiguration(modConf.trim(),
+                                        modConf.trim());
                             }
                         }
                     }
                 } else if (ops.length == 2) {
-                    String[] modConfs = ops[0].split(",");
-                    String[] depConfs = ops[1].split(",");
-                    for (int j = 0; j < modConfs.length; j++) {
-                        for (int k = 0; k < depConfs.length; k++) {
+                    for (String modConf : ops[0].split(",")) {
+                        for (String depConf : ops[1].split(",")) {
                             String mappedDependency = evaluateConditions ? 
evaluateCondition(
-                                depConfs[k].trim(), dd) : depConfs[k].trim();
+                                    depConf.trim(), dd) : depConf.trim();
                             if (mappedDependency != null) {
-                                
dd.addDependencyConfiguration(modConfs[j].trim(), mappedDependency);
+                                dd.addDependencyConfiguration(modConf.trim(), 
mappedDependency);
                             }
                         }
                     }
                 } else {
-                    addError("invalid conf " + conf[i] + " for " + dd);
+                    addError("invalid conf " + conf + " for " + dd);
                 }
             }
 
             if (md.isMappingOverride()) {
-                addExtendingConfigurations(conf, dd, 
useDefaultMappingToGuessRightOperand);
+                addExtendingConfigurations(confs, dd, 
useDefaultMappingToGuessRightOperand);
             }
         }
 
@@ -251,29 +249,27 @@ public abstract class AbstractModuleDescriptorParser 
implements ModuleDescriptor
 
         private void addExtendingConfigurations(String[] confs, 
DefaultDependencyDescriptor dd,
                 boolean useDefaultMappingToGuessRightOperand) {
-            for (int i = 0; i < confs.length; i++) {
-                addExtendingConfigurations(confs[i], dd, 
useDefaultMappingToGuessRightOperand);
+            for (String conf : confs) {
+                addExtendingConfigurations(conf, dd, 
useDefaultMappingToGuessRightOperand);
             }
         }
 
         private void addExtendingConfigurations(String conf, 
DefaultDependencyDescriptor dd,
                 boolean useDefaultMappingToGuessRightOperand) {
-            Set<String> configsToAdd = new HashSet<String>();
-            Configuration[] configs = md.getConfigurations();
-            for (int i = 0; i < configs.length; i++) {
-                String[] ext = configs[i].getExtends();
-                for (int j = 0; j < ext.length; j++) {
-                    if (conf.equals(ext[j])) {
-                        String configName = configs[i].getName();
+            Set<String> configsToAdd = new HashSet<>();
+            for (Configuration config : md.getConfigurations()) {
+                for (String ext : config.getExtends()) {
+                    if (conf.equals(ext)) {
+                        String configName = config.getName();
                         configsToAdd.add(configName);
                         addExtendingConfigurations(configName, dd,
-                            useDefaultMappingToGuessRightOperand);
+                                useDefaultMappingToGuessRightOperand);
                     }
                 }
             }
 
-            String[] confs = configsToAdd.toArray(new 
String[configsToAdd.size()]);
-            parseDepsConfs(confs, dd, useDefaultMappingToGuessRightOperand);
+            parseDepsConfs(configsToAdd.toArray(new 
String[configsToAdd.size()]),
+                    dd, useDefaultMappingToGuessRightOperand);
         }
 
         protected DependencyDescriptor getDefaultConfMappingDescriptor() {
@@ -310,7 +306,7 @@ public abstract class AbstractModuleDescriptorParser 
implements ModuleDescriptor
 
         /** Returns a string of the location. */
         private String getLocationString(SAXParseException ex) {
-            StringBuffer str = new StringBuffer();
+            StringBuilder str = new StringBuilder();
 
             String systemId = ex.getSystemId();
             if (systemId != null) {
@@ -351,9 +347,8 @@ public abstract class AbstractModuleDescriptorParser 
implements ModuleDescriptor
         }
 
         private void replaceConfigurationWildcards(ModuleDescriptor md) {
-            Configuration[] configs = md.getConfigurations();
-            for (int i = 0; i < configs.length; i++) {
-                configs[i].replaceWildcards(md);
+            for (Configuration config : md.getConfigurations()) {
+                config.replaceWildcards(md);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/src/java/org/apache/ivy/plugins/parser/ModuleDescriptorParserRegistry.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/ivy/plugins/parser/ModuleDescriptorParserRegistry.java 
b/src/java/org/apache/ivy/plugins/parser/ModuleDescriptorParserRegistry.java
index c3c0834..811b684 100644
--- a/src/java/org/apache/ivy/plugins/parser/ModuleDescriptorParserRegistry.java
+++ b/src/java/org/apache/ivy/plugins/parser/ModuleDescriptorParserRegistry.java
@@ -39,7 +39,7 @@ public final class ModuleDescriptorParserRegistry extends 
AbstractModuleDescript
         return INSTANCE;
     }
 
-    private List<ModuleDescriptorParser> parsers = new 
LinkedList<ModuleDescriptorParser>();
+    private List<ModuleDescriptorParser> parsers = new LinkedList<>();
 
     private ModuleDescriptorParserRegistry() {
         parsers.add(PomModuleDescriptorParser.getInstance());

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/src/java/org/apache/ivy/plugins/parser/m2/DefaultPomDependencyMgt.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/ivy/plugins/parser/m2/DefaultPomDependencyMgt.java 
b/src/java/org/apache/ivy/plugins/parser/m2/DefaultPomDependencyMgt.java
index 5e05f49..7870db9 100644
--- a/src/java/org/apache/ivy/plugins/parser/m2/DefaultPomDependencyMgt.java
+++ b/src/java/org/apache/ivy/plugins/parser/m2/DefaultPomDependencyMgt.java
@@ -17,6 +17,8 @@
  */
 package org.apache.ivy.plugins.parser.m2;
 
+import org.apache.ivy.core.module.id.ModuleId;
+
 import java.util.List;
 
 public class DefaultPomDependencyMgt implements PomDependencyMgt {
@@ -28,10 +30,10 @@ public class DefaultPomDependencyMgt implements 
PomDependencyMgt {
 
     private String scope;
 
-    private List /* <ModuleId> */excludedModules;
+    private List<ModuleId> excludedModules;
 
     public DefaultPomDependencyMgt(String groupId, String artifactId, String 
version, String scope,
-            List /* <ModuleId> */excludedModules) {
+            List<ModuleId> excludedModules) {
         this.groupId = groupId;
         this.artifactId = artifactId;
         this.version = version;
@@ -55,7 +57,7 @@ public class DefaultPomDependencyMgt implements 
PomDependencyMgt {
         return version;
     }
 
-    public List /* <ModuleId> */getExcludedModules() {
+    public List<ModuleId> getExcludedModules() {
         return excludedModules;
     }
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java 
b/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java
index ce32778..e1d15dc 100644
--- a/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java
+++ b/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java
@@ -108,7 +108,7 @@ public class PomModuleDescriptorBuilder {
             new Configuration("optional", Visibility.PUBLIC, "contains all 
optional dependencies",
                     new String[0], true, null)};
 
-    static final Map<String, ConfMapper> MAVEN2_CONF_MAPPING = new 
HashMap<String, ConfMapper>();
+    static final Map<String, ConfMapper> MAVEN2_CONF_MAPPING = new HashMap<>();
 
     private static final String DEPENDENCY_MANAGEMENT = 
"m:dependency.management";
 
@@ -116,12 +116,12 @@ public class PomModuleDescriptorBuilder {
 
     private static final String EXTRA_INFO_DELIMITER = "__";
 
-    private static final Collection<String> JAR_PACKAGINGS = Arrays.asList(new 
String[] {"ejb",
+    private static final Collection<String> JAR_PACKAGINGS = 
Arrays.asList("ejb",
             "bundle", "maven-plugin", "eclipse-plugin", "jbi-component", 
"jbi-shared-library",
-            "orbit", "hk2-jar"});
+            "orbit", "hk2-jar");
 
-    static interface ConfMapper {
-        public void addMappingConfs(DefaultDependencyDescriptor dd, boolean 
isOptional);
+    interface ConfMapper {
+        void addMappingConfs(DefaultDependencyDescriptor dd, boolean 
isOptional);
     }
 
     static {
@@ -199,8 +199,8 @@ public class PomModuleDescriptorBuilder {
             ParserSettings ivySettings) {
         ivyModuleDescriptor = new PomModuleDescriptor(parser, res);
         ivyModuleDescriptor.setResolvedPublicationDate(new 
Date(res.getLastModified()));
-        for (int i = 0; i < MAVEN2_CONFIGURATIONS.length; i++) {
-            ivyModuleDescriptor.addConfiguration(MAVEN2_CONFIGURATIONS[i]);
+        for (Configuration m2conf : MAVEN2_CONFIGURATIONS) {
+            ivyModuleDescriptor.addConfiguration(m2conf);
         }
         ivyModuleDescriptor.setMappingOverride(true);
         ivyModuleDescriptor.addExtraAttributeNamespace("m", 
Ivy.getIvyHomeURL() + "maven");
@@ -231,8 +231,8 @@ public class PomModuleDescriptorBuilder {
     }
 
     public void setLicenses(License[] licenses) {
-        for (int i = 0; i < licenses.length; i++) {
-            ivyModuleDescriptor.addLicense(licenses[i]);
+        for (License license : licenses) {
+            ivyModuleDescriptor.addLicense(license);
         }
     }
 
@@ -304,7 +304,7 @@ public class PomModuleDescriptorBuilder {
         scope = (scope == null || scope.length() == 0) ? getDefaultScope(dep) 
: scope;
         ConfMapper mapping = MAVEN2_CONF_MAPPING.get(scope);
         mapping.addMappingConfs(dd, dep.isOptional());
-        Map<String, String> extraAtt = new HashMap<String, String>();
+        Map<String, String> extraAtt = new HashMap<>();
         if ((dep.getClassifier() != null)
                 || ((dep.getType() != null) && !"jar".equals(dep.getType()))) {
             String type = "jar";
@@ -342,8 +342,8 @@ public class PomModuleDescriptorBuilder {
                 continue;
             }
             String[] confs = dd.getModuleConfigurations();
-            for (int k = 0; k < confs.length; k++) {
-                dd.addExcludeRule(confs[k], new DefaultExcludeRule(new 
ArtifactId(excludedModule,
+            for (String conf : confs) {
+                dd.addExcludeRule(conf, new DefaultExcludeRule(new 
ArtifactId(excludedModule,
                         PatternMatcher.ANY_EXPRESSION, 
PatternMatcher.ANY_EXPRESSION,
                         PatternMatcher.ANY_EXPRESSION), 
ExactPatternMatcher.INSTANCE, null));
             }
@@ -430,14 +430,13 @@ public class PomModuleDescriptorBuilder {
     }
 
     public static List<PomDependencyMgt> getPlugins(ModuleDescriptor md) {
-        List<PomDependencyMgt> result = new ArrayList<PomDependencyMgt>();
+        List<PomDependencyMgt> result = new ArrayList<>();
         String plugins = md.getExtraInfoContentByTagName("m:maven.plugins");
         if (plugins == null) {
-            return new ArrayList<PomDependencyMgt>();
+            return new ArrayList<>();
         }
-        String[] pluginsArray = plugins.split("\\|");
-        for (int i = 0; i < pluginsArray.length; i++) {
-            String[] parts = pluginsArray[i].split(EXTRA_INFO_DELIMITER);
+        for (String plugin : plugins.split("\\|")) {
+            String[] parts = plugin.split(EXTRA_INFO_DELIMITER);
             result.add(new PomPluginElement(parts[0], parts[1], parts[2]));
         }
 
@@ -532,7 +531,7 @@ public class PomModuleDescriptorBuilder {
             }
         }
         String exclusionPrefix = 
getDependencyMgtExtraInfoPrefixForExclusion(groupId, artifactId);
-        List<ModuleId> exclusionIds = new LinkedList<ModuleId>();
+        List<ModuleId> exclusionIds = new LinkedList<>();
         for (ExtraInfoHolder extraInfoHolder : descriptor.getExtraInfos()) {
             String key = extraInfoHolder.getName();
             if (key.startsWith(exclusionPrefix)) {
@@ -550,7 +549,7 @@ public class PomModuleDescriptorBuilder {
     }
 
     public static Map<ModuleId, String> 
getDependencyManagementMap(ModuleDescriptor md) {
-        Map<ModuleId, String> ret = new LinkedHashMap<ModuleId, String>();
+        Map<ModuleId, String> ret = new LinkedHashMap<>();
         if (md instanceof PomModuleDescriptor) {
             for (Map.Entry<ModuleId, PomDependencyMgt> e : 
((PomModuleDescriptor) md)
                     .getDependencyManagementMap().entrySet()) {
@@ -576,7 +575,7 @@ public class PomModuleDescriptorBuilder {
     }
 
     public static List<PomDependencyMgt> 
getDependencyManagements(ModuleDescriptor md) {
-        List<PomDependencyMgt> result = new ArrayList<PomDependencyMgt>();
+        List<PomDependencyMgt> result = new ArrayList<>();
 
         if (md instanceof PomModuleDescriptor) {
             result.addAll(((PomModuleDescriptor) 
md).getDependencyManagementMap().values());
@@ -643,7 +642,7 @@ public class PomModuleDescriptorBuilder {
 
     @Deprecated
     public static Map<String, String> extractPomProperties(Map<String, String> 
extraInfo) {
-        Map<String, String> r = new HashMap<String, String>();
+        Map<String, String> r = new HashMap<>();
         for (Map.Entry<String, String> extraInfoEntry : extraInfo.entrySet()) {
             if (extraInfoEntry.getKey().startsWith(PROPERTIES)) {
                 String prop = extraInfoEntry.getKey().substring(
@@ -655,7 +654,7 @@ public class PomModuleDescriptorBuilder {
     }
 
     public static Map<String, String> 
extractPomProperties(List<ExtraInfoHolder> extraInfos) {
-        Map<String, String> r = new HashMap<String, String>();
+        Map<String, String> r = new HashMap<>();
         for (ExtraInfoHolder extraInfoHolder : extraInfos) {
             if ((extraInfoHolder.getName()).startsWith(PROPERTIES)) {
                 String prop = 
(extraInfoHolder.getName()).substring(PROPERTIES.length()
@@ -725,7 +724,7 @@ public class PomModuleDescriptorBuilder {
     }
 
     public static class PomModuleDescriptor extends DefaultModuleDescriptor {
-        private final Map<ModuleId, PomDependencyMgt> dependencyManagementMap 
= new LinkedHashMap<ModuleId, PomDependencyMgt>();
+        private final Map<ModuleId, PomDependencyMgt> dependencyManagementMap 
= new LinkedHashMap<>();
 
         public PomModuleDescriptor(ModuleDescriptorParser parser, Resource 
res) {
             super(parser, res);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriter.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriter.java 
b/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriter.java
index 3c22254..f21bf96 100644
--- a/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriter.java
+++ b/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriter.java
@@ -27,7 +27,6 @@ import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -116,7 +115,7 @@ public final class PomModuleDescriptorWriter {
             String line = in.readLine();
             while (line != null) {
                 line = IvyPatternHelper.substituteVariables(line, variables);
-                if (line.indexOf(SKIP_LINE) != -1) {
+                if (line.contains(SKIP_LINE)) {
                     // skip this line
                     line = in.readLine();
                     continue;
@@ -132,12 +131,12 @@ public final class PomModuleDescriptorWriter {
                 lastIndent = indent;
                 indent = line.indexOf('<');
 
-                if (!dependenciesPrinted && line.indexOf("</dependencies>") != 
-1) {
+                if (!dependenciesPrinted && line.contains("</dependencies>")) {
                     printDependencies(md, out, options, indent, false);
                     dependenciesPrinted = true;
                 }
 
-                if (!dependenciesPrinted && line.indexOf("</project>") != -1) {
+                if (!dependenciesPrinted && line.contains("</project>")) {
                     printDependencies(md, out, options, lastIndent, true);
                     dependenciesPrinted = true;
                 }
@@ -193,10 +192,10 @@ public final class PomModuleDescriptorWriter {
      */
     private static Artifact findArtifact(ModuleDescriptor md, String 
artifactName) {
         Artifact[] artifacts = md.getAllArtifacts();
-        for (int i = 0; i < artifacts.length; i++) {
-            if (artifacts[i].getName().equals(artifactName)
-                    && artifacts[i].getAttribute("classifier") == null) {
-                return artifacts[i];
+        for (Artifact artifact : artifacts) {
+            if (artifact.getName().equals(artifactName)
+                    && artifact.getAttribute("classifier") == null) {
+                return artifact;
             }
         }
 
@@ -211,7 +210,7 @@ public final class PomModuleDescriptorWriter {
 
     private static void printDependencies(ModuleDescriptor md, PrintWriter out,
             PomWriterOptions options, int indent, boolean printDependencies) {
-        List extraDeps = options.getExtraDependencies();
+        List<ExtraDependency> extraDeps = options.getExtraDependencies();
         DependencyDescriptor[] dds = getDependencies(md, options);
 
         if (!extraDeps.isEmpty() || (dds.length > 0)) {
@@ -221,8 +220,7 @@ public final class PomModuleDescriptorWriter {
             }
 
             // print the extra dependencies first
-            for (Iterator it = extraDeps.iterator(); it.hasNext();) {
-                PomWriterOptions.ExtraDependency dep = (ExtraDependency) 
it.next();
+            for (ExtraDependency dep : extraDeps) {
                 String groupId = dep.getGroup();
                 if (groupId == null) {
                     groupId = md.getModuleRevisionId().getOrganisation();
@@ -241,29 +239,29 @@ public final class PomModuleDescriptorWriter {
                 mapping = DEFAULT_MAPPING;
             }
 
-            for (int i = 0; i < dds.length; i++) {
-                ModuleRevisionId mrid = dds[i].getDependencyRevisionId();
+            for (DependencyDescriptor dd : dds) {
+                ModuleRevisionId mrid = dd.getDependencyRevisionId();
                 ExcludeRule[] excludes = null;
-                if (dds[i].canExclude()) {
-                    excludes = dds[i].getAllExcludeRules();
+                if (dd.canExclude()) {
+                    excludes = dd.getAllExcludeRules();
                 }
-                DependencyArtifactDescriptor[] dads = 
dds[i].getAllDependencyArtifacts();
+                DependencyArtifactDescriptor[] dads = 
dd.getAllDependencyArtifacts();
                 if (dads.length > 0) {
-                    for (int j = 0; j < dads.length; j++) {
-                        String type = dads[j].getType();
-                        String classifier = 
dads[j].getExtraAttribute("classifier");
-                        String scope = 
mapping.getScope(dds[i].getModuleConfigurations());
-                        boolean optional = 
mapping.isOptional(dds[i].getModuleConfigurations());
+                    for (DependencyArtifactDescriptor dad : dads) {
+                        String type = dad.getType();
+                        String classifier = 
dad.getExtraAttribute("classifier");
+                        String scope = 
mapping.getScope(dd.getModuleConfigurations());
+                        boolean optional = 
mapping.isOptional(dd.getModuleConfigurations());
                         printDependency(out, indent, mrid.getOrganisation(), 
mrid.getName(),
                             mrid.getRevision(), type, classifier, scope, 
optional,
-                            dds[i].isTransitive(), excludes);
+                            dd.isTransitive(), excludes);
                     }
                 } else {
-                    String scope = 
mapping.getScope(dds[i].getModuleConfigurations());
-                    boolean optional = 
mapping.isOptional(dds[i].getModuleConfigurations());
-                    final String classifier = 
dds[i].getExtraAttribute("classifier");
+                    String scope = 
mapping.getScope(dd.getModuleConfigurations());
+                    boolean optional = 
mapping.isOptional(dd.getModuleConfigurations());
+                    final String classifier = 
dd.getExtraAttribute("classifier");
                     printDependency(out, indent, mrid.getOrganisation(), 
mrid.getName(),
-                        mrid.getRevision(), null, classifier, scope, optional, 
dds[i].isTransitive(),
+                        mrid.getRevision(), null, classifier, scope, optional, 
dd.isTransitive(),
                         excludes);
                 }
             }
@@ -326,14 +324,15 @@ public final class PomModuleDescriptorWriter {
         indent(out, indent * 3);
         out.println("<exclusions>");
 
-        for (int i = 0; i < exclusions.length; i++) {
+        for (ExcludeRule exclusion : exclusions) {
             indent(out, indent * 4);
             out.println("<exclusion>");
-            ExcludeRule rule = exclusions[i];
             indent(out, indent * 5);
-            out.println("<groupId>" + 
rule.getId().getModuleId().getOrganisation() + "</groupId>");
+            out.println(
+                "<groupId>" + 
exclusion.getId().getModuleId().getOrganisation() + "</groupId>");
             indent(out, indent * 5);
-            out.println("<artifactId>" + rule.getId().getModuleId().getName() 
+ "</artifactId>");
+            out.println(
+                "<artifactId>" + exclusion.getId().getModuleId().getName() + 
"</artifactId>");
             indent(out, indent * 4);
             out.println("</exclusion>");
         }
@@ -346,16 +345,16 @@ public final class PomModuleDescriptorWriter {
             PomWriterOptions options) {
         String[] confs = 
ConfigurationUtils.replaceWildcards(options.getConfs(), md);
 
-        List result = new ArrayList();
+        List<DependencyDescriptor> result = new ArrayList<>();
         DependencyDescriptor[] dds = md.getDependencies();
-        for (int i = 0; i < dds.length; i++) {
-            String[] depConfs = dds[i].getDependencyConfigurations(confs);
+        for (DependencyDescriptor dd : dds) {
+            String[] depConfs = dd.getDependencyConfigurations(confs);
             if ((depConfs != null) && (depConfs.length > 0)) {
-                result.add(dds[i]);
+                result.add(dd);
             }
         }
 
-        return (DependencyDescriptor[]) result.toArray(new 
DependencyDescriptor[result.size()]);
+        return result.toArray(new DependencyDescriptor[result.size()]);
     }
 
     /**
@@ -367,7 +366,7 @@ public final class PomModuleDescriptorWriter {
 
         private final IvyVariableContainer variables;
 
-        private Map localVariables = new HashMap();
+        private Map<String, String> localVariables = new HashMap<>();
 
         private IvyVariableContainerWrapper(IvyVariableContainer variables) {
             this.variables = variables;
@@ -384,7 +383,7 @@ public final class PomModuleDescriptorWriter {
         public String getVariable(String name) {
             String result = variables.getVariable(name);
             if (result == null) {
-                result = (String) localVariables.get(name);
+                result = localVariables.get(name);
             }
             return result;
         }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/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 25745e6..91f721b 100644
--- a/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java
+++ b/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java
@@ -111,7 +111,7 @@ public class PomReader {
 
     private static final String PROFILE = "profile";
 
-    private final Map<String, String> properties = new HashMap<String, 
String>();
+    private final Map<String, String> properties = new HashMap<>();
 
     private final Element projectElement;
 
@@ -258,7 +258,7 @@ public class PomReader {
             return new License[0];
         }
         licenses.normalize();
-        List<License> lics = new ArrayList<License>();
+        List<License> lics = new ArrayList<>();
         for (Element license : getAllChilds(licenses)) {
             if (LICENSE.equals(license.getNodeName())) {
                 String name = getFirstChildText(license, LICENSE_NAME);
@@ -305,7 +305,7 @@ public class PomReader {
         if (dependenciesElement == null) {
             return Collections.emptyList();
         }
-        List<PomDependencyData> dependencies = new 
LinkedList<PomDependencyData>();
+        List<PomDependencyData> dependencies = new LinkedList<>();
         NodeList children = dependenciesElement.getChildNodes();
         for (int i = 0, sz = children.getLength(); i < sz; i++) {
             Node node = children.item(i);
@@ -326,7 +326,7 @@ public class PomReader {
         if (dependenciesElement == null) {
             return Collections.emptyList();
         }
-        List<PomDependencyMgt> dependencies = new 
LinkedList<PomDependencyMgt>();
+        List<PomDependencyMgt> dependencies = new LinkedList<>();
         NodeList children = dependenciesElement.getChildNodes();
         for (int i = 0, sz = children.getLength(); i < sz; i++) {
             Node node = children.item(i);
@@ -342,7 +342,7 @@ public class PomReader {
         if (profilesElement == null) {
             return Collections.emptyList();
         }
-        List<PomProfileElement> result = new 
LinkedList<PomReader.PomProfileElement>();
+        List<PomProfileElement> result = new LinkedList<>();
         NodeList children = profilesElement.getChildNodes();
         for (int i = 0, sz = children.getLength(); i < sz; i++) {
             Node node = children.item(i);
@@ -401,7 +401,7 @@ public class PomReader {
             if (exclusionsElement == null) {
                 return Collections.emptyList();
             }
-            LinkedList<ModuleId> exclusions = new LinkedList<ModuleId>();
+            LinkedList<ModuleId> exclusions = new LinkedList<>();
             NodeList children = exclusionsElement.getChildNodes();
             for (int i = 0, sz = children.getLength(); i < sz; i++) {
                 Node node = children.item(i);
@@ -429,7 +429,7 @@ public class PomReader {
             return Collections.emptyList();
         }
         NodeList children = pluginsElement.getChildNodes();
-        List<PomPluginElement> plugins = new LinkedList<PomPluginElement>();
+        List<PomPluginElement> plugins = new LinkedList<>();
         for (int i = 0; i < children.getLength(); i++) {
             Node node = children.item(i);
             if (node instanceof Element && PLUGIN.equals(node.getNodeName())) {
@@ -581,7 +581,7 @@ public class PomReader {
      * @return the content of the properties tag into the pom.
      */
     public Map<String, String> getPomProperties() {
-        Map<String, String> pomProperties = new HashMap<String, String>();
+        Map<String, String> pomProperties = new HashMap<>();
         Element propsEl = getFirstChildElement(projectElement, PROPERTIES);
         if (propsEl != null) {
             propsEl.normalize();
@@ -644,7 +644,7 @@ public class PomReader {
     }
 
     private static List<Element> getAllChilds(Element parent) {
-        List<Element> r = new LinkedList<Element>();
+        List<Element> r = new LinkedList<>();
         if (parent != null) {
             NodeList childs = parent.getChildNodes();
             for (int i = 0; i < childs.getLength(); i++) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/src/java/org/apache/ivy/plugins/parser/m2/PomWriterOptions.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/parser/m2/PomWriterOptions.java 
b/src/java/org/apache/ivy/plugins/parser/m2/PomWriterOptions.java
index dbf9110..5a7588c 100644
--- a/src/java/org/apache/ivy/plugins/parser/m2/PomWriterOptions.java
+++ b/src/java/org/apache/ivy/plugins/parser/m2/PomWriterOptions.java
@@ -37,7 +37,7 @@ public class PomWriterOptions {
 
     private String artifactPackaging;
 
-    private List<ExtraDependency> extraDependencies = new 
ArrayList<ExtraDependency>();
+    private List<ExtraDependency> extraDependencies = new ArrayList<>();
 
     private String description;
 
@@ -132,7 +132,7 @@ public class PomWriterOptions {
 
         public ConfigurationScopeMapping(Map<String, String> scopesMapping) {
             // preserve the order
-            this.scopes = new LinkedHashMap<String, String>(scopesMapping);
+            this.scopes = new LinkedHashMap<>(scopesMapping);
         }
 
         /**
@@ -143,9 +143,9 @@ public class PomWriterOptions {
          * @return the scope to which the conf is mapped
          */
         public String getScope(String[] confs) {
-            for (int i = 0; i < confs.length; i++) {
-                if (scopes.containsKey(confs[i])) {
-                    return scopes.get(confs[i]);
+            for (String conf : confs) {
+                if (scopes.containsKey(conf)) {
+                    return scopes.get(conf);
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/src/java/org/apache/ivy/plugins/parser/xml/UpdateOptions.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/parser/xml/UpdateOptions.java 
b/src/java/org/apache/ivy/plugins/parser/xml/UpdateOptions.java
index bf6e68d..1811f27 100644
--- a/src/java/org/apache/ivy/plugins/parser/xml/UpdateOptions.java
+++ b/src/java/org/apache/ivy/plugins/parser/xml/UpdateOptions.java
@@ -22,6 +22,7 @@ import java.util.Date;
 import java.util.Map;
 
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
 import org.apache.ivy.plugins.namespace.Namespace;
 import org.apache.ivy.plugins.parser.ParserSettings;
 
@@ -39,12 +40,12 @@ public class UpdateOptions {
     /**
      * Map from ModuleId of dependencies to new revision (as String)
      */
-    private Map resolvedRevisions = Collections.emptyMap();
+    private Map<ModuleRevisionId, String> resolvedRevisions = 
Collections.emptyMap();
 
     /**
      * Map from ModuleId of dependencies to new branch (as String)
      */
-    private Map resolvedBranches = Collections.emptyMap();
+    private Map<ModuleRevisionId, String> resolvedBranches = 
Collections.emptyMap();
 
     /**
      * the new status, <code>null</code> to keep the old one
@@ -110,11 +111,11 @@ public class UpdateOptions {
         return this;
     }
 
-    public Map getResolvedRevisions() {
+    public Map<ModuleRevisionId, String> getResolvedRevisions() {
         return resolvedRevisions;
     }
 
-    public UpdateOptions setResolvedRevisions(Map resolvedRevisions) {
+    public UpdateOptions setResolvedRevisions(Map<ModuleRevisionId, String> 
resolvedRevisions) {
         this.resolvedRevisions = resolvedRevisions;
         return this;
     }
@@ -211,11 +212,11 @@ public class UpdateOptions {
         return this;
     }
 
-    public Map getResolvedBranches() {
+    public Map<ModuleRevisionId, String> getResolvedBranches() {
         return resolvedBranches;
     }
 
-    public UpdateOptions setResolvedBranches(Map resolvedBranches) {
+    public UpdateOptions setResolvedBranches(Map<ModuleRevisionId, String> 
resolvedBranches) {
         this.resolvedBranches = resolvedBranches;
         return this;
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d9665bfc/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 9bb3522..cc640a8 100644
--- a/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
+++ b/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
@@ -209,8 +209,8 @@ public class XmlModuleDescriptorParser extends 
AbstractModuleDescriptorParser {
             }
         }
 
-        protected static final List<String> ALLOWED_VERSIONS = 
Arrays.asList(new String[] {"1.0",
-                "1.1", "1.2", "1.3", "1.4", "2.0", "2.1", "2.2", "2.3", 
"2.4"});
+        protected static final List<String> ALLOWED_VERSIONS = 
Arrays.asList("1.0",
+                "1.1", "1.2", "1.3", "1.4", "2.0", "2.1", "2.2", "2.3", "2.4");
 
         /* how and what do we have to parse */
         private ParserSettings settings;
@@ -242,7 +242,7 @@ public class XmlModuleDescriptorParser extends 
AbstractModuleDescriptorParser {
 
         private String[] publicationsDefaultConf;
 
-        private Stack<ExtraInfoHolder> extraInfoStack = new 
Stack<ExtraInfoHolder>();
+        private Stack<ExtraInfoHolder> extraInfoStack = new Stack<>();
 
         public Parser(ModuleDescriptorParser parser, ParserSettings 
ivySettings) {
             super(parser);
@@ -275,20 +275,15 @@ public class XmlModuleDescriptorParser extends 
AbstractModuleDescriptorParser {
                     
DefaultArtifact.newIvyArtifact(getMd().getResolvedModuleRevisionId(), getMd()
                             .getPublicationDate()));
                 if (!artifactsDeclared) {
-                    String[] confs = getMd().getConfigurationsNames();
-                    for (int i = 0; i < confs.length; i++) {
-                        getMd().addArtifact(
-                            confs[i],
-                            new MDArtifact(getMd(), 
getMd().getModuleRevisionId().getName(), "jar",
-                                    "jar"));
+                    for (String config : getMd().getConfigurationsNames()) {
+                        getMd().addArtifact(config, new MDArtifact(getMd(),
+                                getMd().getModuleRevisionId().getName(), 
"jar", "jar"));
                     }
                 }
                 getMd().check();
             } catch (ParserConfigurationException ex) {
-                IllegalStateException ise = new 
IllegalStateException(ex.getMessage() + " in "
-                        + descriptorURL);
-                ise.initCause(ex);
-                throw ise;
+                throw new IllegalStateException(ex.getMessage() + " in "
+                        + descriptorURL, ex);
             } catch (Exception ex) {
                 checkErrors();
                 ParseException pe = new ParseException(ex.getMessage() + " in 
" + descriptorURL, 0);
@@ -579,7 +574,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<String, 
String>(inherited.size()
+            LinkedHashMap<String, String> dup = new 
LinkedHashMap<>(inherited.size()
                     + overrides.size());
             dup.putAll(inherited);
             dup.putAll(overrides);
@@ -594,9 +589,7 @@ public class XmlModuleDescriptorParser extends 
AbstractModuleDescriptorParser {
          */
         protected void mergeConfigurations(ModuleDescriptor parent) {
             ModuleRevisionId sourceMrid = parent.getModuleRevisionId();
-            Configuration[] configurations = parent.getConfigurations();
-            for (int i = 0; i < configurations.length; i++) {
-                Configuration configuration = configurations[i];
+            for (Configuration configuration : parent.getConfigurations()) {
                 Message.debug("Merging configuration with: " + 
configuration.getName());
                 // copy configuration from parent descriptor
                 getMd().addConfiguration(new Configuration(configuration, 
sourceMrid));
@@ -617,8 +610,7 @@ public class XmlModuleDescriptorParser extends 
AbstractModuleDescriptorParser {
          */
         protected void mergeDependencies(DependencyDescriptor[] dependencies) {
             DefaultModuleDescriptor md = getMd();
-            for (int i = 0; i < dependencies.length; i++) {
-                DependencyDescriptor dependencyDescriptor = dependencies[i];
+            for (DependencyDescriptor dependencyDescriptor : dependencies) {
                 Message.debug("Merging dependency with: "
                         + 
dependencyDescriptor.getDependencyRevisionId().toString());
                 md.addDependency(dependencyDescriptor);
@@ -645,8 +637,8 @@ public class XmlModuleDescriptorParser extends 
AbstractModuleDescriptorParser {
          *            licenses going to be inherited
          */
         public void mergeLicenses(License[] licenses) {
-            for (int i = 0; i < licenses.length; i++) {
-                getMd().addLicense(licenses[i]);
+            for (License license : licenses) {
+                getMd().addLicense(license);
             }
         }
 
@@ -657,8 +649,8 @@ public class XmlModuleDescriptorParser extends 
AbstractModuleDescriptorParser {
          *            exclude rules going to be inherited
          */
         public void mergeExcludes(ExcludeRule[] excludeRules) {
-            for (int i = 0; i < excludeRules.length; i++) {
-                getMd().addExcludeRule(excludeRules[i]);
+            for (ExcludeRule excludeRule : excludeRules) {
+                getMd().addExcludeRule(excludeRule);
             }
         }
 
@@ -819,9 +811,8 @@ public class XmlModuleDescriptorParser extends 
AbstractModuleDescriptorParser {
             XMLHelper.parse(url, null, parser);
 
             // add the configurations from this temporary parser to this 
module descriptor
-            Configuration[] configs = 
parser.getModuleDescriptor().getConfigurations();
-            for (int i = 0; i < configs.length; i++) {
-                getMd().addConfiguration(configs[i]);
+            for (Configuration config : 
parser.getModuleDescriptor().getConfigurations()) {
+                getMd().addConfiguration(config);
             }
             if (parser.getDefaultConfMapping() != null) {
                 Message.debug("setting default conf mapping from imported 
configurations file: "
@@ -860,10 +851,9 @@ public class XmlModuleDescriptorParser extends 
AbstractModuleDescriptorParser {
                     break;
                 case State.PUB:
                     if ("*".equals(conf)) {
-                        String[] confs = getMd().getConfigurationsNames();
-                        for (int i = 0; i < confs.length; i++) {
-                            artifact.addConfiguration(confs[i]);
-                            getMd().addArtifact(confs[i], artifact);
+                        for (String config : getMd().getConfigurationsNames()) 
{
+                            artifact.addConfiguration(config);
+                            getMd().addArtifact(config, artifact);
                         }
                     } else {
                         artifact.addConfiguration(conf);
@@ -874,9 +864,8 @@ public class XmlModuleDescriptorParser extends 
AbstractModuleDescriptorParser {
                     this.conf = conf;
                     String mappeds = 
settings.substitute(attributes.getValue("mapped"));
                     if (mappeds != null) {
-                        String[] mapped = mappeds.split(",");
-                        for (int i = 0; i < mapped.length; i++) {
-                            dd.addDependencyConfiguration(conf, 
mapped[i].trim());
+                        for (String mapped : mappeds.split(",")) {
+                            dd.addDependencyConfiguration(conf, mapped.trim());
                         }
                     }
                     break;
@@ -971,15 +960,11 @@ public class XmlModuleDescriptorParser extends 
AbstractModuleDescriptorParser {
                 // handle this
                 // only if there are no conf defined in sub elements
                 if (confs != null && confs.length() > 0) {
-                    String[] conf;
-                    if ("*".equals(confs)) {
-                        conf = getMd().getConfigurationsNames();
-                    } else {
-                        conf = confs.split(",");
-                    }
-                    for (int i = 0; i < conf.length; i++) {
-                        artifact.addConfiguration(conf[i].trim());
-                        getMd().addArtifact(conf[i].trim(), artifact);
+                    String[] configs = "*".equals(confs) ? 
getMd().getConfigurationsNames()
+                            : confs.split(",");
+                    for (String config : configs) {
+                        artifact.addConfiguration(config.trim());
+                        getMd().addArtifact(config.trim(), artifact);
                     }
                 }
             } else if (state == State.DEP) {
@@ -1152,14 +1137,10 @@ public class XmlModuleDescriptorParser extends 
AbstractModuleDescriptorParser {
             // only add confs if they are specified. if they aren't, 
endElement will handle this
             // only if there are no conf defined in sub elements
             if (confs != null && confs.length() > 0) {
-                String[] conf;
-                if ("*".equals(confs)) {
-                    conf = getMd().getConfigurationsNames();
-                } else {
-                    conf = confs.split(",");
-                }
-                for (int i = 0; i < conf.length; i++) {
-                    addConfiguration(conf[i].trim());
+                String[] configs = "*".equals(confs) ? 
getMd().getConfigurationsNames()
+                        : confs.split(",");
+                for (String config : configs) {
+                    addConfiguration(config.trim());
                 }
             }
         }
@@ -1204,11 +1185,11 @@ public class XmlModuleDescriptorParser extends 
AbstractModuleDescriptorParser {
         public void endElement(String uri, String localName, String qName) 
throws SAXException {
             if (state == State.PUB && "artifact".equals(qName)
                     && artifact.getConfigurations().length == 0) {
-                String[] confs = publicationsDefaultConf == null ? 
getMd().getConfigurationsNames()
+                String[] configs = publicationsDefaultConf == null ? 
getMd().getConfigurationsNames()
                         : publicationsDefaultConf;
-                for (int i = 0; i < confs.length; i++) {
-                    artifact.addConfiguration(confs[i].trim());
-                    getMd().addArtifact(confs[i].trim(), artifact);
+                for (String config : configs) {
+                    artifact.addConfiguration(config.trim());
+                    getMd().addArtifact(config.trim(), artifact);
                 }
             } else if ("configurations".equals(qName)) {
                 checkConfigurations();
@@ -1217,17 +1198,15 @@ public class XmlModuleDescriptorParser extends 
AbstractModuleDescriptorParser {
                     || (state == State.ARTIFACT_EXCLUDE && 
"exclude".equals(qName))) {
                 state = State.DEP;
                 if (confAware.getConfigurations().length == 0) {
-                    String[] confs = getMd().getConfigurationsNames();
-                    for (int i = 0; i < confs.length; i++) {
-                        addConfiguration(confs[i]);
+                    for (String config : getMd().getConfigurationsNames()) {
+                        addConfiguration(config);
                     }
                 }
                 confAware = null;
             } else if ("exclude".equals(qName) && state == State.EXCLUDE) {
                 if (confAware.getConfigurations().length == 0) {
-                    String[] confs = getMd().getConfigurationsNames();
-                    for (int i = 0; i < confs.length; i++) {
-                        addConfiguration(confs[i]);
+                    for (String config : getMd().getConfigurationsNames()) {
+                        addConfiguration(config);
                     }
                 }
                 confAware = null;
@@ -1274,9 +1253,8 @@ public class XmlModuleDescriptorParser extends 
AbstractModuleDescriptorParser {
         }
 
         protected void replaceConfigurationWildcards() {
-            Configuration[] configs = getMd().getConfigurations();
-            for (int i = 0; i < configs.length; i++) {
-                configs[i].replaceWildcards(getMd());
+            for (Configuration config : getMd().getConfigurations()) {
+                config.replaceWildcards(getMd());
             }
         }
 

Reply via email to