You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2012/12/18 03:48:16 UTC

svn commit: r1423261 - /maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/

Author: hboutemy
Date: Tue Dec 18 02:48:07 2012
New Revision: 1423261

URL: http://svn.apache.org/viewvc?rev=1423261&view=rev
Log:
o use generics
o use parameter default value instead of property since readonly

Modified:
    maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/AbstractEffectiveMojo.java
    maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/ActiveProfilesMojo.java
    maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/AllProfilesMojo.java
    maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java
    maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/EffectiveSettingsMojo.java
    maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/EvaluateMojo.java
    maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/ExpressionsMojo.java
    maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/SystemMojo.java

Modified: maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/AbstractEffectiveMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/AbstractEffectiveMojo.java?rev=1423261&r1=1423260&r2=1423261&view=diff
==============================================================================
--- maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/AbstractEffectiveMojo.java (original)
+++ maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/AbstractEffectiveMojo.java Tue Dec 18 02:48:07 2012
@@ -173,7 +173,7 @@ public abstract class AbstractEffectiveM
             }
 
             ElementFilter elementFilter = new ElementFilter( Namespace.getNamespace( "" ) );
-            for ( Iterator i = rootElement.getDescendants( elementFilter ); i.hasNext(); )
+            for ( Iterator<?> i = rootElement.getDescendants( elementFilter ); i.hasNext(); )
             {
                 Element e = (Element) i.next();
                 e.setNamespace( pomNamespace );
@@ -206,13 +206,13 @@ public abstract class AbstractEffectiveM
         static final long serialVersionUID = -8985316072702233744L;
 
         /** {@inheritDoc} */
-        public Set keySet()
+        public Set<Object> keySet()
         {
-            Set keynames = super.keySet();
+            Set<Object>keynames = super.keySet();
             Vector list = new Vector( keynames );
             Collections.sort( list );
 
-            return new LinkedHashSet( list );
+            return new LinkedHashSet<Object>( list );
         }
     }
 }

Modified: maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/ActiveProfilesMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/ActiveProfilesMojo.java?rev=1423261&r1=1423260&r2=1423261&view=diff
==============================================================================
--- maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/ActiveProfilesMojo.java (original)
+++ maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/ActiveProfilesMojo.java Tue Dec 18 02:48:07 2012
@@ -28,7 +28,6 @@ import org.apache.maven.project.MavenPro
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -48,8 +47,8 @@ public class ActiveProfilesMojo
     /**
      * This is the list of projects currently slated to be built by Maven.
      */
-    @Parameter( property = "reactorProjects", required = true, readonly = true )
-    private List projects;
+    @Parameter( defaultValue = "${reactorProjects}", required = true, readonly = true )
+    private List<MavenProject> projects;
 
     // ----------------------------------------------------------------------
     // Public methods
