o Added generics

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@806542 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-08-21 13:20:50 +00:00
parent 199bcd45b6
commit 9d87933ca3
3 changed files with 8 additions and 7 deletions

View File

@ -39,7 +39,7 @@ import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
* Why not just extend ComponentDescriptor here?
*/
public class MojoDescriptor
extends ComponentDescriptor
extends ComponentDescriptor<Mojo>
implements Cloneable
{
/** The Plexus component type */

View File

@ -90,9 +90,10 @@ public class PluginDescriptor
//
// ----------------------------------------------------------------------
public List getMojos()
@SuppressWarnings( "unchecked" )
public List<MojoDescriptor> getMojos()
{
return getComponents();
return (List) getComponents();
}
public void addMojo( MojoDescriptor mojoDescriptor )
@ -102,13 +103,13 @@ public class PluginDescriptor
// this relies heavily on the equals() and hashCode() for ComponentDescriptor,
// which uses role:roleHint for identity...and roleHint == goalPrefix:goal.
// role does not vary for Mojos.
List mojos = getComponents();
List<MojoDescriptor> mojos = getMojos();
if ( mojos != null && mojos.contains( mojoDescriptor ) )
{
int indexOf = mojos.indexOf( mojoDescriptor );
existing = (MojoDescriptor) mojos.get( indexOf );
existing = mojos.get( indexOf );
}
if ( existing != null )

View File

@ -62,7 +62,7 @@ public class PluginDescriptorBuilderTest
assertEquals( 1, pd.getMojos().size() );
assertEquals( 1, pd.getDependencies().size() );
MojoDescriptor md = (MojoDescriptor) pd.getMojos().get( 0 );
MojoDescriptor md = pd.getMojos().get( 0 );
assertEquals( "jar", md.getGoal() );
assertEquals( "mojo-description", md.getDescription() );
@ -104,7 +104,7 @@ public class PluginDescriptorBuilderTest
assertEquals( "parameter-description", mp.getDescription() );
assertEquals( "deprecated-parameter", mp.getDeprecated() );
ComponentRequirement cr = (ComponentRequirement) md.getRequirements().get( 0 );
ComponentRequirement cr = md.getRequirements().get( 0 );
assertEquals( "org.codehaus.plexus.archiver.Archiver", cr.getRole() );
assertEquals( "jar", cr.getRoleHint() );