maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rfscho...@apache.org
Subject svn commit: r1237048 - in /maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd: CpdReport.java CpdReportGenerator.java PmdViolationCheckMojo.java
Date Sat, 28 Jan 2012 11:46:22 GMT
Author: rfscholte
Date: Sat Jan 28 11:46:21 2012
New Revision: 1237048

URL: http://svn.apache.org/viewvc?rev=1237048&view=rev
Log:
Add generics and remove unused imports

Modified:
    maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReport.java
    maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReportGenerator.java
    maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdViolationCheckMojo.java

Modified: maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReport.java?rev=1237048&r1=1237047&r2=1237048&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReport.java
(original)
+++ maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReport.java
Sat Jan 28 11:46:21 2012
@@ -26,7 +26,6 @@ import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.io.UnsupportedEncodingException;
 import java.io.Writer;
-import java.util.Iterator;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Properties;
@@ -42,8 +41,8 @@ import net.sourceforge.pmd.cpd.XMLRender
 import org.apache.maven.reporting.MavenReportException;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.WriterFactory;
 import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.WriterFactory;
 
 /**
  * Creates a report for PMD's CPD tool.  See
@@ -161,7 +160,7 @@ public class CpdReport
         }
         CPD cpd = new CPD( minimumTokens, new JavaLanguage( p ) );
 
-        Map files = null;
+        Map<File, PmdFileInfo> files = null;
         try
         {
             files = getFilesToProcess();
@@ -180,9 +179,9 @@ public class CpdReport
                                    + WriterFactory.FILE_ENCODING + ", i.e. build is platform
dependent!" );
             }
 
-            for ( Iterator it = files.keySet().iterator(); it.hasNext(); )
+            for ( File file : files.keySet() )
             {
-                cpd.add( (File) it.next() );
+                cpd.add( file );
             }
         }
         catch ( UnsupportedEncodingException e )

Modified: maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReportGenerator.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReportGenerator.java?rev=1237048&r1=1237047&r2=1237048&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReportGenerator.java
(original)
+++ maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/CpdReportGenerator.java
Sat Jan 28 11:46:21 2012
@@ -41,13 +41,13 @@ public class CpdReportGenerator
 {
     private Sink sink;
 
-    private Map fileMap;
+    private Map<File, PmdFileInfo> fileMap;
 
     private ResourceBundle bundle;
 
     private boolean aggregate;
 
-    public CpdReportGenerator( Sink sink, Map fileMap, ResourceBundle bundle, boolean aggregate
)
+    public CpdReportGenerator( Sink sink, Map<File, PmdFileInfo> fileMap, ResourceBundle
bundle, boolean aggregate )
     {
         this.sink = sink;
         this.fileMap = fileMap;
@@ -111,7 +111,7 @@ public class CpdReportGenerator
         // Get information for report generation
         String filename = tokenEntry.getTokenSrcID();
         File file = new File( filename );
-        PmdFileInfo fileInfo = (PmdFileInfo) fileMap.get( file );
+        PmdFileInfo fileInfo = fileMap.get( file );
         File sourceDirectory = fileInfo.getSourceDirectory();
         filename = StringUtils.substring( filename, sourceDirectory.getAbsolutePath().length()
+ 1 );
         String xrefLocation = fileInfo.getXrefLocation();
@@ -150,6 +150,7 @@ public class CpdReportGenerator
      *
      * @param matches
      */
+    @SuppressWarnings( "deprecation" )
     public void generate( Iterator<Match> matches )
     {
         beginDocument();

Modified: maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdViolationCheckMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdViolationCheckMojo.java?rev=1237048&r1=1237047&r2=1237048&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdViolationCheckMojo.java
(original)
+++ maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdViolationCheckMojo.java
Sat Jan 28 11:46:21 2012
@@ -32,7 +32,6 @@ import org.apache.maven.plugin.pmd.model
 import org.apache.maven.plugin.pmd.model.Violation;
 import org.apache.maven.plugin.pmd.model.io.xpp3.PmdXpp3Reader;
 import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.xml.pull.XmlPullParser;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
 /**



Mime
View raw message