On 25 July 2013 21:54,  <rfscho...@apache.org> wrote:
> Author: rfscholte
> Date: Thu Jul 25 20:54:43 2013
> New Revision: 1507123
>
> URL: http://svn.apache.org/r1507123
> Log:
> apply generics
>
> Modified:
>     
> maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/AbstractInstallMojo.java
>     
> maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java
>     
> maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java
>
> Modified: 
> maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/AbstractInstallMojo.java
> URL: 
> http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/AbstractInstallMojo.java?rev=1507123&r1=1507122&r2=1507123&view=diff
> ==============================================================================
> --- 
> maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/AbstractInstallMojo.java
>  (original)
> +++ 
> maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/AbstractInstallMojo.java
>  Thu Jul 25 20:54:43 2013
> @@ -19,6 +19,10 @@ package org.apache.maven.plugin.install;
>   * under the License.
>   */
>
> +import java.io.File;
> +import java.io.IOException;
> +import java.util.Collection;
> +
>  import org.apache.maven.artifact.Artifact;
>  import org.apache.maven.artifact.factory.ArtifactFactory;
>  import org.apache.maven.artifact.installer.ArtifactInstaller;
> @@ -32,11 +36,6 @@ import org.codehaus.plexus.digest.Digest
>  import org.codehaus.plexus.digest.DigesterException;
>  import org.codehaus.plexus.util.FileUtils;
>
> -import java.io.File;
> -import java.io.IOException;
> -import java.util.Collection;
> -import java.util.Iterator;
> -
>  /**
>   * Common fields for installation mojos.
>   *
> @@ -126,7 +125,7 @@ public abstract class AbstractInstallMoj
>       *            must not be <code>null</code>.
>       * @throws MojoExecutionException If the checksums could not be 
> installed.
>       */
> -    protected void installChecksums( Artifact artifact, Collection 
> metadataFiles )
> +    protected void installChecksums( Artifact artifact, Collection<File> 
> metadataFiles )
>          throws MojoExecutionException
>      {
>          if ( !createChecksum )
> @@ -137,12 +136,12 @@ public abstract class AbstractInstallMoj
>          File artifactFile = getLocalRepoFile( artifact );
>          installChecksums( artifactFile );
>
> -        Collection metadatas = artifact.getMetadataList();
> +        @SuppressWarnings( "unchecked" )

Why is it safe to ignore the unchecked warning?
This should be documented in an inline comment, e.g.
@SuppressWarnings( "unchecked" ) // safe because ...

If it's not true that the warning can be safely ignored, then either
leave the warning, or document under what circumstances the code can
fail

> +        Collection<ArtifactMetadata> metadatas = artifact.getMetadataList();
>          if ( metadatas != null )
>          {
> -            for ( Iterator it = metadatas.iterator(); it.hasNext(); )
> +            for ( ArtifactMetadata metadata : metadatas )
>              {
> -                ArtifactMetadata metadata = (ArtifactMetadata) it.next();
>                  File metadataFile = getLocalRepoFile( metadata );
>                  metadataFiles.add( metadataFile );
>              }
> @@ -155,12 +154,11 @@ public abstract class AbstractInstallMoj
>       * @param metadataFiles The collection of metadata files to install 
> checksums for, must not be <code>null</code>.
>       * @throws MojoExecutionException If the checksums could not be 
> installed.
>       */
> -    protected void installChecksums( Collection metadataFiles )
> +    protected void installChecksums( Collection<File> metadataFiles )
>          throws MojoExecutionException
>      {
> -        for ( Iterator it = metadataFiles.iterator(); it.hasNext(); )
> +        for ( File metadataFile : metadataFiles )
>          {
> -            File metadataFile = (File) it.next();
>              installChecksums( metadataFile );
>          }
>      }
>
> Modified: 
> maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java
> URL: 
> http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java?rev=1507123&r1=1507122&r2=1507123&view=diff
> ==============================================================================
> --- 
> maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java
>  (original)
> +++ 
> maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallFileMojo.java
>  Thu Jul 25 20:54:43 2013
> @@ -153,7 +153,7 @@ public class InstallFileMojo
>       * Map that contains the repository layouts.
>       */
>      @Component( role = ArtifactRepositoryLayout.class )
> -    private Map repositoryLayouts;
> +    private Map<String, ArtifactRepositoryLayout> repositoryLayouts;
>
>      /**
>       * The path for a specific local repository directory. If not specified 
> the local repository path configured in the
> @@ -305,7 +305,7 @@ public class InstallFileMojo
>              artifact.setRelease( true );
>          }
>
> -        Collection metadataFiles = new LinkedHashSet();
> +        Collection<File> metadataFiles = new LinkedHashSet<File>();
>
>          // TODO: maybe not strictly correct, while we should enforce that 
> packaging has a type handler of the same id,
>          // we don't
>
> Modified: 
> maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java
> URL: 
> http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java?rev=1507123&r1=1507122&r2=1507123&view=diff
> ==============================================================================
> --- 
> maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java
>  (original)
> +++ 
> maven/plugins/trunk/maven-install-plugin/src/main/java/org/apache/maven/plugin/install/InstallMojo.java
>  Thu Jul 25 20:54:43 2013
> @@ -21,7 +21,6 @@ package org.apache.maven.plugin.install;
>
>  import java.io.File;
>  import java.util.Collection;
> -import java.util.Iterator;
>  import java.util.LinkedHashSet;
>  import java.util.List;
>
> @@ -95,7 +94,7 @@ public class InstallMojo
>       * @deprecated either use project.getAttachedArtifacts() or 
> reactorProjects.get(i).getAttachedArtifacts()
>       */
>      @Parameter( defaultValue = "${project.attachedArtifacts}", required = 
> true, readonly = true )
> -    private List attachedArtifacts;
> +    private List<Artifact> attachedArtifacts;
>
>      public void execute()
>          throws MojoExecutionException
> @@ -134,7 +133,8 @@ public class InstallMojo
>          Artifact artifact = project.getArtifact();
>          String packaging = project.getPackaging();
>          File pomFile = project.getFile();
> -        List attachedArtifacts = project.getAttachedArtifacts();
> +        @SuppressWarnings( "unchecked" )
> +        List<Artifact> attachedArtifacts = project.getAttachedArtifacts();
>
>          // TODO: push into transformation
>          boolean isPomArtifact = "pom".equals( packaging );
> @@ -148,7 +148,7 @@ public class InstallMojo
>
>          try
>          {
> -            Collection metadataFiles = new LinkedHashSet();
> +            Collection<File> metadataFiles = new LinkedHashSet<File>();
>
>              if ( isPomArtifact )
>              {
> @@ -192,10 +192,8 @@ public class InstallMojo
>                  }
>              }
>
> -            for ( Iterator i = attachedArtifacts.iterator(); i.hasNext(); )
> +            for ( Artifact attached : attachedArtifacts )
>              {
> -                Artifact attached = (Artifact) i.next();
> -
>                  installer.install( attached.getFile(), attached, 
> localRepository );
>                  installChecksums( attached, metadataFiles );
>              }
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to