maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject svn commit: r1340746 - /maven/plugin-testing/trunk/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java
Date Sun, 20 May 2012 14:52:12 GMT
Author: hboutemy
Date: Sun May 20 14:52:12 2012
New Revision: 1340746

URL: http://svn.apache.org/viewvc?rev=1340746&view=rev
Log:
added generics

Modified:
    maven/plugin-testing/trunk/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java

Modified: maven/plugin-testing/trunk/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java
URL: http://svn.apache.org/viewvc/maven/plugin-testing/trunk/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java?rev=1340746&r1=1340745&r2=1340746&view=diff
==============================================================================
--- maven/plugin-testing/trunk/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java
(original)
+++ maven/plugin-testing/trunk/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java
Sun May 20 14:52:12 2012
@@ -449,10 +449,8 @@ public abstract class AbstractMojoTestCa
             {
                 Xpp3Dom[] pluginElements = pluginsRootElement.getChildren();
 
-                for ( int i = 0; i < pluginElements.length; i++ )
+                for ( Xpp3Dom pluginElement : pluginElements )
                 {
-                    Xpp3Dom pluginElement = pluginElements[i];
-
                     String pluginElementArtifactId = pluginElement.getChild( "artifactId"
).getValue();
 
                     if ( pluginElementArtifactId.equals( artifactId ) )
@@ -551,7 +549,7 @@ public abstract class AbstractMojoTestCa
      * @param object
      * @return map of variable names and values
      */
-    protected Map getVariablesAndValuesFromObject( Object object )
+    protected Map<String, Object> getVariablesAndValuesFromObject( Object object )
         throws IllegalAccessException
     {
         return getVariablesAndValuesFromObject( object.getClass(), object );
@@ -566,24 +564,21 @@ public abstract class AbstractMojoTestCa
      * @param object
      * @return map of variable names and values
      */
-    protected Map getVariablesAndValuesFromObject( Class clazz, Object object )
+    protected Map<String, Object> getVariablesAndValuesFromObject( Class<?> clazz,
Object object )
         throws IllegalAccessException
     {
-        Map map = new HashMap();
+        Map<String, Object> map = new HashMap<String, Object>();
 
         Field[] fields = clazz.getDeclaredFields();
 
         AccessibleObject.setAccessible( fields, true );
 
-        for ( int i = 0; i < fields.length; ++i )
+        for ( Field field : fields )
         {
-            Field field = fields[i];
-
             map.put( field.getName(), field.get( object ) );
-
         }
 
-        Class superclass = clazz.getSuperclass();
+        Class<?> superclass = clazz.getSuperclass();
 
         if ( !Object.class.equals( superclass ) )
         {



Mime
View raw message