Author: hboutemy
Date: Thu Sep 10 13:18:03 2009
New Revision: 813421
URL: http://svn.apache.org/viewvc?rev=813421&view=rev
Log:
use Java 5 generics (merged ftom maven-3 r804537)
Modified:
maven/maven-2/branches/maven-2.2.x/maven-settings/ (props changed)
maven/maven-2/branches/maven-2.2.x/maven-settings/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java
maven/maven-2/branches/maven-2.2.x/maven-settings/src/main/java/org/apache/maven/settings/SettingsUtils.java
Propchange: maven/maven-2/branches/maven-2.2.x/maven-settings/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Thu Sep 10 13:18:03 2009
@@ -0,0 +1,8 @@
+/maven/components/branches/maven-2.0.10-RC/maven-settings:679193-679867,680477-688882,708790-728809,728834
+/maven/components/branches/maven-2.0.x/maven-settings:679552-679867,693956-728820,728836,728940,729060,729738,729785,730461,730631,734502,734803,736543,746381
+/maven/components/branches/maven-2.1.0-M1-RC/maven-settings:690315,691793-694304
+/maven/components/branches/maven-2.1.0-RC/maven-settings:688883,689695,689976,689990,752168,752428,752622,752653,753089-753090,753320,755086,755199,755215
+/maven/components/branches/maven-2.1.x/maven-settings:751686,767628,767631,768817,768995,769010-769011
+/maven/components/trunk/maven-core:804537
+/maven/components/trunk/maven-settings:572229,720001,721902,726845,729292,792073
+/maven/sandbox/branches/maven/MNG-3379/maven-settings:678167
Modified:
maven/maven-2/branches/maven-2.2.x/maven-settings/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java
URL:
http://svn.apache.org/viewvc/maven/maven-2/branches/maven-2.2.x/maven-settings/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java?rev=813421&r1=813420&r2=813421&view=diff
==============================================================================
---
maven/maven-2/branches/maven-2.2.x/maven-settings/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java
(original)
+++
maven/maven-2/branches/maven-2.2.x/maven-settings/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java
Thu Sep 10 13:18:03 2009
@@ -187,7 +187,7 @@
private void activateDefaultProfiles( Settings settings )
{
- List activeProfiles = settings.getActiveProfiles();
+ List<String> activeProfiles = settings.getActiveProfiles();
for ( Iterator profiles = settings.getProfiles().iterator();
profiles.hasNext(); )
{
@@ -241,13 +241,13 @@
//
-------------------------------------------------------------------------------------
// Alright, here's the justification for all the regexp wizardry
below...
//
- // Continuum and other server-like apps may need to locate the
user-level and
+ // Continuum and other server-like apps may need to locate the
user-level and
// global-level settings somewhere other than ${user.home} and
${maven.home},
// respectively. Using a simple replacement of these patterns will
allow them
// to specify the absolute path to these files in a customized
components.xml
// file. Ideally, we'd do full pattern-evaluation against the
sysprops, but this
// is a first step. There are several replacements below, in order to
normalize
- // the path character before we operate on the string as a regex
input, and
+ // the path character before we operate on the string as a regex
input, and
// in order to avoid surprises with the File construction...
//
-------------------------------------------------------------------------------------
@@ -270,7 +270,7 @@
path = path.replaceAll( "\\\\", "/" );
//
---------------------------------------------------------------------------------
// I'm not sure if this last regexp was really intended to
disallow the usage of
- // network paths as user.home directory. Unfortunately it did. I
removed it and
+ // network paths as user.home directory. Unfortunately it did. I
removed it and
// have not detected any problems yet.
//
---------------------------------------------------------------------------------
// path = path.replaceAll( "//", "/" );
Modified:
maven/maven-2/branches/maven-2.2.x/maven-settings/src/main/java/org/apache/maven/settings/SettingsUtils.java
URL:
http://svn.apache.org/viewvc/maven/maven-2/branches/maven-2.2.x/maven-settings/src/main/java/org/apache/maven/settings/SettingsUtils.java?rev=813421&r1=813420&r2=813421&view=diff
==============================================================================
---
maven/maven-2/branches/maven-2.2.x/maven-settings/src/main/java/org/apache/maven/settings/SettingsUtils.java
(original)
+++
maven/maven-2/branches/maven-2.2.x/maven-settings/src/main/java/org/apache/maven/settings/SettingsUtils.java
Thu Sep 10 13:18:03 2009
@@ -24,7 +24,6 @@
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -55,21 +54,19 @@
recessive.setSourceLevel( recessiveSourceLevel );
- List dominantActiveProfiles = dominant.getActiveProfiles();
- List recessiveActiveProfiles = recessive.getActiveProfiles();
+ List<String> dominantActiveProfiles = dominant.getActiveProfiles();
+ List<String> recessiveActiveProfiles = recessive.getActiveProfiles();
if ( recessiveActiveProfiles != null )
{
if ( dominantActiveProfiles == null )
{
- dominantActiveProfiles = new ArrayList();
+ dominantActiveProfiles = new ArrayList<String>();
dominant.setActiveProfiles( dominantActiveProfiles );
}
- for ( Iterator it = recessiveActiveProfiles.iterator();
it.hasNext(); )
+ for ( String profileId : recessiveActiveProfiles )
{
- String profileId = (String) it.next();
-
if ( !dominantActiveProfiles.contains( profileId ) )
{
dominantActiveProfiles.add( profileId );
@@ -79,21 +76,19 @@
}
}
- List dominantPluginGroupIds = dominant.getPluginGroups();
- List recessivePluginGroupIds = recessive.getPluginGroups();
+ List<String> dominantPluginGroupIds = dominant.getPluginGroups();
+ List<String> recessivePluginGroupIds = recessive.getPluginGroups();
if ( recessivePluginGroupIds != null )
{
if ( dominantPluginGroupIds == null )
{
- dominantPluginGroupIds = new ArrayList();
+ dominantPluginGroupIds = new ArrayList<String>();
dominant.setPluginGroups( dominantPluginGroupIds );
}
- for ( Iterator it = recessivePluginGroupIds.iterator();
it.hasNext(); )
+ for ( String pluginGroupId : recessivePluginGroupIds )
{
- String pluginGroupId = (String) it.next();
-
if ( !dominantPluginGroupIds.contains( pluginGroupId ) )
{
dominantPluginGroupIds.add( pluginGroupId );
@@ -121,14 +116,13 @@
* @param recessive
* @param recessiveSourceLevel
*/
- private static void shallowMergeById( List dominant, List recessive,
String recessiveSourceLevel )
+ private static <T extends IdentifiableBase> void shallowMergeById( List<T>
dominant, List<T> recessive,
+ String
recessiveSourceLevel )
{
- Map dominantById = mapById( dominant );
+ Map<String, T> dominantById = mapById( dominant );
- for ( Iterator it = recessive.iterator(); it.hasNext(); )
+ for ( T identifiable : recessive )
{
- IdentifiableBase identifiable = (IdentifiableBase) it.next();
-
if ( !dominantById.containsKey( identifiable.getId() ) )
{
identifiable.setSourceLevel( recessiveSourceLevel );
@@ -142,14 +136,12 @@
* @param identifiables
* @return a map
*/
- private static Map mapById( List identifiables )
+ private static <T extends IdentifiableBase> Map<String, T> mapById(
List<T> identifiables )
{
- Map byId = new HashMap();
+ Map<String, T> byId = new HashMap<String, T>();
- for ( Iterator it = identifiables.iterator(); it.hasNext(); )
+ for ( T identifiable : identifiables )
{
- IdentifiableBase identifiable = (IdentifiableBase) it.next();
-
byId.put( identifiable.getId(), identifiable );
}
@@ -221,21 +213,21 @@
profile.setProperties( settingsProfile.getProperties() );
- List repos = settingsProfile.getRepositories();
+ List<Repository> repos = settingsProfile.getRepositories();
if ( repos != null )
{
- for ( Iterator it = repos.iterator(); it.hasNext(); )
+ for ( Repository repo : repos )
{
- profile.addRepository( convertFromSettingsRepository(
(Repository) it.next() ) );
+ profile.addRepository( convertFromSettingsRepository( repo ) );
}
}
- List pluginRepos = settingsProfile.getPluginRepositories();
+ List<Repository> pluginRepos = settingsProfile.getPluginRepositories();
if ( pluginRepos != null )
{
- for ( Iterator it = pluginRepos.iterator(); it.hasNext(); )
+ for ( Repository pluginRepo : pluginRepos )
{
- profile.addPluginRepository( convertFromSettingsRepository(
(Repository) it.next() ) );
+ profile.addPluginRepository( convertFromSettingsRepository(
pluginRepo ) );
}
}