[seam-commits] Seam SVN: r10915 - maven-plugins/trunk/seam-instrument-wicket/src/main/java/org/jboss/seam/wicket.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Fri May 15 15:21:05 EDT 2009


Author: cpopetz
Date: 2009-05-15 15:21:05 -0400 (Fri, 15 May 2009)
New Revision: 10915

Modified:
   maven-plugins/trunk/seam-instrument-wicket/src/main/java/org/jboss/seam/wicket/InstrumentationMojo.java
Log:
JBSEAM-4139


Modified: maven-plugins/trunk/seam-instrument-wicket/src/main/java/org/jboss/seam/wicket/InstrumentationMojo.java
===================================================================
--- maven-plugins/trunk/seam-instrument-wicket/src/main/java/org/jboss/seam/wicket/InstrumentationMojo.java	2009-05-15 15:43:44 UTC (rev 10914)
+++ maven-plugins/trunk/seam-instrument-wicket/src/main/java/org/jboss/seam/wicket/InstrumentationMojo.java	2009-05-15 19:21:05 UTC (rev 10915)
@@ -3,8 +3,10 @@
 import java.io.File;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.regex.Pattern;
 
 import javassist.ClassPool;
@@ -20,7 +22,7 @@
  * This mojo takes classes specified with the "includes" parameter in the plugin configuration
  * and instruments them with Seam's Wicket JavassistInstrumentor.
  * @goal instrument
- * @requiresDependencyResolution
+ * @requiresDependencyResolution compile
  * @phase process-classes
  */
 public class InstrumentationMojo extends AbstractMojo
@@ -140,18 +142,11 @@
 
          JavassistInstrumentor instrumentor = new JavassistInstrumentor(classPool, scanAnnotations);
 
-         List<String> classes = new ArrayList<String>();
+         Set<String> classes = new HashSet<String>();
          visitDir(classesDirectory, classes);
 
-         for (String path : classes)
-         {
-            instrumentedClasses.put(path, instrumentor.instrumentClass(filenameToClassname(path)));
-         }
-         for (Map.Entry<String, CtClass> entry : instrumentedClasses.entrySet())
-         {
-            if (entry.getValue().isModified())
-               entry.getValue().writeFile(classesDirectory.getPath());
-         }
+         
+         instrumentor.instrumentClassSet(classes, classesDirectory.getPath());
       }
       catch (Exception e)
       {
@@ -160,7 +155,7 @@
       }
    }
 
-   private void visitDir(File classesDir, List<String> classes)
+   private void visitDir(File classesDir, Set<String> classes)
    {
       for (File file : classesDir.listFiles())
       {
@@ -170,7 +165,7 @@
             {
                if (pat.matcher(file.getPath()).find())
                {
-                  classes.add(file.getPath());
+                  classes.add(filenameToClassname(file.getPath()));
                   break;
                }
             }




More information about the seam-commits mailing list