maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rfscho...@apache.org
Subject svn commit: r1722464 - in /maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly: archive/phase/wrappers/ repository/ repository/model/
Date Thu, 31 Dec 2015 20:20:54 GMT
Author: rfscholte
Date: Thu Dec 31 20:20:54 2015
New Revision: 1722464

URL: http://svn.apache.org/viewvc?rev=1722464&view=rev
Log:
Apply generics, remove casts

Modified:
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/archive/phase/wrappers/RepoInfoWrapper.java
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/DefaultRepositoryAssembler.java
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/model/DefaultRepositoryInfo.java
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/model/GroupVersionAlignment.java
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/model/RepositoryInfo.java

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/archive/phase/wrappers/RepoInfoWrapper.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/archive/phase/wrappers/RepoInfoWrapper.java?rev=1722464&r1=1722463&r2=1722464&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/archive/phase/wrappers/RepoInfoWrapper.java
(original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/archive/phase/wrappers/RepoInfoWrapper.java
Thu Dec 31 20:20:54 2015
@@ -35,7 +35,7 @@ public class RepoInfoWrapper
 
     private final Repository repo;
 
-    private List<GroupVersionAlignmentWrapper> convertedAlignments;
+    private List<org.apache.maven.plugins.assembly.repository.model.GroupVersionAlignment>
convertedAlignments;
 
     /**
      * @param repo The {@link Repository}
@@ -58,14 +58,14 @@ public class RepoInfoWrapper
      * {@inheritDoc}
      */
     @Override
-    public List<GroupVersionAlignmentWrapper> getGroupVersionAlignments()
+    public List<org.apache.maven.plugins.assembly.repository.model.GroupVersionAlignment>
getGroupVersionAlignments()
     {
         final List<GroupVersionAlignment> alignments = repo.getGroupVersionAlignments();
 
         if ( convertedAlignments == null || alignments.size() != convertedAlignments.size()
)
         {
-            final List<GroupVersionAlignmentWrapper> l =
-                new ArrayList<GroupVersionAlignmentWrapper>( alignments.size() );
+            final List<org.apache.maven.plugins.assembly.repository.model.GroupVersionAlignment>
l =
+                new ArrayList<org.apache.maven.plugins.assembly.repository.model.GroupVersionAlignment>(
alignments.size() );
 
             for ( final GroupVersionAlignment alignment : alignments )
             {

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/DefaultRepositoryAssembler.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/DefaultRepositoryAssembler.java?rev=1722464&r1=1722463&r2=1722464&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/DefaultRepositoryAssembler.java
(original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/DefaultRepositoryAssembler.java
Thu Dec 31 20:20:54 2015
@@ -153,13 +153,13 @@ public class DefaultRepositoryAssembler
         MavenProject project = configSource.getProject();
         ArtifactRepository localRepository = configSource.getLocalRepository();
 
-        Map groupVersionAlignments = createGroupVersionAlignments( repository.getGroupVersionAlignments()
);
+        Map<String, GroupVersionAlignment> groupVersionAlignments = createGroupVersionAlignments(
repository.getGroupVersionAlignments() );
 
         ArtifactRepository targetRepository = createLocalRepository( repositoryDirectory
);
 
         ArtifactResolutionResult result = null;
 
-        Set dependencyArtifacts = project.getDependencyArtifacts();
+        Set<Artifact> dependencyArtifacts = project.getDependencyArtifacts();
 
         if ( dependencyArtifacts == null )
         {
@@ -244,20 +244,18 @@ public class DefaultRepositoryAssembler
         // descriptor everytime the POM is updated.
         // ----------------------------------------------------------------------------
 
-        List includes = repository.getIncludes();
+        List<String> includes = repository.getIncludes();
 
         if ( ( includes == null ) || includes.isEmpty() )
         {
             List<String> patterns = new ArrayList<String>();
 
-            Set projectArtifacts = project.getDependencyArtifacts();
+            Set<Artifact> projectArtifacts = project.getDependencyArtifacts();
 
             if ( projectArtifacts != null )
             {
-                for ( Object projectArtifact : projectArtifacts )
+                for ( Artifact artifact : projectArtifacts )
                 {
-                    Artifact artifact = (Artifact) projectArtifact;
-
                     patterns.add( artifact.getDependencyConflictId() );
                 }
             }
@@ -279,7 +277,7 @@ public class DefaultRepositoryAssembler
         // up everything.
         // ----------------------------------------------------------------------------
 
-        List excludes = repository.getExcludes();
+        List<String> excludes = repository.getExcludes();
 
         if ( ( excludes != null ) && !excludes.isEmpty() )
         {
@@ -292,7 +290,7 @@ public class DefaultRepositoryAssembler
     private void assembleRepositoryArtifacts( ArtifactResolutionResult result, ArtifactFilter
filter,
                                               MavenProject project, ArtifactRepository localRepository,
                                               ArtifactRepository targetRepository, File repositoryDirectory,
-                                              Map groupVersionAlignments )
+                                              Map<String, GroupVersionAlignment> groupVersionAlignments
)
         throws RepositoryAssemblyException
     {
         try
@@ -304,10 +302,8 @@ public class DefaultRepositoryAssembler
 
             FileUtils.mkdir( repositoryDirectory.getAbsolutePath() );
 
-            for ( Object o : result.getArtifacts() )
+            for ( Artifact a : result.getArtifacts() )
             {
-                Artifact a = (Artifact) o;
-
                 if ( filter.include( a ) )
                 {
                     getLogger().debug( "Re-resolving: " + a + " for repository assembly."
);
@@ -346,13 +342,13 @@ public class DefaultRepositoryAssembler
         }
     }
 
-    private void addPomWithAncestry( final Artifact artifact, List remoteArtifactRepositories,
+    private void addPomWithAncestry( final Artifact artifact, List<ArtifactRepository>
remoteArtifactRepositories,
                                      ArtifactRepository localRepository, ArtifactRepository
targetRepository,
-                                     Map groupVersionAlignments, MavenProject masterProject
)
+                                     Map<String, GroupVersionAlignment> groupVersionAlignments,
MavenProject masterProject )
         throws RepositoryAssemblyException
     {
         String type = artifact.getType();
-        Map refs = masterProject.getProjectReferences();
+        Map<String, MavenProject> refs = masterProject.getProjectReferences();
 
         String projectKey = ArtifactUtils.versionlessKey( artifact );
 
@@ -363,7 +359,7 @@ public class DefaultRepositoryAssembler
         }
         else if ( refs.containsKey( projectKey ) )
         {
-            p = (MavenProject) refs.get( projectKey );
+            p = refs.get( projectKey );
         }
         else
         {
@@ -443,9 +439,8 @@ public class DefaultRepositoryAssembler
     private ArtifactRepository findCentralRepository( MavenProject project )
     {
         ArtifactRepository centralRepository = null;
-        for ( Object o : project.getRemoteArtifactRepositories() )
+        for ( ArtifactRepository r : project.getRemoteArtifactRepositories() )
         {
-            ArtifactRepository r = (ArtifactRepository) o;
             if ( "central".equals( r.getId() ) )
             {
                 centralRepository = r;
@@ -459,10 +454,8 @@ public class DefaultRepositoryAssembler
                                              ArtifactRepository centralRepository, ArtifactRepository
targetRepository )
         throws RepositoryAssemblyException
     {
-        for ( Object o : result.getArtifacts() )
+        for ( Artifact a : result.getArtifacts() )
         {
-            Artifact a = (Artifact) o;
-
             if ( filter.include( a ) )
             {
                 Versioning v = new Versioning();
@@ -538,16 +531,14 @@ public class DefaultRepositoryAssembler
                              sha1.toLowerCase() );
     }
 
-    protected Map createGroupVersionAlignments( List versionAlignments )
+    protected Map<String, GroupVersionAlignment> createGroupVersionAlignments( List<GroupVersionAlignment>
versionAlignments )
     {
-        Map groupVersionAlignments = new HashMap();
+        Map<String, GroupVersionAlignment> groupVersionAlignments = new HashMap<String,
GroupVersionAlignment>();
 
         if ( versionAlignments != null )
         {
-            for ( Object versionAlignment : versionAlignments )
+            for ( GroupVersionAlignment alignment : versionAlignments )
             {
-                GroupVersionAlignment alignment = (GroupVersionAlignment) versionAlignment;
-
                 groupVersionAlignments.put( alignment.getId(), alignment );
             }
         }
@@ -601,7 +592,7 @@ public class DefaultRepositoryAssembler
     private void invalidateProccessedProjectCache()
         throws Exception
     {
-        Class klass = DefaultMavenProjectBuilder.class;
+        Class<DefaultMavenProjectBuilder> klass = DefaultMavenProjectBuilder.class;
 
         try
         {
@@ -621,9 +612,9 @@ public class DefaultRepositoryAssembler
         }
     }
 
-    private void setAlignment( Artifact artifact, Map groupVersionAlignments )
+    private void setAlignment( Artifact artifact, Map<String, GroupVersionAlignment>
groupVersionAlignments )
     {
-        GroupVersionAlignment alignment = (GroupVersionAlignment) groupVersionAlignments.get(
artifact.getGroupId() );
+        GroupVersionAlignment alignment = groupVersionAlignments.get( artifact.getGroupId()
);
 
         if ( alignment != null )
         {
@@ -636,13 +627,13 @@ public class DefaultRepositoryAssembler
 
     // TODO: Remove this, once we can depend on Maven 2.0.7 or later...in which
     // MavenProject.getManagedVersionMap() exists. This is from MNG-1577.
-    private Map getManagedVersionMap( MavenProject project )
+    private Map<String, Artifact> getManagedVersionMap( MavenProject project )
         throws InvalidVersionSpecificationException
     {
         DependencyManagement dependencyManagement = project.getModel().getDependencyManagement();
 
         Map<String, Artifact> map;
-        List deps = ( dependencyManagement == null ) ? null : dependencyManagement.getDependencies();
+        List<Dependency> deps = ( dependencyManagement == null ) ? null : dependencyManagement.getDependencies();
         if ( ( deps != null ) && ( deps.size() > 0 ) )
         {
             map = new HashMap<String, Artifact>();
@@ -652,10 +643,8 @@ public class DefaultRepositoryAssembler
                 getLogger().debug( "Adding managed dependencies for " + project.getId() );
             }
 
-            for ( Object o1 : dependencyManagement.getDependencies() )
+            for ( Dependency d : dependencyManagement.getDependencies() )
             {
-                Dependency d = (Dependency) o1;
-
                 VersionRange versionRange = VersionRange.createFromVersionSpec( d.getVersion()
);
                 Artifact artifact =
                     artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(),
versionRange,
@@ -672,9 +661,8 @@ public class DefaultRepositoryAssembler
                 if ( ( null != d.getExclusions() ) && !d.getExclusions().isEmpty()
)
                 {
                     List<String> exclusions = new ArrayList<String>();
-                    for ( Object o : d.getExclusions() )
+                    for ( Exclusion e : d.getExclusions() )
                     {
-                        Exclusion e = (Exclusion) o;
                         exclusions.add( e.getGroupId() + ":" + e.getArtifactId() );
                     }
                     ExcludesArtifactFilter eaf = new ExcludesArtifactFilter( exclusions );
@@ -703,7 +691,7 @@ public class DefaultRepositoryAssembler
         {
             try
             {
-                artifactResolver = (ArtifactResolver) container.lookup( ArtifactResolver.ROLE,
hint );
+                artifactResolver = container.lookup( ArtifactResolver.class, hint );
                 break;
             }
             catch ( ComponentLookupException e )
@@ -716,7 +704,7 @@ public class DefaultRepositoryAssembler
         {
             try
             {
-                artifactResolver = (ArtifactResolver) container.lookup( ArtifactResolver.ROLE
);
+                artifactResolver = container.lookup( ArtifactResolver.class );
             }
             catch ( ComponentLookupException e )
             {

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/model/DefaultRepositoryInfo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/model/DefaultRepositoryInfo.java?rev=1722464&r1=1722463&r2=1722464&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/model/DefaultRepositoryInfo.java
(original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/model/DefaultRepositoryInfo.java
Thu Dec 31 20:20:54 2015
@@ -34,18 +34,18 @@ public class DefaultRepositoryInfo
 
     private String scope = Artifact.SCOPE_COMPILE;
 
-    private List includes;
+    private List<String> includes;
 
-    private List groupVersionAlignments;
+    private List<GroupVersionAlignment> groupVersionAlignments;
 
-    private List excludes;
+    private List<String> excludes;
 
-    public List getExcludes()
+    public List<String> getExcludes()
     {
         return excludes;
     }
 
-    public void setGroupVersionAlignments( List groupVersionAlignments )
+    public void setGroupVersionAlignments( List<GroupVersionAlignment> groupVersionAlignments
)
     {
         this.groupVersionAlignments = groupVersionAlignments;
     }
@@ -55,7 +55,7 @@ public class DefaultRepositoryInfo
         this.includeMetadata = includeMetadata;
     }
 
-    public void setIncludes( List includes )
+    public void setIncludes( List<String> includes )
     {
         this.includes = includes;
     }
@@ -65,12 +65,12 @@ public class DefaultRepositoryInfo
         this.scope = scope;
     }
 
-    public List getGroupVersionAlignments()
+    public List<GroupVersionAlignment> getGroupVersionAlignments()
     {
         return groupVersionAlignments;
     }
 
-    public List getIncludes()
+    public List<String> getIncludes()
     {
         return includes;
     }
@@ -85,7 +85,7 @@ public class DefaultRepositoryInfo
         return includeMetadata;
     }
 
-    public void setExcludes( List excludes )
+    public void setExcludes( List<String> excludes )
     {
         this.excludes = excludes;
     }

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/model/GroupVersionAlignment.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/model/GroupVersionAlignment.java?rev=1722464&r1=1722463&r2=1722464&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/model/GroupVersionAlignment.java
(original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/model/GroupVersionAlignment.java
Thu Dec 31 20:20:54 2015
@@ -29,7 +29,7 @@ public interface GroupVersionAlignment
 
     String getId();
 
-    List getExcludes();
+    List<String> getExcludes();
 
     String getVersion();
 

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/model/RepositoryInfo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/model/RepositoryInfo.java?rev=1722464&r1=1722463&r2=1722464&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/model/RepositoryInfo.java
(original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugins/assembly/repository/model/RepositoryInfo.java
Thu Dec 31 20:20:54 2015
@@ -27,14 +27,14 @@ import java.util.List;
 public interface RepositoryInfo
 {
 
-    List getGroupVersionAlignments();
+    List<GroupVersionAlignment> getGroupVersionAlignments();
 
     boolean isIncludeMetadata();
 
     String getScope();
 
-    List getIncludes();
+    List<String> getIncludes();
 
-    List getExcludes();
+    List<String> getExcludes();
 
 }



Mime
View raw message