maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rfscho...@apache.org
Subject svn commit: r1230247 - /maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/
Date Wed, 11 Jan 2012 20:53:22 GMT
Author: rfscholte
Date: Wed Jan 11 20:53:22 2012
New Revision: 1230247

URL: http://svn.apache.org/viewvc?rev=1230247&view=rev
Log:
Another set of generics applied

Modified:
    maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java
    maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/GenerateReleasePomsPhase.java
    maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomVersionsPhase.java
    maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForBranchPhase.java
    maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhase.java
    maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForReleasePhase.java
    maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhase.java

Modified: maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java?rev=1230247&r1=1230246&r2=1230247&view=diff
==============================================================================
--- maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java
(original)
+++ maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java
Wed Jan 11 20:53:22 2012
@@ -380,12 +380,12 @@ public abstract class AbstractRewritePom
         }
     }
 
-    private void rewriteVersion( Element rootElement, Namespace namespace, Map mappedVersions,
String projectId,
+    private void rewriteVersion( Element rootElement, Namespace namespace, Map<String,
String> mappedVersions, String projectId,
                                  MavenProject project, String parentVersion )
         throws ReleaseFailureException
     {
         Element versionElement = rootElement.getChild( "version", namespace );
-        String version = (String) mappedVersions.get( projectId );
+        String version = mappedVersions.get( projectId );
         if ( version == null )
         {
             throw new ReleaseFailureException( "Version for '" + project.getName() + "' was
not mapped" );
@@ -743,12 +743,12 @@ public abstract class AbstractRewritePom
         return result;
     }
 
-    protected abstract String getResolvedSnapshotVersion( String artifactVersionlessKey,
Map resolvedSnapshots );
+    protected abstract String getResolvedSnapshotVersion( String artifactVersionlessKey,
Map<String, Map<String,String>> resolvedSnapshots );
 
-    protected abstract Map getOriginalVersionMap( ReleaseDescriptor releaseDescriptor, List<MavenProject>
reactorProjects,
+    protected abstract Map<String, String> getOriginalVersionMap( ReleaseDescriptor
releaseDescriptor, List<MavenProject> reactorProjects,
                                                   boolean simulate );
 
-    protected abstract Map getNextVersionMap( ReleaseDescriptor releaseDescriptor );
+    protected abstract Map<String,String> getNextVersionMap( ReleaseDescriptor releaseDescriptor
);
 
     protected abstract void transformScm( MavenProject project, Element rootElement, Namespace
namespace,
                                           ReleaseDescriptor releaseDescriptor, String projectId,

Modified: maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/GenerateReleasePomsPhase.java
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/GenerateReleasePomsPhase.java?rev=1230247&r1=1230246&r2=1230247&view=diff
==============================================================================
--- maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/GenerateReleasePomsPhase.java
(original)
+++ maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/GenerateReleasePomsPhase.java
Wed Jan 11 20:53:22 2012
@@ -212,8 +212,8 @@ public class GenerateReleasePomsPhase
                                       ReleaseResult result )
         throws ReleaseFailureException, ReleaseExecutionException
     {
-        Map originalVersions = getOriginalVersionMap( releaseDescriptor, reactorProjects
);
-        Map mappedVersions = getNextVersionMap( releaseDescriptor );
+        Map<String, String> originalVersions = getOriginalVersionMap( releaseDescriptor,
reactorProjects );
+        Map<String, String> mappedVersions = getNextVersionMap( releaseDescriptor );
 
         MavenProject releaseProject = new MavenProject( project );
         Model releaseModel = releaseProject.getModel();
@@ -292,12 +292,12 @@ public class GenerateReleasePomsPhase
         return execute( releaseDescriptor, releaseEnvironment, reactorProjects, true );
     }
 
-    protected Map getOriginalVersionMap( ReleaseDescriptor releaseDescriptor, List<MavenProject>
reactorProjects )
+    protected Map<String, String> getOriginalVersionMap( ReleaseDescriptor releaseDescriptor,
List<MavenProject> reactorProjects )
     {
         return releaseDescriptor.getOriginalVersions( reactorProjects );
     }
 
-    protected Map getNextVersionMap( ReleaseDescriptor releaseDescriptor )
+    protected Map<String, String> getNextVersionMap( ReleaseDescriptor releaseDescriptor
)
     {
         return releaseDescriptor.getReleaseVersions();
     }
@@ -360,26 +360,24 @@ public class GenerateReleasePomsPhase
         return releaseScm;
     }
 
-    private List<Dependency> createReleaseDependencies( Map originalVersions, Map mappedVersions,
MavenProject project )
+    private List<Dependency> createReleaseDependencies( Map<String, String> originalVersions,
Map<String, String> mappedVersions, MavenProject project )
         throws ReleaseFailureException
     {
-        Set artifacts = project.getArtifacts();
+        Set<Artifact> artifacts = project.getArtifacts();
 
         List<Dependency> releaseDependencies = null;
 
         if ( artifacts != null )
         {
             // make dependency order deterministic for tests (related to MNG-1412)
-            List orderedArtifacts = new ArrayList();
+            List<Artifact> orderedArtifacts = new ArrayList<Artifact>();
             orderedArtifacts.addAll( artifacts );
             Collections.sort( orderedArtifacts );
 
             releaseDependencies = new ArrayList<Dependency>();
 
-            for ( Iterator iterator = orderedArtifacts.iterator(); iterator.hasNext(); )
+            for ( Artifact artifact : orderedArtifacts )
             {
-                Artifact artifact = (Artifact) iterator.next();
-
                 Dependency releaseDependency = new Dependency();
 
                 releaseDependency.setGroupId( artifact.getGroupId() );
@@ -399,13 +397,13 @@ public class GenerateReleasePomsPhase
         return releaseDependencies;
     }
 
-    private String getReleaseVersion( Map originalVersions, Map mappedVersions, Artifact
artifact )
+    private String getReleaseVersion( Map<String, String> originalVersions, Map<String,
String> mappedVersions, Artifact artifact )
         throws ReleaseFailureException
     {
         String key = ArtifactUtils.versionlessKey( artifact );
 
-        String originalVersion = (String) originalVersions.get( key );
-        String mappedVersion = (String) mappedVersions.get( key );
+        String originalVersion = originalVersions.get( key );
+        String mappedVersion = mappedVersions.get( key );
 
         String version = artifact.getVersion();
 
@@ -431,7 +429,7 @@ public class GenerateReleasePomsPhase
         return version;
     }
 
-    private List<Plugin> createReleasePlugins( Map originalVersions, Map mappedVersions,
MavenProject project )
+    private List<Plugin> createReleasePlugins( Map<String, String> originalVersions,
Map<String, String> mappedVersions, MavenProject project )
         throws ReleaseFailureException
     {
         List<Plugin> releasePlugins = null;
@@ -441,19 +439,20 @@ public class GenerateReleasePomsPhase
 
         if ( build != null )
         {
-            List plugins = build.getPlugins();
+            @SuppressWarnings("unchecked")
+			List<Plugin> plugins = build.getPlugins();
 
             if ( plugins != null )
             {
-                Map artifactsById = project.getPluginArtifactMap();
+                @SuppressWarnings("unchecked")
+				Map<String, Artifact> artifactsById = project.getPluginArtifactMap();
 
                 releasePlugins = new ArrayList<Plugin>();
 
-                for ( Iterator iterator = plugins.iterator(); iterator.hasNext(); )
+                for ( Plugin plugin : plugins )
                 {
-                    Plugin plugin = (Plugin) iterator.next();
                     String id = ArtifactUtils.versionlessKey( plugin.getGroupId(), plugin.getArtifactId()
);
-                    Artifact artifact = (Artifact) artifactsById.get( id );
+                    Artifact artifact = artifactsById.get( id );
                     String version = getReleaseVersion( originalVersions, mappedVersions,
artifact );
 
                     Plugin releasePlugin = new Plugin();
@@ -475,7 +474,7 @@ public class GenerateReleasePomsPhase
         return releasePlugins;
     }
 
-    private List<ReportPlugin> createReleaseReportPlugins( Map originalVersions, Map
mappedVersions,
+    private List<ReportPlugin> createReleaseReportPlugins( Map<String, String>
originalVersions, Map<String, String> mappedVersions,
                                                            MavenProject project )
         throws ReleaseFailureException
     {
@@ -485,19 +484,18 @@ public class GenerateReleasePomsPhase
 
         if ( reporting != null )
         {
-            List reportPlugins = reporting.getPlugins();
+            List<ReportPlugin> reportPlugins = reporting.getPlugins();
 
             if ( reportPlugins != null )
             {
-                Map artifactsById = project.getReportArtifactMap();
+                Map<String, Artifact> artifactsById = project.getReportArtifactMap();
 
                 releaseReportPlugins = new ArrayList<ReportPlugin>();
 
-                for ( Iterator iterator = reportPlugins.iterator(); iterator.hasNext(); )
+                for ( ReportPlugin reportPlugin : reportPlugins )
                 {
-                    ReportPlugin reportPlugin = (ReportPlugin) iterator.next();
                     String id = ArtifactUtils.versionlessKey( reportPlugin.getGroupId(),
reportPlugin.getArtifactId() );
-                    Artifact artifact = (Artifact) artifactsById.get( id );
+                    Artifact artifact = artifactsById.get( id );
                     String version = getReleaseVersion( originalVersions, mappedVersions,
artifact );
 
                     ReportPlugin releaseReportPlugin = new ReportPlugin();
@@ -516,7 +514,7 @@ public class GenerateReleasePomsPhase
         return releaseReportPlugins;
     }
 
-    private List<Extension> createReleaseExtensions( Map originalVersions, Map mappedVersions,
MavenProject project )
+    private List<Extension> createReleaseExtensions( Map<String, String> originalVersions,
Map<String, String> mappedVersions, MavenProject project )
         throws ReleaseFailureException
     {
         List<Extension> releaseExtensions = null;
@@ -526,16 +524,14 @@ public class GenerateReleasePomsPhase
 
         if ( build != null )
         {
-            List extensions = build.getExtensions();
+            List<Extension> extensions = build.getExtensions();
 
             if ( extensions != null )
             {
                 releaseExtensions = new ArrayList<Extension>();
 
-                for ( Iterator iterator = extensions.iterator(); iterator.hasNext(); )
+                for ( Extension extension : extensions )
                 {
-                    Extension extension = (Extension) iterator.next();
-
                     String id = ArtifactUtils.versionlessKey( extension.getGroupId(), extension.getArtifactId()
);
                     Artifact artifact = (Artifact) project.getExtensionArtifactMap().get(
id );
                     String version = getReleaseVersion( originalVersions, mappedVersions,
artifact );

Modified: maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomVersionsPhase.java
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomVersionsPhase.java?rev=1230247&r1=1230246&r2=1230247&view=diff
==============================================================================
--- maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomVersionsPhase.java
(original)
+++ maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomVersionsPhase.java
Wed Jan 11 20:53:22 2012
@@ -47,18 +47,18 @@ public class RewritePomVersionsPhase
         // We are only updating versions no mods to scm needed
     }
 
-    protected Map getOriginalVersionMap( ReleaseDescriptor releaseDescriptor, List<MavenProject>
reactorProjects,
+    protected Map<String, String> getOriginalVersionMap( ReleaseDescriptor releaseDescriptor,
List<MavenProject> reactorProjects,
                                          boolean simulate )
     {
         return releaseDescriptor.getReleaseVersions();
     }
 
-    protected Map getNextVersionMap( ReleaseDescriptor releaseDescriptor )
+    protected Map<String, String> getNextVersionMap( ReleaseDescriptor releaseDescriptor
)
     {
         return releaseDescriptor.getDevelopmentVersions();
     }
 
-    protected String getResolvedSnapshotVersion( String artifactVersionlessKey, Map resolvedSnapshotsMap
)
+    protected String getResolvedSnapshotVersion( String artifactVersionlessKey, Map<String,
Map<String, String>> resolvedSnapshotsMap )
     {
         // Only update the pom version, not the dependency versions
         return null;

Modified: maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForBranchPhase.java
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForBranchPhase.java?rev=1230247&r1=1230246&r2=1230247&view=diff
==============================================================================
--- maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForBranchPhase.java
(original)
+++ maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForBranchPhase.java
Wed Jan 11 20:53:22 2012
@@ -210,23 +210,23 @@ public class RewritePomsForBranchPhase
         return result;
     }
 
-    protected Map getOriginalVersionMap( ReleaseDescriptor releaseDescriptor, List reactorProjects,
boolean simulate )
+    protected Map<String,String> getOriginalVersionMap( ReleaseDescriptor releaseDescriptor,
List<MavenProject> reactorProjects, boolean simulate )
     {
         return releaseDescriptor.getOriginalVersions( reactorProjects );
     }
 
-    protected Map getNextVersionMap( ReleaseDescriptor releaseDescriptor )
+    protected Map<String, String> getNextVersionMap( ReleaseDescriptor releaseDescriptor)
     {
         return releaseDescriptor.getReleaseVersions();
     }
 
-    protected String getResolvedSnapshotVersion( String artifactVersionlessKey, Map resolvedSnapshotsMap
)
+    protected String getResolvedSnapshotVersion( String artifactVersionlessKey, Map<String,
Map<String,String>> resolvedSnapshotsMap )
     {
-        Map versionsMap = (Map) resolvedSnapshotsMap.get( artifactVersionlessKey );
+        Map<String, String> versionsMap = resolvedSnapshotsMap.get( artifactVersionlessKey
);
 
         if ( versionsMap != null )
         {
-            return (String) versionsMap.get( ReleaseDescriptor.RELEASE_KEY );
+            return versionsMap.get( ReleaseDescriptor.RELEASE_KEY );
         }
         else
         {

Modified: maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhase.java
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhase.java?rev=1230247&r1=1230246&r2=1230247&view=diff
==============================================================================
--- maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhase.java
(original)
+++ maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForDevelopmentPhase.java
Wed Jan 11 20:53:22 2012
@@ -56,7 +56,7 @@ public class RewritePomsForDevelopmentPh
             Element scmRoot = rootElement.getChild( "scm", namespace );
             if ( scmRoot != null )
             {
-                Map originalScmInfo = releaseDescriptor.getOriginalScmInfo();
+                Map<String, Scm> originalScmInfo = releaseDescriptor.getOriginalScmInfo();
                 // check containsKey, not == null, as we store null as a value
                 if ( !originalScmInfo.containsKey( projectId ) )
                 {
@@ -67,7 +67,7 @@ public class RewritePomsForDevelopmentPh
                 ScmTranslator translator = scmTranslators.get( scmRepository.getProvider()
);
                 if ( translator != null )
                 {
-                    Scm scm = (Scm) originalScmInfo.get( projectId );
+                    Scm scm = originalScmInfo.get( projectId );
 
                     if ( scm != null )
                     {
@@ -92,21 +92,21 @@ public class RewritePomsForDevelopmentPh
         }
     }
 
-    protected Map getOriginalVersionMap( ReleaseDescriptor releaseDescriptor, List reactorProjects,
boolean simulate )
+    protected Map<String,String> getOriginalVersionMap( ReleaseDescriptor releaseDescriptor,
List<MavenProject> reactorProjects, boolean simulate )
     {
         return simulate
             ? releaseDescriptor.getOriginalVersions( reactorProjects )
             : releaseDescriptor.getReleaseVersions();
     }
 
-    protected Map getNextVersionMap( ReleaseDescriptor releaseDescriptor )
+    protected Map<String,String> getNextVersionMap( ReleaseDescriptor releaseDescriptor
)
     {
         return releaseDescriptor.getDevelopmentVersions();
     }
 
-    protected String getResolvedSnapshotVersion( String artifactVersionlessKey, Map resolvedSnapshotsMap
)
+	protected String getResolvedSnapshotVersion(String artifactVersionlessKey, Map<String,
Map<String, String>> resolvedSnapshotsMap )
     {
-        Map versionsMap = (Map) resolvedSnapshotsMap.get( artifactVersionlessKey );
+        Map<String, String> versionsMap = resolvedSnapshotsMap.get( artifactVersionlessKey
);
 
         if ( versionsMap != null )
         {

Modified: maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForReleasePhase.java
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForReleasePhase.java?rev=1230247&r1=1230246&r2=1230247&view=diff
==============================================================================
--- maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForReleasePhase.java
(original)
+++ maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RewritePomsForReleasePhase.java
Wed Jan 11 20:53:22 2012
@@ -233,19 +233,19 @@ public class RewritePomsForReleasePhase
         return result;
     }
 
-    protected Map getOriginalVersionMap( ReleaseDescriptor releaseDescriptor, List<MavenProject>
reactorProjects, boolean simulate )
+    protected Map<String,String> getOriginalVersionMap( ReleaseDescriptor releaseDescriptor,
List<MavenProject> reactorProjects, boolean simulate )
     {
         return releaseDescriptor.getOriginalVersions( reactorProjects );
     }
 
-    protected Map getNextVersionMap( ReleaseDescriptor releaseDescriptor )
+    protected Map<String,String> getNextVersionMap( ReleaseDescriptor releaseDescriptor
)
     {
         return releaseDescriptor.getReleaseVersions();
     }
 
-    protected String getResolvedSnapshotVersion( String artifactVersionlessKey, Map resolvedSnapshotsMap
)
+    protected String getResolvedSnapshotVersion( String artifactVersionlessKey, Map<String,
Map<String, String>> resolvedSnapshotsMap )
     {
-        Map versionsMap = (Map) resolvedSnapshotsMap.get( artifactVersionlessKey );
+        Map<String, String> versionsMap = resolvedSnapshotsMap.get( artifactVersionlessKey
);
 
         if ( versionsMap != null )
         {

Modified: maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhase.java
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhase.java?rev=1230247&r1=1230246&r2=1230247&view=diff
==============================================================================
--- maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhase.java
(original)
+++ maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhase.java
Wed Jan 11 20:53:22 2012
@@ -19,6 +19,7 @@ package org.apache.maven.shared.release.
  * under the License.
  */
 
+import org.apache.maven.project.MavenProject;
 import org.apache.maven.shared.release.ReleaseExecutionException;
 import org.apache.maven.shared.release.ReleaseFailureException;
 import org.apache.maven.shared.release.ReleaseResult;
@@ -45,7 +46,7 @@ public class ScmCommitPreparationPhase
     private String rollbackMessageFormat;
 
     protected void runLogic( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment,
-                             List reactorProjects, ReleaseResult result, boolean simulating
)
+                             List<MavenProject> reactorProjects, ReleaseResult result,
boolean simulating )
         throws ReleaseScmCommandException, ReleaseExecutionException, ReleaseScmRepositoryException
     {
         // no prepare-commit required



Mime
View raw message