You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2012/06/02 17:20:37 UTC

svn commit: r1345522 - /maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java

Author: rfscholte
Date: Sat Jun  2 15:20:36 2012
New Revision: 1345522

URL: http://svn.apache.org/viewvc?rev=1345522&view=rev
Log:
Apply generics and java5 for-loops

Modified:
    maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java

Modified: maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java?rev=1345522&r1=1345521&r2=1345522&view=diff
==============================================================================
--- maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java (original)
+++ maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java Sat Jun  2 15:20:36 2012
@@ -21,7 +21,7 @@ package org.apache.maven.plugins.enforce
 
 import java.util.ArrayList;
 import java.util.Hashtable;
-import java.util.Iterator;
+import java.util.List;
 
 import org.apache.maven.enforcer.rule.api.EnforcerRule;
 import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
@@ -123,7 +123,7 @@ public class EnforceMojo
     /**
      * This is a static variable used to persist the cached results across plugin invocations.
      */
-     protected static Hashtable cache = new Hashtable();
+     protected static Hashtable<String, EnforcerRule> cache = new Hashtable<String, EnforcerRule>();
 
     
     // set by the contextualize method. Only way to get the
@@ -150,7 +150,7 @@ public class EnforceMojo
         if ( !skip )
         {
             // list to store exceptions
-            ArrayList list = new ArrayList();
+            List<String> list = new ArrayList<String>();
 
             // make sure the rules exist
             if ( rules != null && rules.length > 0 )
@@ -213,10 +213,8 @@ public class EnforceMojo
                 // if we found anything
                 if ( !list.isEmpty() )
                 {
-                    Iterator iter = list.iterator();
-                    while ( iter.hasNext() )
+                    for ( String failure  : list )
                     {
-                        String failure = (String) iter.next();
                         log.warn( failure );
                     }
                     if ( fail )