maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject [33/50] git commit: use more Java 5 generics
Date Sat, 01 Dec 2012 10:39:57 GMT
use more Java 5 generics

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-2/branches/maven-2.2.x@965639 13f79535-47bb-0310-9956-ffa450edef68


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

Branch: refs/heads/maven-2.2.x
Commit: ff0d40d4fb14f90b6919d14ae141bccf974bb89a
Parents: f5e0593
Author: Herve Boutemy <hboutemy@apache.org>
Authored: Mon Jul 19 21:20:28 2010 +0000
Committer: Herve Boutemy <hboutemy@apache.org>
Committed: Mon Jul 19 21:20:28 2010 +0000

----------------------------------------------------------------------
 .../maven/artifact/resolver/ArtifactCollector.java |   14 ++--
 .../resolver/ArtifactResolutionResult.java         |   18 ++--
 .../maven/artifact/resolver/ArtifactResolver.java  |   32 ++++----
 .../resolver/DefaultArtifactCollector.java         |   70 +++++++-------
 .../maven/artifact/resolver/ResolutionNode.java    |   59 ++++++-------
 5 files changed, 95 insertions(+), 98 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/ff0d40d4/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactCollector.java
----------------------------------------------------------------------
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactCollector.java
b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactCollector.java
index 180d374..0b1ef9b 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactCollector.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactCollector.java
@@ -37,13 +37,15 @@ import java.util.Set;
  */
 public interface ArtifactCollector
 {
-    ArtifactResolutionResult collect( Set artifacts, Artifact originatingArtifact, ArtifactRepository
localRepository,
-                                      List remoteRepositories, ArtifactMetadataSource source,
ArtifactFilter filter,
-                                      List listeners )
+    ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact,
+                                      ArtifactRepository localRepository, List<ArtifactRepository>
remoteRepositories,
+                                      ArtifactMetadataSource source, ArtifactFilter filter,
+                                      List<ResolutionListener> listeners )
         throws ArtifactResolutionException;
 
-    ArtifactResolutionResult collect( Set artifacts, Artifact originatingArtifact, Map managedVersions,
-                                      ArtifactRepository localRepository, List remoteRepositories,
-                                      ArtifactMetadataSource source, ArtifactFilter filter,
List listeners )
+    ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact,
Map managedVersions,
+                                      ArtifactRepository localRepository, List<ArtifactRepository>
remoteRepositories,
+                                      ArtifactMetadataSource source, ArtifactFilter filter,
+                                      List<ResolutionListener> listeners )
         throws ArtifactResolutionException;
 }

http://git-wip-us.apache.org/repos/asf/maven/blob/ff0d40d4/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java
----------------------------------------------------------------------
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java
b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java
index 100c4a5..e1025f3 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java
@@ -19,34 +19,34 @@ package org.apache.maven.artifact.resolver;
  * under the License.
  */
 
-import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.Set;
 
