maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1300151 - in /maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade: ./ filter/ mojo/ pom/ relocation/
Date Tue, 13 Mar 2012 14:36:02 GMT
Author: olamy
Date: Tue Mar 13 14:36:01 2012
New Revision: 1300151

URL: http://svn.apache.org/viewvc?rev=1300151&view=rev
Log:
add more generics

Modified:
    maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/DefaultShader.java
    maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/ShadeConfiguration.java
    maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/Shader.java
    maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/ShadingResult.java
    maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/TempRemappingClassAdapter.java
    maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/filter/SimpleFilter.java
    maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ArchiveFilter.java
    maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ArtifactSelector.java
    maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ArtifactSet.java
    maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/PackageRelocation.java
    maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
    maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/pom/PomWriter.java
    maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/relocation/SimpleRelocator.java

Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/DefaultShader.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/DefaultShader.java?rev=1300151&r1=1300150&r2=1300151&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/DefaultShader.java
(original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/DefaultShader.java
Tue Mar 13 14:36:01 2012
@@ -57,7 +57,7 @@ public class DefaultShader
     implements Shader
 {
 
-    public void shade( Set jars, File uberJar, List filters, List<Relocator> relocators,
+    public void shade( Set<File> jars, File uberJar, List<Filter> filters, List<Relocator>
relocators,
                        List<ResourceTransformer> resourceTransformers )
         throws IOException, MojoExecutionException
     {
@@ -82,9 +82,8 @@ public class DefaultShader
 
         if ( manifestTransformer != null )
         {
-            for ( Iterator it = jars.iterator(); it.hasNext(); )
+            for ( File jar : jars )
             {
-                File jar = (File) it.next();
                 JarFile jarFile = newJarFile( jar );
                 for ( Enumeration en = jarFile.entries(); en.hasMoreElements(); )
                 {
@@ -104,9 +103,8 @@ public class DefaultShader
             }
         }
 
-        for ( Iterator i = jars.iterator(); i.hasNext(); )
+        for ( File jar : jars )
         {
-            File jar = (File) i.next();
 
             getLogger().debug( "Processing JAR " + jar );
 
@@ -114,9 +112,9 @@ public class DefaultShader
 
             JarFile jarFile = newJarFile( jar );
 
-            for ( Enumeration j = jarFile.entries(); j.hasMoreElements(); )
+            for ( Enumeration<JarEntry> j = jarFile.entries(); j.hasMoreElements();
)
             {
-                JarEntry entry = (JarEntry) j.nextElement();
+                JarEntry entry = j.nextElement();
 
                 String name = entry.getName();
 
@@ -182,9 +180,8 @@ public class DefaultShader
 
         IOUtil.close( jos );
 
-        for ( Iterator it = filters.iterator(); it.hasNext(); )
+        for ( Filter filter : filters )
         {
-            Filter filter = (Filter) it.next();
             filter.finished();
         }
     }
@@ -204,14 +201,12 @@ public class DefaultShader
         }
     }
 
-    private List getFilters( File jar, List filters )
+    private List<Filter> getFilters( File jar, List<Filter> filters )
     {
-        List list = new ArrayList();
+        List<Filter> list = new ArrayList<Filter>();
 
-        for ( int i = 0; i < filters.size(); i++ )
+        for ( Filter filter : filters )
         {
-            Filter filter = (Filter) filters.get( i );
-
             if ( filter.canFilter( jar ) )
             {
                 list.add( filter );
@@ -298,12 +293,10 @@ public class DefaultShader
         }
     }
 
-    private boolean isFiltered( List filters, String name )
+    private boolean isFiltered( List<Filter> filters, String name )
     {
-        for ( int i = 0; i < filters.size(); i++ )
+        for ( Filter filter : filters )
         {
-            Filter filter = (Filter) filters.get( i );
-
             if ( filter.isFiltered( name ) )
             {
                 return true;
@@ -314,15 +307,13 @@ public class DefaultShader
     }
 
     private boolean resourceTransformed( List<ResourceTransformer> resourceTransformers,
String name, InputStream is,
-                                         List relocators )
+                                         List<Relocator> relocators )
         throws IOException
     {
         boolean resourceTransformed = false;
 
-        for ( Iterator<ResourceTransformer> k = resourceTransformers.iterator(); k.hasNext();
)
+        for ( ResourceTransformer transformer : resourceTransformers )
         {
-            ResourceTransformer transformer = k.next();
-
             if ( transformer.canTransformResource( name ) )
             {
                 getLogger().debug( "Transforming " + name + " using " + transformer.getClass().getName()
);
@@ -383,10 +374,8 @@ public class DefaultShader
                     name = m.group( 2 );
                 }
 
-                for ( Iterator i = relocators.iterator(); i.hasNext(); )
+                for ( Relocator r : relocators )
                 {
-                    Relocator r = (Relocator) i.next();
-
                     if ( r.canRelocateClass( name ) )
                     {
                         value = prefix + r.relocateClass( name ) + suffix;
@@ -420,10 +409,8 @@ public class DefaultShader
                 name = m.group( 2 );
             }
 
-            for ( Iterator i = relocators.iterator(); i.hasNext(); )
+            for ( Relocator r : relocators )
             {
-                Relocator r = (Relocator) i.next();
-
                 if ( r.canRelocatePath( name ) )
                 {
                     value = prefix + r.relocatePath( name ) + suffix;

Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/ShadeConfiguration.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/ShadeConfiguration.java?rev=1300151&r1=1300150&r2=1300151&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/ShadeConfiguration.java
(original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/ShadeConfiguration.java
Tue Mar 13 14:36:01 2012
@@ -19,7 +19,11 @@ package org.apache.maven.plugins.shade;
  * under the License.
  */
 
-/** @author Jason van Zyl */
+/**
+ * @author Jason van Zyl
+ */
 public interface ShadeConfiguration
 {
+    // no op
+    // olamy: what this class ??
 }

Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/Shader.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/Shader.java?rev=1300151&r1=1300150&r2=1300151&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/Shader.java
(original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/Shader.java
Tue Mar 13 14:36:01 2012
@@ -20,6 +20,7 @@ package org.apache.maven.plugins.shade;
  */
 
 import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.shade.filter.Filter;
 import org.apache.maven.plugins.shade.relocation.Relocator;
 import org.apache.maven.plugins.shade.resource.ResourceTransformer;
 
@@ -46,7 +47,7 @@ public interface Shader
      * @throws IOException            for IO errors reading the thing
      * @throws MojoExecutionException for anything else that goes wrong.
      */
-    void shade( Set jars, File uberJar, List filters, List<Relocator> relocators,
+    void shade( Set<File> jars, File uberJar, List<Filter> filters, List<Relocator>
relocators,
                 List<ResourceTransformer> resourceTransformers )
         throws IOException, MojoExecutionException;
 }

Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/ShadingResult.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/ShadingResult.java?rev=1300151&r1=1300150&r2=1300151&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/ShadingResult.java
(original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/ShadingResult.java
Tue Mar 13 14:36:01 2012
@@ -19,7 +19,11 @@ package org.apache.maven.plugins.shade;
  * under the License.
  */
 
-/** @author Jason van Zyl */
+/**
+ * @author Jason van Zyl
+ */
 public class ShadingResult
 {
+    // no op
+    // olamy: what this class ??
 }

Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/TempRemappingClassAdapter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/TempRemappingClassAdapter.java?rev=1300151&r1=1300150&r2=1300151&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/TempRemappingClassAdapter.java
(original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/TempRemappingClassAdapter.java
Tue Mar 13 14:36:01 2012
@@ -31,7 +31,7 @@ import org.objectweb.asm.commons.Remappi
 
 /**
  * A temporary class to fix a bug in objectweb asm.
- * 
+ *
  * @see <a href="http://forge.ow2.org/tracker/index.php?func=detail&aid=314982&group_id=23&atid=100023">bug
#314982</a>
  */
 class TempRemappingClassAdapter

Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/filter/SimpleFilter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/filter/SimpleFilter.java?rev=1300151&r1=1300150&r2=1300151&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/filter/SimpleFilter.java
(original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/filter/SimpleFilter.java
Tue Mar 13 14:36:01 2012
@@ -23,7 +23,6 @@ import org.codehaus.plexus.util.Selector
 
 import java.io.File;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Set;
 
 /**
@@ -33,13 +32,13 @@ public class SimpleFilter
     implements Filter
 {
 
-    private Set jars;
+    private Set<File> jars;
 
-    private Set includes;
+    private Set<String> includes;
 
-    private Set excludes;
+    private Set<String> excludes;
 
-    public SimpleFilter( Set jars, Set includes, Set excludes )
+    public SimpleFilter( Set<File> jars, Set<String> includes, Set<String>
excludes )
     {
         this.jars = ( jars != null ) ? new HashSet( jars ) : new HashSet();
         this.includes = normalizePatterns( includes );
@@ -90,11 +89,10 @@ public class SimpleFilter
         return matchPaths( excludes, classFile );
     }
 
-    private boolean matchPaths( Set patterns, String classFile )
+    private boolean matchPaths( Set<String> patterns, String classFile )
     {
-        for ( Iterator iterator = patterns.iterator(); iterator.hasNext(); )
+        for ( String pattern : patterns )
         {
-            String pattern = (String) iterator.next();
 
             if ( SelectorUtils.matchPath( pattern, classFile ) )
             {
@@ -110,16 +108,14 @@ public class SimpleFilter
         return ( path != null ) ? path.replace( File.separatorChar == '/' ? '\\' : '/', File.separatorChar
) : null;
     }
 
-    private Set normalizePatterns( Set patterns )
+    private Set normalizePatterns( Set<String> patterns )
     {
-        Set result = new HashSet();
+        Set<String> result = new HashSet<String>();
 
         if ( patterns != null )
         {
-            for ( Iterator it = patterns.iterator(); it.hasNext(); )
+            for ( String pattern : patterns )
             {
-                String pattern = (String) it.next();
-
                 pattern = normalizePath( pattern );
 
                 if ( pattern.endsWith( File.separator ) )

Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ArchiveFilter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ArchiveFilter.java?rev=1300151&r1=1300150&r2=1300151&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ArchiveFilter.java
(original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ArchiveFilter.java
Tue Mar 13 14:36:01 2012
@@ -28,21 +28,21 @@ public class ArchiveFilter
 {
     private String artifact;
 
-    private Set includes;
+    private Set<String> includes;
 
-    private Set excludes;
+    private Set<String> excludes;
 
     public String getArtifact()
     {
         return artifact;
     }
 
-    public Set getIncludes()
+    public Set<String> getIncludes()
     {
         return includes;
     }
 
-    public Set getExcludes()
+    public Set<String> getExcludes()
     {
         return excludes;
     }

Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ArtifactSelector.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ArtifactSelector.java?rev=1300151&r1=1300150&r2=1300151&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ArtifactSelector.java
(original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ArtifactSelector.java
Tue Mar 13 14:36:01 2012
@@ -19,11 +19,10 @@ package org.apache.maven.plugins.shade.m
  * under the License.
  */
 
+import org.apache.maven.artifact.Artifact;
+
 import java.util.Collection;
 import java.util.HashSet;
-import java.util.Iterator;
-
-import org.apache.maven.artifact.Artifact;
 
 /**
  * @author Benjamin Bentmann
@@ -31,9 +30,9 @@ import org.apache.maven.artifact.Artifac
 class ArtifactSelector
 {
 
-    private Collection includes;
+    private Collection<ArtifactId> includes;
 
-    private Collection excludes;
+    private Collection<ArtifactId> excludes;
 
     public ArtifactSelector( Artifact projectArtifact, ArtifactSet artifactSet, String groupPrefix
)
     {
@@ -46,7 +45,7 @@ class ArtifactSelector
         }
     }
 
-    public ArtifactSelector( Collection includes, Collection excludes, String groupPrefix
)
+    public ArtifactSelector( Collection<String> includes, Collection<String>
excludes, String groupPrefix )
     {
         this.includes = toIds( includes );
         this.excludes = toIds( excludes );
@@ -57,15 +56,14 @@ class ArtifactSelector
         }
     }
 
-    private static Collection toIds( Collection patterns )
+    private static Collection<ArtifactId> toIds( Collection<String> patterns
)
     {
-        Collection result = new HashSet();
+        Collection<ArtifactId> result = new HashSet<ArtifactId>();
 
         if ( patterns != null )
         {
-            for ( Iterator it = patterns.iterator(); it.hasNext(); )
+            for ( String pattern : patterns )
             {
-                String pattern = (String) it.next();
                 result.add( new ArtifactId( pattern ) );
             }
         }
@@ -83,11 +81,10 @@ class ArtifactSelector
         return ( includes.isEmpty() || matches( includes, id ) ) && !matches( excludes,
id );
     }
 
-    private boolean matches( Collection patterns, ArtifactId id )
+    private boolean matches( Collection<ArtifactId> patterns, ArtifactId id )
     {
-        for ( Iterator it = patterns.iterator(); it.hasNext(); )
+        for ( ArtifactId pattern : patterns )
         {
-            ArtifactId pattern = (ArtifactId) it.next();
             if ( id.matches( pattern ) )
             {
                 return true;

Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ArtifactSet.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ArtifactSet.java?rev=1300151&r1=1300150&r2=1300151&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ArtifactSet.java
(original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ArtifactSet.java
Tue Mar 13 14:36:01 2012
@@ -21,19 +21,21 @@ package org.apache.maven.plugins.shade.m
 
 import java.util.Set;
 
-/** @author Jason van Zyl */
+/**
+ * @author Jason van Zyl
+ */
 public class ArtifactSet
 {
-    private Set includes;
+    private Set<String> includes;
 
-    private Set excludes;
+    private Set<String> excludes;
 
-    public Set getIncludes()
+    public Set<String> getIncludes()
     {
         return includes;
     }
 
-    public Set getExcludes()
+    public Set<String> getExcludes()
     {
         return excludes;
     }

Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/PackageRelocation.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/PackageRelocation.java?rev=1300151&r1=1300150&r2=1300151&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/PackageRelocation.java
(original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/PackageRelocation.java
Tue Mar 13 14:36:01 2012
@@ -31,10 +31,10 @@ public class PackageRelocation
 
     private String shadedPattern;
 
-    private List includes;
+    private List<String> includes;
+
+    private List<String> excludes;
 
-    private List excludes;
-    
     private boolean rawString;
 
     public String getPattern()
@@ -47,16 +47,16 @@ public class PackageRelocation
         return shadedPattern;
     }
 
-    public List getIncludes()
+    public List<String> getIncludes()
     {
         return includes;
     }
 
-    public List getExcludes()
+    public List<String> getExcludes()
     {
         return excludes;
     }
-    
+
     public boolean isRawString()
     {
         return rawString;

Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java?rev=1300151&r1=1300150&r2=1300151&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
(original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
Tue Mar 13 14:36:01 2012
@@ -37,6 +37,7 @@ import org.apache.maven.plugins.shade.fi
 import org.apache.maven.plugins.shade.filter.MinijarFilter;
 import org.apache.maven.plugins.shade.filter.SimpleFilter;
 import org.apache.maven.plugins.shade.pom.PomWriter;
+import org.apache.maven.plugins.shade.relocation.Relocator;
 import org.apache.maven.plugins.shade.relocation.SimpleRelocator;
 import org.apache.maven.plugins.shade.resource.ResourceTransformer;
 import org.apache.maven.project.MavenProject;
@@ -437,11 +438,11 @@ public class ShadeMojo
         // Now add our extra resources
         try
         {
-            List filters = getFilters();
+            List<Filter> filters = getFilters();
 
-            List relocators = getRelocators();
+            List<Relocator> relocators = getRelocators();
 
-            List resourceTransformers = getResourceTransformers();
+            List<ResourceTransformer> resourceTransformers = getResourceTransformers();
 
             shader.shade( artifacts, outputJar, filters, relocators, resourceTransformers
);
 
@@ -600,9 +601,9 @@ public class ShadeMojo
         return null;
     }
 
-    private List getRelocators()
+    private List<Relocator> getRelocators()
     {
-        List relocators = new ArrayList();
+        List<Relocator> relocators = new ArrayList<Relocator>();
 
         if ( relocations == null )
         {
@@ -620,17 +621,17 @@ public class ShadeMojo
         return relocators;
     }
 
-    private List getResourceTransformers()
+    private List<ResourceTransformer> getResourceTransformers()
     {
         if ( transformers == null )
         {
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
         }
 
         return Arrays.asList( transformers );
     }
 
-    private List getFilters()
+    private List<Filter> getFilters()
         throws MojoExecutionException
     {
         List<Filter> filters = new ArrayList<Filter>();
@@ -655,7 +656,7 @@ public class ShadeMojo
 
                 ArtifactId pattern = new ArtifactId( filter.getArtifact() );
 
-                Set jars = new HashSet();
+                Set<File> jars = new HashSet<File>();
 
                 for ( Iterator it = artifacts.entrySet().iterator(); it.hasNext(); )
                 {
@@ -750,11 +751,11 @@ public class ShadeMojo
         throws IOException, DependencyTreeBuilderException, ProjectBuildingException
     {
         Model model = project.getOriginalModel();
-        List dependencies = new ArrayList();
+        List<Dependency> dependencies = new ArrayList<Dependency>();
 
         boolean modified = false;
 
-        List transitiveDeps = new ArrayList();
+        List<Dependency> transitiveDeps = new ArrayList<Dependency>();
 
         for ( Iterator it = project.getArtifacts().iterator(); it.hasNext(); )
         {

Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/pom/PomWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/pom/PomWriter.java?rev=1300151&r1=1300150&r2=1300151&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/pom/PomWriter.java
(original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/pom/PomWriter.java
Tue Mar 13 14:36:01 2012
@@ -19,28 +19,27 @@ package org.apache.maven.plugins.shade.p
  * under the License.
  */
 
-import java.io.IOException;
-import java.io.Writer;
-
 import org.apache.maven.model.Model;
 import org.jdom.Document;
 import org.jdom.Element;
 import org.jdom.Namespace;
 import org.jdom.output.Format;
 
-/** @author Jason van Zyl */
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author Jason van Zyl
+ */
 public class PomWriter
 {
-    public static void write( Writer w,
-                              Model newModel )
+    public static void write( Writer w, Model newModel )
         throws IOException
-        {
+    {
         write( w, newModel, false );
     }
 
-    public static void write( Writer w,
-                              Model newModel,
-                              boolean namespaceDeclaration )
+    public static void write( Writer w, Model newModel, boolean namespaceDeclaration )
         throws IOException
     {
         Element root = new Element( "project" );
@@ -59,8 +58,9 @@ public class PomWriter
 
             if ( root.getAttribute( "schemaLocation", xsiNamespace ) == null )
             {
-                root.setAttribute( "schemaLocation", "http://maven.apache.org/POM/" + modelVersion
-                    + " http://maven.apache.org/maven-v" + modelVersion.replace( '.', '_'
) + ".xsd", xsiNamespace );
+                root.setAttribute( "schemaLocation",
+                                   "http://maven.apache.org/POM/" + modelVersion + " http://maven.apache.org/maven-v"
+                                       + modelVersion.replace( '.', '_' ) + ".xsd", xsiNamespace
);
             }
         }
 

Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/relocation/SimpleRelocator.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/relocation/SimpleRelocator.java?rev=1300151&r1=1300150&r2=1300151&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/relocation/SimpleRelocator.java
(original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/relocation/SimpleRelocator.java
Tue Mar 13 14:36:01 2012
@@ -22,7 +22,6 @@ package org.apache.maven.plugins.shade.r
 import org.codehaus.plexus.util.SelectorUtils;
 
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
@@ -44,18 +43,19 @@ public class SimpleRelocator
 
     private final String shadedPathPattern;
 
-    private final Set includes;
+    private final Set<String> includes;
 
-    private final Set excludes;
+    private final Set<String> excludes;
 
     private final boolean rawString;
 
-    public SimpleRelocator( String patt, String shadedPattern, List includes, List excludes
)
+    public SimpleRelocator( String patt, String shadedPattern, List<String> includes,
List<String> excludes )
     {
         this( patt, shadedPattern, includes, excludes, false );
     }
 
-    public SimpleRelocator( String patt, String shadedPattern, List includes, List excludes,
boolean rawString )
+    public SimpleRelocator( String patt, String shadedPattern, List<String> includes,
List<String> excludes,
+                            boolean rawString )
     {
         this.rawString = rawString;
 
@@ -96,17 +96,16 @@ public class SimpleRelocator
         this.excludes = normalizePatterns( excludes );
     }
 
-    private static Set normalizePatterns( Collection patterns )
+    private static Set<String> normalizePatterns( Collection<String> patterns
)
     {
-        Set normalized = null;
+        Set<String> normalized = null;
 
         if ( patterns != null && !patterns.isEmpty() )
         {
-            normalized = new LinkedHashSet();
+            normalized = new LinkedHashSet<String>();
 
-            for ( Iterator i = patterns.iterator(); i.hasNext(); )
+            for ( String pattern : patterns )
             {
-                String pattern = (String) i.next();
 
                 String classPattern = pattern.replace( '.', '/' );
 
@@ -127,10 +126,8 @@ public class SimpleRelocator
     {
         if ( includes != null && !includes.isEmpty() )
         {
-            for ( Iterator i = includes.iterator(); i.hasNext(); )
+            for ( String include : includes )
             {
-                String include = (String) i.next();
-
                 if ( SelectorUtils.matchPath( include, path, true ) )
                 {
                     return true;
@@ -145,10 +142,8 @@ public class SimpleRelocator
     {
         if ( excludes != null && !excludes.isEmpty() )
         {
-            for ( Iterator i = excludes.iterator(); i.hasNext(); )
+            for ( String exclude : excludes )
             {
-                String exclude = (String) i.next();
-
                 if ( SelectorUtils.matchPath( exclude, path, true ) )
                 {
                     return true;



Mime
View raw message