@@ -61,10 +60,8 @@ public class ActiveProfilesMojo
     {
         StringBuilder message = new StringBuilder();
 
-        for ( Iterator it = projects.iterator(); it.hasNext(); )
+        for ( MavenProject project : projects )
         {
-            MavenProject project = (MavenProject) it.next();
-
             getActiveProfileStatement( project, message );
 
             message.append( "\n\n" );
@@ -114,7 +111,8 @@ public class ActiveProfilesMojo
     {
         // Get active profiles into our own list,
         // since we'll be modifying it, further below
-        List profiles = new ArrayList( project.getActiveProfiles() );
+        @SuppressWarnings( "unchecked" )
+        List<Profile> profiles = new ArrayList<Profile>( project.getActiveProfiles() );
 
         message.append( "\n" );
 
@@ -128,10 +126,8 @@ public class ActiveProfilesMojo
         {
             message.append( "The following profiles are active:\n" );
 
-            for ( Iterator it = profiles.iterator(); it.hasNext(); )
+            for ( Profile profile : profiles )
             {
-                Profile profile = (Profile) it.next();
-
                 message.append( "\n - " ).append( profile.getId() );
                 message.append( " (source: " ).append( profile.getSource() ).append( ")" );
             }

Modified: maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/AllProfilesMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/AllProfilesMojo.java?rev=1423261&r1=1423260&r2=1423261&view=diff
==============================================================================
--- maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/AllProfilesMojo.java (original)
+++ maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/AllProfilesMojo.java Tue Dec 18 02:48:07 2012
@@ -39,7 +39,6 @@ import org.codehaus.plexus.util.xml.pull
 
 import java.io.File;
 import java.io.IOException;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -65,8 +64,8 @@ public class AllProfilesMojo
     /**
      * This is the list of projects currently slated to be built by Maven.
      */
-    @Parameter( property = "reactorProjects", required = true, readonly = true )
-    private List projects;
+    @Parameter( defaultValue = "${reactorProjects}", required = true, readonly = true )
+    private List<MavenProject> projects;
 
     /**
      * The current build session instance. This is used for plugin manager API calls.
@@ -84,10 +83,8 @@ public class AllProfilesMojo
     {
         StringBuilder descriptionBuffer = new StringBuilder();
 
-        for ( Iterator iter = projects.iterator(); iter.hasNext(); )
+        for ( MavenProject project : projects )
         {
-            MavenProject project = (MavenProject) iter.next();
-
             descriptionBuffer.append( "Listing Profiles for Project: " ).append( project.getId() ).append( "\n" );
 
             DefaultProfileManager pm =
@@ -121,34 +118,29 @@ public class AllProfilesMojo
             {
                 // This feels more like a hack to filter out inactive profiles, there is no 'direct'
                 // way to query activation status on a Profile instance.
-                Map allProfilesByIds = pm.getProfilesById();
+                @SuppressWarnings( "unchecked" )
+                Map<String, Profile> allProfilesByIds = pm.getProfilesById();
 
                 // active Profiles will be a subset of *all* profiles
-                List activeProfiles = project.getActiveProfiles();
-                for ( Iterator itr = activeProfiles.iterator(); itr.hasNext(); )
+                @SuppressWarnings( "unchecked" )
+                List<Profile> activeProfiles = project.getActiveProfiles();
+                for ( Profile activeProfile : activeProfiles )
                 {
-                    Profile activeProfile = (Profile) itr.next();
-
                     // we already have the active profiles for the project, so remove them from the list of all
                     // profiles.
                     allProfilesByIds.remove( activeProfile.getId() );
                 }
 
                 // display active profiles
-                for ( Iterator it = activeProfiles.iterator(); it.hasNext(); )
+                for ( Profile p : activeProfiles )
                 {
-                    Profile p = (Profile) it.next();
-
                     descriptionBuffer.append( "  Profile Id: " ).append( p.getId() );
                     descriptionBuffer.append( " (Active: true , Source: " ).append( p.getSource() ).append( ")\n" );
                 }
 
                 // display inactive profiles
-                Iterator it = allProfilesByIds.keySet().iterator();
-                while ( it.hasNext() )
+                for ( Profile p : allProfilesByIds.values() )
                 {
-                    Profile p = (Profile) allProfilesByIds.get( (String) it.next() );
-
                     descriptionBuffer.append( "  Profile Id: " ).append( p.getId() );
                     descriptionBuffer.append( " (Active: false , Source: " ).append( p.getSource() ).append( ")\n" );
                 }
@@ -211,10 +203,10 @@ public class AllProfilesMojo
             ProfilesRoot root = profilesBuilder.buildProfiles( projectDir );
             if ( root != null )
             {
-                for ( Iterator it = root.getProfiles().iterator(); it.hasNext(); )
+                @SuppressWarnings( "unchecked" )
+                List<org.apache.maven.profiles.Profile> profiles = root.getProfiles(); 
+                for ( org.apache.maven.profiles.Profile rawProfile : profiles )
                 {
-                    org.apache.maven.profiles.Profile rawProfile = (org.apache.maven.profiles.Profile) it.next();
-
                     Profile converted = ProfilesConversionUtils.convertFromProfileXmlProfile( rawProfile );
                     profileManager.addProfile( converted );
                     profileManager.explicitlyActivate( converted.getId() );
@@ -262,11 +254,10 @@ public class AllProfilesMojo
         }
 
         // Attempt to obtain the list of profiles from pom.xml
-        Iterator it = project.getModel().getProfiles().iterator();
-        while ( it.hasNext() )
+        @SuppressWarnings( "unchecked" )
+        List<Profile> profiles = project.getModel().getProfiles();
+        for ( Profile profile : profiles )
         {
-            Profile profile = (Profile) it.next();
-
             profilesManager.addProfile( profile );
             profilesManager.explicitlyActivate( profile.getId() );
         }
@@ -274,11 +265,10 @@ public class AllProfilesMojo
         MavenProject parent = project.getParent();
         while( parent != null )
         {
-            Iterator it2 = parent.getModel().getProfiles().iterator();
-            while ( it2.hasNext() )
+            @SuppressWarnings( "unchecked" )
+            List<Profile> profiles2 = parent.getModel().getProfiles();
+            for ( Profile profile : profiles2 )
             {
-                Profile profile = (Profile) it2.next();
-
                 profilesManager.addProfile( profile );
                 profilesManager.explicitlyActivate( profile.getId() );
             }
@@ -310,11 +300,10 @@ public class AllProfilesMojo
             getLog().debug( "Attempting to read profiles from settings.xml..." );
         }
 
-        Iterator it = settings.getProfiles().iterator();
-        while ( it.hasNext() )
+        @SuppressWarnings( "unchecked" )
+        List<org.apache.maven.settings.Profile> profiles = settings.getProfiles();
+        for ( org.apache.maven.settings.Profile rawProfile : profiles )
         {
-            org.apache.maven.settings.Profile rawProfile = (org.apache.maven.settings.Profile) it.next();
-
             Profile profile = SettingsUtils.convertFromSettingsProfile( rawProfile );
             profileManager.addProfile( profile );
             profileManager.explicitlyActivate( profile.getId() );

Modified: maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java?rev=1423261&r1=1423260&r2=1423261&view=diff
==============================================================================
--- maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java (original)
+++ maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java Tue Dec 18 02:48:07 2012
@@ -71,7 +71,7 @@ import java.util.StringTokenizer;
  * @see <a href="http://maven.apache.org/general.html#What_is_a_Mojo">What is a Mojo?</a>
  * @since 2.0
  */
-@Mojo (name = "describe", requiresProject = false, aggregator = true)
+@Mojo( name = "describe", requiresProject = false, aggregator = true )
 public class DescribeMojo
     extends AbstractHelpMojo
 {
@@ -110,7 +110,7 @@ public class DescribeMojo
     /**
      * The Plugin manager instance used to resolve Plugin descriptors.
      */
-    @Component (role = PluginManager.class)
+    @Component( role = PluginManager.class )
     private PluginManager pluginManager;
 
     /**
@@ -118,7 +118,7 @@ public class DescribeMojo
      * in the event there is no current MavenProject instance. Some MavenProject
      * instance has to be present to use in the plugin manager APIs.
      */
-    @Component (role = MavenProjectBuilder.class)
+    @Component( role = MavenProjectBuilder.class )
     private MavenProjectBuilder projectBuilder;
 
     // ----------------------------------------------------------------------
@@ -152,7 +152,7 @@ public class DescribeMojo
      * The local repository ArtifactRepository instance. This is used
      * for plugin manager API calls.
      */
-    @org.apache.maven.plugins.annotations.Parameter (property = "localRepository", required = true, readonly = true)
+    @org.apache.maven.plugins.annotations.Parameter( defaultValue = "${localRepository}", required = true, readonly = true )
     private ArtifactRepository localRepository;
 
     /**
@@ -160,9 +160,9 @@ public class DescribeMojo
      *
      * @since 2.1
      */
-    @org.apache.maven.plugins.annotations.Parameter (property = "project.remoteArtifactRepositories", required = true,
-                                                     readonly = true)
-    private List remoteRepositories;
+    @org.apache.maven.plugins.annotations.Parameter( defaultValue = "${project.remoteArtifactRepositories}",
+                    required = true, readonly = true )
+    private List<ArtifactRepository> remoteRepositories;
 
     /**
      * The Maven Plugin to describe. This must be specified in one of three ways:
@@ -173,7 +173,7 @@ public class DescribeMojo
      * <li>groupId:artifactId:version, i.e. 'org.apache.maven.plugins:maven-help-plugin:2.0'</li>
      * </ol>
      */
-    @org.apache.maven.plugins.annotations.Parameter (property = "plugin", alias = "prefix")
+    @org.apache.maven.plugins.annotations.Parameter( property = "plugin", alias = "prefix" )
     private String plugin;
 
     /**
@@ -181,7 +181,7 @@ public class DescribeMojo
      * <br/>
      * <b>Note</b>: Should be used with <code>artifactId</code> parameter.
      */
-    @org.apache.maven.plugins.annotations.Parameter (property = "groupId")
+    @org.apache.maven.plugins.annotations.Parameter( property = "groupId" )
     private String groupId;
 
     /**
@@ -189,7 +189,7 @@ public class DescribeMojo
      * <br/>
      * <b>Note</b>: Should be used with <code>groupId</code> parameter.
      */
-    @org.apache.maven.plugins.annotations.Parameter (property = "artifactId")
+    @org.apache.maven.plugins.annotations.Parameter( property = "artifactId" )
     private String artifactId;
 
     /**
@@ -197,7 +197,7 @@ public class DescribeMojo
      * <br/>
      * <b>Note</b>: Should be used with <code>groupId/artifactId</code> parameters.
      */
-    @org.apache.maven.plugins.annotations.Parameter (property = "version")
+    @org.apache.maven.plugins.annotations.Parameter( property = "version" )
     private String version;
 
     /**
@@ -207,7 +207,7 @@ public class DescribeMojo
      *
      * @since 2.1, was <code>mojo</code> in 2.0.x
      */
-    @org.apache.maven.plugins.annotations.Parameter (property = "goal", alias = "mojo")
+    @org.apache.maven.plugins.annotations.Parameter( property = "goal", alias = "mojo" )
     private String goal;
 
     /**
@@ -215,7 +215,7 @@ public class DescribeMojo
      *
      * @since 2.1, was <code>full</code> in 2.0.x
      */
-    @org.apache.maven.plugins.annotations.Parameter (property = "detail", defaultValue = "false", alias = "full")
+    @org.apache.maven.plugins.annotations.Parameter( property = "detail", defaultValue = "false", alias = "full" )
     private boolean detail;
 
     /**
@@ -223,7 +223,7 @@ public class DescribeMojo
      *
      * @since 2.0.2
      */
-    @org.apache.maven.plugins.annotations.Parameter (property = "medium", defaultValue = "true")
+    @org.apache.maven.plugins.annotations.Parameter( property = "medium", defaultValue = "true" )
     private boolean medium;
 
     /**
@@ -231,7 +231,7 @@ public class DescribeMojo
      *
      * @since 2.1
      */
-    @org.apache.maven.plugins.annotations.Parameter (property = "minimal", defaultValue = "false")
+    @org.apache.maven.plugins.annotations.Parameter( property = "minimal", defaultValue = "false" )
     private boolean minimal;
 
     /**
@@ -241,7 +241,7 @@ public class DescribeMojo
      *
      * @since 2.1
      */
-    @org.apache.maven.plugins.annotations.Parameter (property = "cmd")
+    @org.apache.maven.plugins.annotations.Parameter( property = "cmd" )
     private String cmd;
 
     // ----------------------------------------------------------------------
@@ -575,7 +575,8 @@ public class DescribeMojo
         append( buffer, "Goal Prefix", pd.getGoalPrefix(), 0 );
         buffer.append( "\n" );
 
-        List mojos = pd.getMojos();
+        @SuppressWarnings( "unchecked" )
+        List<MojoDescriptor> mojos = pd.getMojos();
 
         if ( mojos == null )
         {
@@ -588,13 +589,11 @@ public class DescribeMojo
             append( buffer, "This plugin has " + mojos.size() + " goal" + ( mojos.size() > 1 ? "s" : "" ) + ":", 0 );
             buffer.append( "\n" );
 
-            mojos = new ArrayList( mojos );
+            mojos = new ArrayList<MojoDescriptor>( mojos );
             PluginUtils.sortMojos( mojos );
 
-            for ( Iterator it = mojos.iterator(); it.hasNext(); )
+            for ( MojoDescriptor md : mojos )
             {
-                MojoDescriptor md = (MojoDescriptor) it.next();
-
                 if ( detail )
                 {
                     describeMojoGuts( md, buffer, true );
@@ -723,7 +722,8 @@ public class DescribeMojo
     private void describeMojoParameters( MojoDescriptor md, StringBuilder buffer )
         throws MojoFailureException, MojoExecutionException
     {
-        List params = md.getParameters();
+        @SuppressWarnings( "unchecked" )
+        List<Parameter> params = md.getParameters();
 
         if ( params == null || params.isEmpty() )
         {
@@ -731,16 +731,13 @@ public class DescribeMojo
             return;
         }
 
-        params = new ArrayList( params );
+        params = new ArrayList<Parameter>( params );
         // TODO remove when maven-plugin-tools-api:2.4.4 is out see PluginUtils.sortMojoParameters()
-        Collections.sort( params, new Comparator()
+        Collections.sort( params, new Comparator<Parameter>()
         {
             /** {@inheritDoc} */
-            public int compare( Object o1, Object o2 )
+            public int compare( Parameter parameter1, Parameter parameter2 )
             {
-                Parameter parameter1 = (Parameter) o1;
-                Parameter parameter2 = (Parameter) o2;
-
                 return parameter1.getName().compareToIgnoreCase( parameter2.getName() );
             }
         } );
@@ -748,9 +745,8 @@ public class DescribeMojo
         append( buffer, "Available parameters:", 1 );
 
         // indent 2
-        for ( Iterator it = params.iterator(); it.hasNext(); )
+        for ( Parameter parameter : params )
         {
-            Parameter parameter = (Parameter) it.next();
             if ( !parameter.isEditable() )
             {
                 continue;
@@ -835,13 +831,14 @@ public class DescribeMojo
 
                 LifecycleMapping lifecycleMapping =
                     (LifecycleMapping) session.lookup( LifecycleMapping.ROLE, project.getPackaging() );
+                @SuppressWarnings( "unchecked" )
+                List<String> phases = lifecycle.getPhases();
+
                 if ( lifecycle.getDefaultPhases() == null )
                 {
                     descriptionBuffer.append( "'" + cmd + "' is a phase corresponding to this plugin:\n" );
-                    for ( Iterator it = lifecycle.getPhases().iterator(); it.hasNext(); )
+                    for ( String key : phases )
                     {
-                        String key = (String) it.next();
-
                         if ( !key.equals( cmd ) )
                         {
                             continue;
@@ -859,10 +856,8 @@ public class DescribeMojo
                         "It is a part of the lifecycle for the POM packaging '" + project.getPackaging()
                             + "'. This lifecycle includes the following phases:" );
                     descriptionBuffer.append( "\n" );
-                    for ( Iterator it = lifecycle.getPhases().iterator(); it.hasNext(); )
+                    for ( String key : phases )
                     {
-                        String key = (String) it.next();
-
                         descriptionBuffer.append( "* " + key + ": " );
                         String value = (String) lifecycleMapping.getPhases( "default" ).get( key );
                         if ( StringUtils.isNotEmpty( value ) )
@@ -892,10 +887,8 @@ public class DescribeMojo
                     descriptionBuffer.append( "'" + cmd + "' is a lifecycle with the following phases: " );
                     descriptionBuffer.append( "\n" );
 
-                    for ( Iterator it = lifecycle.getPhases().iterator(); it.hasNext(); )
+                    for ( String key : phases )
                     {
-                        String key = (String) it.next();
-
                         descriptionBuffer.append( "* " + key + ": " );
                         if ( lifecycle.getDefaultPhases().get( key ) != null )
                         {
@@ -943,7 +936,7 @@ public class DescribeMojo
      * @throws MojoExecutionException if no line was found for <code>text</code>
      * @see HelpMojo#toLines(String, int, int, int)
      */
-    private static List toLines( String text, int indent, int indentSize, int lineLength )
+    private static List<String> toLines( String text, int indent, int indentSize, int lineLength )
         throws MojoFailureException, MojoExecutionException
     {
         try
@@ -952,7 +945,7 @@ public class DescribeMojo
                                                          new Class[]{ String.class, Integer.TYPE, Integer.TYPE,
                                                              Integer.TYPE } );
             m.setAccessible( true );
-            List output = (List) m.invoke( HelpMojo.class,
+            List<String> output = (List<String>) m.invoke( HelpMojo.class,
                                            new Object[]{ text, Integer.valueOf( indent ), Integer.valueOf( indentSize ),
                                                Integer.valueOf( lineLength ) } );
 
@@ -1012,9 +1005,9 @@ public class DescribeMojo
             return;
         }
 
-        for ( Iterator it = toLines( description, indent, INDENT_SIZE, LINE_LENGTH ).iterator(); it.hasNext(); )
+        for ( String line : toLines( description, indent, INDENT_SIZE, LINE_LENGTH ) )
         {
-            sb.append( it.next().toString() ).append( '\n' );
+            sb.append( line ).append( '\n' );
         }
     }
 
@@ -1044,9 +1037,9 @@ public class DescribeMojo
         }
 
         String description = key + ": " + value;
-        for ( Iterator it = toLines( description, indent, INDENT_SIZE, LINE_LENGTH ).iterator(); it.hasNext(); )
+        for ( String line : toLines( description, indent, INDENT_SIZE, LINE_LENGTH ) )
         {
-            sb.append( it.next().toString() ).append( '\n' );
+            sb.append( line ).append( '\n' );
         }
     }
 
@@ -1081,12 +1074,12 @@ public class DescribeMojo
             description = key + ": " + value;
         }
 
-        List l1 = toLines( description, indent, INDENT_SIZE, LINE_LENGTH - INDENT_SIZE );
-        List l2 = toLines( description, indent + 1, INDENT_SIZE, LINE_LENGTH );
+        List<String> l1 = toLines( description, indent, INDENT_SIZE, LINE_LENGTH - INDENT_SIZE );
+        List<String> l2 = toLines( description, indent + 1, INDENT_SIZE, LINE_LENGTH );
         l2.set( 0, l1.get( 0 ) );
-        for ( Iterator it = l2.iterator(); it.hasNext(); )
+        for ( String line : l2 )
         {
-            sb.append( it.next().toString() ).append( '\n' );
+            sb.append( line ).append( '\n' );
         }
     }
 

Modified: maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/EffectiveSettingsMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/EffectiveSettingsMojo.java?rev=1423261&r1=1423260&r2=1423261&view=diff
==============================================================================
--- maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/EffectiveSettingsMojo.java (original)
+++ maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/EffectiveSettingsMojo.java Tue Dec 18 02:48:07 2012
@@ -37,7 +37,7 @@ import java.io.IOException;
 import java.io.StringWriter;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
-import java.util.Iterator;
+import java.util.List;
 import java.util.Properties;
 
 /**
@@ -67,7 +67,7 @@ public class EffectiveSettingsMojo
      *
      * @since 2.1
      */
-    @Parameter(property = "showPasswords", defaultValue = "false")
+    @Parameter( property = "showPasswords", defaultValue = "false" )
     private boolean showPasswords;
 
     // ----------------------------------------------------------------------
@@ -142,19 +142,20 @@ public class EffectiveSettingsMojo
      */
     private static void hidePasswords( Settings aSettings )
     {
-        for ( Iterator it = aSettings.getProxies().iterator(); it.hasNext(); )
+        @SuppressWarnings( "unchecked" )
+        List<Proxy> proxies = aSettings.getProxies();
+        for ( Proxy proxy : proxies )
         {
-            Proxy proxy = (Proxy) it.next();
-
             if ( StringUtils.isNotEmpty( proxy.getPassword() ) )
             {
                 proxy.setPassword( "***" );
             }
         }
 
-        for ( Iterator it = aSettings.getServers().iterator(); it.hasNext(); )
+        @SuppressWarnings( "unchecked" )
+        List<Server> servers = aSettings.getServers();
+        for ( Server server : servers )
         {
-            Server server = (Server) it.next();
             // Password
             if ( StringUtils.isNotEmpty( server.getPassword() ) )
             {
@@ -237,10 +238,10 @@ public class EffectiveSettingsMojo
      */
     private static void cleanSettings( Settings settings )
     {
-        for ( Iterator it = settings.getProfiles().iterator(); it.hasNext(); )
+        @SuppressWarnings( "unchecked" )
+        List<Profile> profiles = settings.getProfiles();
+        for ( Profile profile : profiles )
         {
-            Profile profile = (Profile) it.next();
-
             Properties properties = new SortedProperties();
             properties.putAll( profile.getProperties() );
             profile.setProperties( properties );

Modified: maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/EvaluateMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/EvaluateMojo.java?rev=1423261&r1=1423260&r2=1423261&view=diff
==============================================================================
--- maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/EvaluateMojo.java (original)
+++ maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/EvaluateMojo.java Tue Dec 18 02:48:07 2012
@@ -60,7 +60,6 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.StringWriter;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -139,7 +138,7 @@ public class EvaluateMojo
     /**
      * Local Repository.
      */
-    @Parameter( property = "localRepository", required = true, readonly = true )
+    @Parameter( defaultValue = "${localRepository}", required = true, readonly = true )
     protected ArtifactRepository localRepository;
 
     /**
@@ -151,8 +150,8 @@ public class EvaluateMojo
     /**
      * Remote repositories used for the project.
      */
-    @Parameter( property = "project.remoteArtifactRepositories", required = true, readonly = true )
-    private List remoteRepositories;
+    @Parameter( defaultValue = "${project.remoteArtifactRepositories}", required = true, readonly = true )
+    private List<ArtifactRepository> remoteRepositories;
 
     /**
      * The system settings for Maven.
@@ -483,7 +482,7 @@ public class EvaluateMojo
         // beautify list
         if ( obj instanceof List )
         {
-            List list = (List) obj;
+            List<?> list = (List<?>) obj;
             if ( list.size() > 0 )
             {
                 Object elt = list.iterator().next();
@@ -519,7 +518,7 @@ public class EvaluateMojo
             xstream.registerConverter( new PropertiesConverter()
             {
                 /** {@inheritDoc} */
-                public boolean canConvert( Class type )
+                public boolean canConvert( @SuppressWarnings( "rawtypes" ) Class type )
                 {
                     return Properties.class == type;
                 }
@@ -528,11 +527,9 @@ public class EvaluateMojo
                 public void marshal( Object source, HierarchicalStreamWriter writer, MarshallingContext context )
                 {
                     Properties properties = (Properties) source;
-                    Map map = new TreeMap( properties ); // sort
-                    for ( Iterator iterator = map.entrySet().iterator(); iterator.hasNext(); )
+                    Map<?, ?> map = new TreeMap<Object, Object>( properties ); // sort
+                    for ( Map.Entry<?, ?> entry : map.entrySet() )
                     {
-                        Map.Entry entry = (Map.Entry) iterator.next();
-
                         writer.startNode( entry.getKey().toString() );
                         writer.setValue( entry.getValue().toString() );
                         writer.endNode();
@@ -609,7 +606,7 @@ public class EvaluateMojo
                     {
                         try
                         {
-                            Class clazz = ClassUtils.getClass( name );
+                            Class<?> clazz = ClassUtils.getClass( name );
                             String alias = StringUtils.lowercaseFirstLetter( ClassUtils.getShortClassName( clazz ) );
                             xstreamObject.alias( alias, clazz );
                             if ( !clazz.equals( Model.class ) )
@@ -684,10 +681,10 @@ public class EvaluateMojo
         throws MojoExecutionException, ProjectBuildingException, ArtifactResolutionException,
         ArtifactNotFoundException
     {
-        for ( Iterator it = getHelpPluginPom().getDependencies().iterator(); it.hasNext(); )
+        @SuppressWarnings( "unchecked" )
+        List<Dependency> dependencies = getHelpPluginPom().getDependencies();
+        for ( Dependency depependency : dependencies )
         {
-            Dependency depependency = (Dependency) it.next();
-
             if ( !( depependency.getGroupId().equals( "org.apache.maven" ) ) )
             {
                 continue;

Modified: maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/ExpressionsMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/ExpressionsMojo.java?rev=1423261&r1=1423260&r2=1423261&view=diff
==============================================================================
--- maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/ExpressionsMojo.java (original)
+++ maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/ExpressionsMojo.java Tue Dec 18 02:48:07 2012
@@ -30,7 +30,6 @@ import org.codehaus.plexus.util.StringUt
 import java.io.IOException;
 import java.lang.reflect.Field;
 import java.util.Arrays;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -68,10 +67,8 @@ public class ExpressionsMojo
 
         StringBuilder sb = new StringBuilder();
         sb.append( "Maven supports the following Plugin expressions:\n\n" );
-        for ( Iterator it = getExpressionsRoot().iterator(); it.hasNext(); )
+        for ( String expression : getExpressionsRoot() )
         {
-            String expression = (String) it.next();
-
             sb.append( "${" ).append( expression ).append( "}: " );
             sb.append( NO_DESCRIPTION_AVAILABLE );
             sb.append( "\n\n" );
@@ -122,7 +119,7 @@ public class ExpressionsMojo
      * @throws MojoFailureException if any reflection exceptions occur
      * @throws MojoExecutionException if no value exists for <code>ExpressionDocumenter#EXPRESSION_ROOTS</code>
      */
-    private static List getExpressionsRoot()
+    private static List<String> getExpressionsRoot()
         throws MojoFailureException, MojoExecutionException
     {
         try

Modified: maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/SystemMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/SystemMojo.java?rev=1423261&r1=1423260&r2=1423261&view=diff
==============================================================================
--- maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/SystemMojo.java (original)
+++ maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/SystemMojo.java Tue Dec 18 02:48:07 2012
@@ -66,7 +66,7 @@ public class SystemMojo
         message.append( StringUtils.repeat( "=", LINE_LENGTH ) ).append( '\n' );
 
         Properties systemProperties = System.getProperties();
-        for ( Iterator it = systemProperties.keySet().iterator(); it.hasNext(); )
+        for ( Iterator<?> it = systemProperties.keySet().iterator(); it.hasNext(); )
         {
             String key = it.next().toString();
             message.append( "\n" );
@@ -80,7 +80,7 @@ public class SystemMojo
         try
         {
             Properties envVars = CommandLineUtils.getSystemEnvVars();
-            for ( Iterator it2 = envVars.keySet().iterator(); it2.hasNext(); )
+            for ( Iterator<?> it2 = envVars.keySet().iterator(); it2.hasNext(); )
             {
                 String key = it2.next().toString();
                 message.append( "\n" );