+import org.apache.maven.artifact.Artifact;
+
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  * @version $Id$
  */
 public class ArtifactResolutionResult
 {
-    private Set resolutionNodes;
+    private Set<ResolutionNode> resolutionNodes;
 
     // calculated.
-    private Set artifacts;
+    private Set<Artifact> artifacts;
 
     public ArtifactResolutionResult()
     {
     }
 
-    public Set getArtifacts()
+    public Set<Artifact> getArtifacts()
     {
         if ( artifacts == null )
         {
-            artifacts = new LinkedHashSet();
+            artifacts = new LinkedHashSet<Artifact>();
 
-            for ( Iterator it = resolutionNodes.iterator(); it.hasNext(); )
+            for ( ResolutionNode node : resolutionNodes )
             {
-                ResolutionNode node = (ResolutionNode) it.next();
                 artifacts.add( node.getArtifact() );
             }
         }
@@ -54,12 +54,12 @@ public class ArtifactResolutionResult
         return artifacts;
     }
 
-    public Set getArtifactResolutionNodes()
+    public Set<ResolutionNode> getArtifactResolutionNodes()
     {
         return resolutionNodes;
     }
 
-    public void setArtifactResolutionNodes( Set resolutionNodes )
+    public void setArtifactResolutionNodes( Set<ResolutionNode> resolutionNodes )
     {
         this.resolutionNodes = resolutionNodes;
 

http://git-wip-us.apache.org/repos/asf/maven/blob/ff0d40d4/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java
----------------------------------------------------------------------
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java
b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java
index 1d9978b..cdf73ad 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java
@@ -29,9 +29,9 @@ import java.util.Map;
 import java.util.Set;
 
 /**
- * I want to use it for hidding the fact that sometime artifact must be
+ * I want to use it for hiding the fact that sometime artifact must be
  * downloaded. I am just asking LocalRepository for given artifact and I don't
- * care if it is alredy there or how it will get there.
+ * care if it is already there or how it will get there.
  *
  * @author <a href="michal.maczka@dimatics.com">Michal Maczka </a>
  * @version $Id$
@@ -41,58 +41,58 @@ public interface ArtifactResolver
 {
     String ROLE = ArtifactResolver.class.getName();
 
-    void resolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository
)
+    void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository
localRepository )
         throws ArtifactResolutionException, ArtifactNotFoundException;
 
-    ArtifactResolutionResult resolveTransitively( Set artifacts,
+    ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts,
                                                   Artifact originatingArtifact,
-                                                  List remoteRepositories,
+                                                  List<ArtifactRepository> remoteRepositories,
                                                   ArtifactRepository localRepository,
                                                   ArtifactMetadataSource source )
         throws ArtifactResolutionException, ArtifactNotFoundException;
 
-    ArtifactResolutionResult resolveTransitively( Set artifacts,
+    ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts,
                                                   Artifact originatingArtifact,
-                                                  List remoteRepositories,
+                                                  List<ArtifactRepository> remoteRepositories,
                                                   ArtifactRepository localRepository,
                                                   ArtifactMetadataSource source,
                                                   List listeners )
         throws ArtifactResolutionException, ArtifactNotFoundException;
 
-    ArtifactResolutionResult resolveTransitively( Set artifacts,
+    ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts,
                                                   Artifact originatingArtifact,
                                                   ArtifactRepository localRepository,
-                                                  List remoteRepositories,
+                                                  List<ArtifactRepository> remoteRepositories,
                                                   ArtifactMetadataSource source,
                                                   ArtifactFilter filter )
         throws ArtifactResolutionException, ArtifactNotFoundException;
 
-    ArtifactResolutionResult resolveTransitively( Set artifacts,
+    ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts,
                                                   Artifact originatingArtifact,
                                                   Map managedVersions,
                                                   ArtifactRepository localRepository,
-                                                  List remoteRepositories,
+                                                  List<ArtifactRepository> remoteRepositories,
                                                   ArtifactMetadataSource source )
         throws ArtifactResolutionException, ArtifactNotFoundException;
 
-    ArtifactResolutionResult resolveTransitively( Set artifacts,
+    ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts,
                                                   Artifact originatingArtifact,
                                                   Map managedVersions,
                                                   ArtifactRepository localRepository,
-                                                  List remoteRepositories,
+                                                  List<ArtifactRepository> remoteRepositories,
                                                   ArtifactMetadataSource source, ArtifactFilter
filter )
         throws ArtifactResolutionException, ArtifactNotFoundException;
 
-    ArtifactResolutionResult resolveTransitively( Set artifacts,
+    ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts,
                                                   Artifact originatingArtifact,
                                                   Map managedVersions,
                                                   ArtifactRepository localRepository,
-                                                  List remoteRepositories,
+                                                  List<ArtifactRepository> remoteRepositories,
                                                   ArtifactMetadataSource source,
                                                   ArtifactFilter filter,
                                                   List listeners )
         throws ArtifactResolutionException, ArtifactNotFoundException;
 
-    void resolveAlways( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository
)
+    void resolveAlways( Artifact artifact, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository )
         throws ArtifactResolutionException, ArtifactNotFoundException;
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven/blob/ff0d40d4/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java
----------------------------------------------------------------------
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java
b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java
index c9e507f..d66c177 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java
@@ -49,21 +49,25 @@ import java.util.Set;
 public class DefaultArtifactCollector
     implements ArtifactCollector
 {
-    public ArtifactResolutionResult collect( Set artifacts, Artifact originatingArtifact,
-                                             ArtifactRepository localRepository, List remoteRepositories,
-                                             ArtifactMetadataSource source, ArtifactFilter
filter, List listeners )
+    public ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact,
+                                             ArtifactRepository localRepository,
+                                             List<ArtifactRepository> remoteRepositories,
+                                             ArtifactMetadataSource source, ArtifactFilter
filter,
+                                             List<ResolutionListener> listeners )
         throws ArtifactResolutionException
     {
         return collect( artifacts, originatingArtifact, Collections.EMPTY_MAP, localRepository,
remoteRepositories,
                         source, filter, listeners );
     }
 
-    public ArtifactResolutionResult collect( Set artifacts, Artifact originatingArtifact,
Map managedVersions,
-                                             ArtifactRepository localRepository, List remoteRepositories,
-                                             ArtifactMetadataSource source, ArtifactFilter
filter, List listeners )
+    public ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact,
+                                             Map managedVersions, ArtifactRepository localRepository,
+                                             List<ArtifactRepository> remoteRepositories,
+                                             ArtifactMetadataSource source, ArtifactFilter
filter,
+                                             List<ResolutionListener> listeners )
         throws ArtifactResolutionException
     {
-        Map resolvedArtifacts = new LinkedHashMap();
+        Map<Object, List<ResolutionNode>> resolvedArtifacts = new LinkedHashMap<Object,
List<ResolutionNode>>();
 
         ResolutionNode root = new ResolutionNode( originatingArtifact, remoteRepositories
);
 
@@ -71,17 +75,15 @@ public class DefaultArtifactCollector
 
         ManagedVersionMap versionMap = getManagedVersionsMap( originatingArtifact, managedVersions
);
 
-        recurse( originatingArtifact, root, resolvedArtifacts, versionMap, localRepository,
remoteRepositories, source, filter,
-                 listeners );
+        recurse( originatingArtifact, root, resolvedArtifacts, versionMap, localRepository,
remoteRepositories, source,
+                 filter, listeners );
 
-        Set set = new LinkedHashSet();
+        Set<ResolutionNode> set = new LinkedHashSet<ResolutionNode>();
 
-        for ( Iterator i = resolvedArtifacts.values().iterator(); i.hasNext(); )
+        for ( List<ResolutionNode> nodes : resolvedArtifacts.values() )
         {
-            List nodes = (List) i.next();
-            for ( Iterator j = nodes.iterator(); j.hasNext(); )
+            for ( ResolutionNode node : nodes )
             {
-                ResolutionNode node = (ResolutionNode) j.next();
                 if ( !node.equals( root ) && node.isActive() )
                 {
                     Artifact artifact = node.getArtifact();
@@ -140,9 +142,10 @@ public class DefaultArtifactCollector
         return versionMap;
     }
 
-    private void recurse( Artifact originatingArtifact, ResolutionNode node, Map resolvedArtifacts,
ManagedVersionMap managedVersions,
-                          ArtifactRepository localRepository, List remoteRepositories, ArtifactMetadataSource
source,
-                          ArtifactFilter filter, List listeners )
+    private void recurse( Artifact originatingArtifact, ResolutionNode node,
+                          Map<Object, List<ResolutionNode>> resolvedArtifacts,
ManagedVersionMap managedVersions,
+                          ArtifactRepository localRepository, List<ArtifactRepository>
remoteRepositories,
+                          ArtifactMetadataSource source, ArtifactFilter filter, List<ResolutionListener>
listeners )
         throws CyclicDependencyException, ArtifactResolutionException, OverConstrainedVersionException
     {
         fireEvent( ResolutionListener.TEST_ARTIFACT, listeners, node );
@@ -156,13 +159,11 @@ public class DefaultArtifactCollector
             manageArtifact( node, managedVersions, listeners );
         }
 
-        List previousNodes = (List) resolvedArtifacts.get( key );
+        List<ResolutionNode> previousNodes = resolvedArtifacts.get( key );
         if ( previousNodes != null )
         {
-            for ( Iterator i = previousNodes.iterator(); i.hasNext(); )
+            for ( ResolutionNode previous : previousNodes )
             {
-                ResolutionNode previous = (ResolutionNode) i.next();
-
                 if ( previous.isActive() )
                 {
                     // Version mediation
@@ -198,7 +199,7 @@ public class DefaultArtifactCollector
                             {
 
                                 // go find the version. This is a total hack. See previous
comment.
-                                List versions = resetArtifact.getAvailableVersions();
+                                List<ArtifactVersion> versions = resetArtifact.getAvailableVersions();
                                 if ( versions == null )
                                 {
                                     try
@@ -271,7 +272,7 @@ public class DefaultArtifactCollector
         }
         else
         {
-            previousNodes = new ArrayList();
+            previousNodes = new ArrayList<ResolutionNode>();
             resolvedArtifacts.put( key, previousNodes );
         }
         previousNodes.add( node );
@@ -288,9 +289,9 @@ public class DefaultArtifactCollector
 
             Artifact parentArtifact = node.getArtifact();
 
-            for ( Iterator i = node.getChildrenIterator(); i.hasNext(); )
+            for ( Iterator<ResolutionNode> i = node.getChildrenIterator(); i.hasNext();
)
             {
-                ResolutionNode child = (ResolutionNode) i.next();
+                ResolutionNode child = i.next();
 
                 // We leave in optional ones, but don't pick up its dependencies
                 if ( !child.isResolved() && ( !child.getArtifact().isOptional() ||
child.isChildOfRootNode() ) )
@@ -298,7 +299,7 @@ public class DefaultArtifactCollector
                     Artifact artifact = child.getArtifact();
                     artifact.setDependencyTrail( node.getDependencyTrail() );
 
-                    List childRemoteRepositories = child.getRemoteRepositories();
+                    List<ArtifactRepository> childRemoteRepositories = child.getRemoteRepositories();
                     try
                     {
                         Object childKey;
@@ -349,7 +350,7 @@ public class DefaultArtifactCollector
                                 else
                                 {
                                     //go find the version
-                                    List versions = artifact.getAvailableVersions();
+                                    List<ArtifactVersion> versions = artifact.getAvailableVersions();
                                     if ( versions == null )
                                     {
                                         versions = source.retrieveAvailableVersions( artifact,
localRepository,
@@ -443,7 +444,8 @@ public class DefaultArtifactCollector
         }
     }
 
-    private void manageArtifact( ResolutionNode node, ManagedVersionMap managedVersions,
List listeners )
+    private void manageArtifact( ResolutionNode node, ManagedVersionMap managedVersions,
+                                 List<ResolutionListener> listeners )
     {
         Artifact artifact = (Artifact) managedVersions.get( node.getKey() );
 
@@ -477,7 +479,7 @@ public class DefaultArtifactCollector
      * @param nearest   nearest resolution node
      * @param listeners
      */
-    boolean checkScopeUpdate( ResolutionNode farthest, ResolutionNode nearest, List listeners
)
+    boolean checkScopeUpdate( ResolutionNode farthest, ResolutionNode nearest, List<ResolutionListener>
listeners )
     {
         boolean updateScope = false;
         Artifact farthestArtifact = farthest.getArtifact();
@@ -518,23 +520,21 @@ public class DefaultArtifactCollector
         return updateScope;
     }
 
-    private void fireEvent( int event, List listeners, ResolutionNode node )
+    private void fireEvent( int event, List<ResolutionListener> listeners, ResolutionNode
node )
     {
         fireEvent( event, listeners, node, null );
     }
 
-    private void fireEvent( int event, List listeners, ResolutionNode node, Artifact replacement
)
+    private void fireEvent( int event, List<ResolutionListener> listeners, ResolutionNode
node, Artifact replacement )
     {
         fireEvent( event, listeners, node, replacement, null );
     }
 
-    private void fireEvent( int event, List listeners, ResolutionNode node, Artifact replacement,
+    private void fireEvent( int event, List<ResolutionListener> listeners, ResolutionNode
node, Artifact replacement,
                             VersionRange newRange )
     {
-        for ( Iterator i = listeners.iterator(); i.hasNext(); )
+        for ( ResolutionListener listener : listeners )
         {
-            ResolutionListener listener = (ResolutionListener) i.next();
-
             switch ( event )
             {
                 case ResolutionListener.TEST_ARTIFACT:

http://git-wip-us.apache.org/repos/asf/maven/blob/ff0d40d4/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ResolutionNode.java
----------------------------------------------------------------------
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ResolutionNode.java
b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ResolutionNode.java
index 8645b69..f75ae5d 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ResolutionNode.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ResolutionNode.java
@@ -20,6 +20,7 @@ package org.apache.maven.artifact.resolver;
  */
 
 import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
 import org.apache.maven.artifact.versioning.ArtifactVersion;
 import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
@@ -35,35 +36,35 @@ public class ResolutionNode
 {
     private Artifact artifact;
 
-    private List children;
+    private List<ResolutionNode> children;
 
-    private final List parents;
+    private final List<Object> parents;
 
     private final int depth;
 
     private final ResolutionNode parent;
 
-    private final List remoteRepositories;
+    private final List<ArtifactRepository> remoteRepositories;
 
     private boolean active = true;
 
-    private List trail;
+    private List<Artifact> trail;
 
-    public ResolutionNode( Artifact artifact, List remoteRepositories )
+    public ResolutionNode( Artifact artifact, List<ArtifactRepository> remoteRepositories
)
     {
         this.artifact = artifact;
         this.remoteRepositories = remoteRepositories;
         depth = 0;
-        parents = Collections.EMPTY_LIST;
+        parents = Collections.emptyList();
         parent = null;
     }
 
-    public ResolutionNode( Artifact artifact, List remoteRepositories, ResolutionNode parent
)
+    public ResolutionNode( Artifact artifact, List<ArtifactRepository> remoteRepositories,
ResolutionNode parent )
     {
         this.artifact = artifact;
         this.remoteRepositories = remoteRepositories;
         depth = parent.depth + 1;
-        parents = new ArrayList();
+        parents = new ArrayList<Object>();
         parents.addAll( parent.parents );
         parents.add( parent.getKey() );
         this.parent = parent;
@@ -84,17 +85,16 @@ public class ResolutionNode
         return artifact.getDependencyConflictId();
     }
 
-    public void addDependencies( Set artifacts, List remoteRepositories, ArtifactFilter filter
)
+    public void addDependencies( Set<Artifact> artifacts, List<ArtifactRepository>
remoteRepositories,
+                                 ArtifactFilter filter )
         throws CyclicDependencyException, OverConstrainedVersionException
     {
         if ( !artifacts.isEmpty() )
         {
-            children = new ArrayList( artifacts.size() );
+            children = new ArrayList<ResolutionNode>( artifacts.size() );
 
-            for ( Iterator i = artifacts.iterator(); i.hasNext(); )
+            for ( Artifact a : artifacts )
             {
-                Artifact a = (Artifact) i.next();
-
                 if ( parents.contains( a.getDependencyConflictId() ) )
                 {
                     a.setDependencyTrail( getDependencyTrail() );
@@ -107,7 +107,7 @@ public class ResolutionNode
         }
         else
         {
-            children = Collections.EMPTY_LIST;
+            children = Collections.emptyList();
         }
         trail = null;
     }
@@ -116,26 +116,25 @@ public class ResolutionNode
      * @return {@link List} &lt; {@link String} > with artifact ids
      * @throws OverConstrainedVersionException
      */
-    public List getDependencyTrail()
+    public List<String> getDependencyTrail()
         throws OverConstrainedVersionException
     {
-        List trial = getTrail();
+        List<Artifact> trial = getTrail();
 
-        List ret = new ArrayList( trial.size() );
-        for ( Iterator i = trial.iterator(); i.hasNext(); )
+        List<String> ret = new ArrayList<String>( trial.size() );
+        for ( Artifact artifact : trial )
         {
-            Artifact artifact = (Artifact) i.next();
             ret.add( artifact.getId() );
         }
         return ret;
     }
 
-    private List getTrail()
+    private List<Artifact> getTrail()
         throws OverConstrainedVersionException
     {
         if ( trail == null )
         {
-            List ids = new LinkedList();
+            List<Artifact> ids = new LinkedList<Artifact>();
             ResolutionNode node = this;
             while ( node != null )
             {
@@ -175,7 +174,7 @@ public class ResolutionNode
         return parent != null && parent.parent == null;
     }
 
-    public Iterator getChildrenIterator()
+    public Iterator<ResolutionNode> getChildrenIterator()
     {
         return children.iterator();
     }
@@ -185,7 +184,7 @@ public class ResolutionNode
         return depth;
     }
 
-    public List getRemoteRepositories()
+    public List<ArtifactRepository> getRemoteRepositories()
     {
         return remoteRepositories;
     }
@@ -201,9 +200,8 @@ public class ResolutionNode
         // TODO: if it was null, we really need to go find them now... or is this taken care
of by the ordering?
         if ( children != null )
         {
-            for ( Iterator i = children.iterator(); i.hasNext(); )
+            for ( ResolutionNode node : children )
             {
-                ResolutionNode node = (ResolutionNode) i.next();
                 node.enable();
             }
         }
@@ -214,9 +212,8 @@ public class ResolutionNode
         active = false;
         if ( children != null )
         {
-            for ( Iterator i = children.iterator(); i.hasNext(); )
+            for ( ResolutionNode node : children )
             {
-                ResolutionNode node = (ResolutionNode) i.next();
                 node.disable();
             }
         }
@@ -225,19 +222,17 @@ public class ResolutionNode
     public boolean filterTrail( ArtifactFilter filter )
         throws OverConstrainedVersionException
     {
-        boolean success = true;
         if ( filter != null )
         {
-            for ( Iterator i = getTrail().iterator(); i.hasNext() && success; )
+            for ( Artifact artifact : getTrail() )
             {
-                Artifact artifact = (Artifact) i.next();
                 if ( !filter.include( artifact ) )
                 {
-                    success = false;
+                    return false;
                 }
             }
         }
-        return success;
+        return true;
     }
 
     public String toString()


Mime
View raw message