generics and Java 5 constructs

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1244229 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Herve Boutemy 2012-02-14 21:55:36 +00:00
parent 7bf2294941
commit 43518f56f4
6 changed files with 14 additions and 16 deletions

View File

@ -106,7 +106,7 @@ public class DefaultMavenProjectHelper
} }
} }
public void addResource( MavenProject project, String resourceDirectory, List includes, List excludes ) public void addResource( MavenProject project, String resourceDirectory, List<String> includes, List<String> excludes )
{ {
Resource resource = new Resource(); Resource resource = new Resource();
resource.setDirectory( resourceDirectory ); resource.setDirectory( resourceDirectory );
@ -116,7 +116,7 @@ public class DefaultMavenProjectHelper
project.addResource( resource ); project.addResource( resource );
} }
public void addTestResource( MavenProject project, String resourceDirectory, List includes, List excludes ) public void addTestResource( MavenProject project, String resourceDirectory, List<String> includes, List<String> excludes )
{ {
Resource resource = new Resource(); Resource resource = new Resource();
resource.setDirectory( resourceDirectory ); resource.setDirectory( resourceDirectory );

View File

@ -32,8 +32,8 @@ public interface MavenProjectHelper
void attachArtifact( MavenProject project, String artifactType, String artifactClassifier, File artifactFile ); void attachArtifact( MavenProject project, String artifactType, String artifactClassifier, File artifactFile );
void addResource( MavenProject project, String resourceDirectory, List includes, List excludes ); void addResource( MavenProject project, String resourceDirectory, List<String> includes, List<String> excludes );
void addTestResource( MavenProject project, String resourceDirectory, List includes, List excludes ); void addTestResource( MavenProject project, String resourceDirectory, List<String> includes, List<String> excludes );
} }

View File

@ -25,6 +25,7 @@ import org.apache.maven.artifact.InvalidArtifactRTException;
import org.apache.maven.artifact.handler.ArtifactHandler; import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.artifact.metadata.ArtifactMetadata; import org.apache.maven.artifact.metadata.ArtifactMetadata;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.artifact.versioning.VersionRange;
import java.util.Collection; import java.util.Collection;
@ -71,12 +72,12 @@ public class AttachedArtifact
+ " It is derived from the main artifact." ); + " It is derived from the main artifact." );
} }
public List getAvailableVersions() public List<ArtifactVersion> getAvailableVersions()
{ {
return parent.getAvailableVersions(); return parent.getAvailableVersions();
} }
public void setAvailableVersions( List availableVersions ) public void setAvailableVersions( List<ArtifactVersion> availableVersions )
{ {
throw new UnsupportedOperationException( "Cannot change the version information for an attached artifact." throw new UnsupportedOperationException( "Cannot change the version information for an attached artifact."
+ " It is derived from the main artifact." ); + " It is derived from the main artifact." );
@ -176,9 +177,9 @@ public class AttachedArtifact
// we must fail silently here to avoid problems with the artifact transformers. // we must fail silently here to avoid problems with the artifact transformers.
} }
public Collection getMetadataList() public Collection<ArtifactMetadata> getMetadataList()
{ {
return Collections.EMPTY_LIST; return Collections.emptyList();
} }
} }

View File

@ -52,7 +52,6 @@ import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion; import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Dependency; import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement; import org.apache.maven.model.DependencyManagement;
import org.apache.maven.model.DistributionManagement; import org.apache.maven.model.DistributionManagement;

View File

@ -20,7 +20,6 @@ package org.apache.maven.toolchain;
*/ */
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.Map; import java.util.Map;
import org.apache.maven.toolchain.model.ToolchainModel; import org.apache.maven.toolchain.model.ToolchainModel;
@ -74,12 +73,11 @@ public abstract class DefaultToolchain
} }
public boolean matchesRequirements( Map requirements ) public boolean matchesRequirements( Map<String, String> requirements )
{ {
Iterator it = requirements.keySet().iterator(); for ( Map.Entry<String, String> requirement : requirements.entrySet() )
while ( it.hasNext() )
{ {
String key = (String) it.next(); String key = requirement.getKey();
RequirementMatcher matcher = provides.get( key ); RequirementMatcher matcher = provides.get( key );
@ -88,7 +86,7 @@ public abstract class DefaultToolchain
getLog().debug( "Toolchain " + this + " is missing required property: " + key ); getLog().debug( "Toolchain " + this + " is missing required property: " + key );
return false; return false;
} }
if ( !matcher.matches( (String) requirements.get( key ) ) ) if ( !matcher.matches( requirement.getValue() ) )
{ {
getLog().debug( "Toolchain " + this + " doesn't match required property: " + key ); getLog().debug( "Toolchain " + this + " doesn't match required property: " + key );
return false; return false;

View File

@ -37,7 +37,7 @@ public interface ToolchainPrivate
* @param requirements Map<String, String> key value pair * @param requirements Map<String, String> key value pair
* @return * @return
*/ */
boolean matchesRequirements( Map requirements ); boolean matchesRequirements( Map<String, String> requirements );
ToolchainModel getModel(); ToolchainModel getModel();