[MNG-4912] Use of raw type should be Comparable<ArtifactVersion>

Submitted by: Jesse Glick

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1039332 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-11-26 12:37:37 +00:00
parent 990f4519fe
commit a78ef2d826
4 changed files with 13 additions and 7 deletions

View File

@ -27,7 +27,7 @@ package org.apache.maven.artifact.versioning;
* @version $Id$ * @version $Id$
*/ */
public interface ArtifactVersion public interface ArtifactVersion
extends Comparable extends Comparable<ArtifactVersion>
{ {
int getMajorVersion(); int getMajorVersion();

View File

@ -66,13 +66,19 @@ public class DefaultArtifactVersion
return false; return false;
} }
return compareTo( other ) == 0; return compareTo( (ArtifactVersion) other ) == 0;
} }
public int compareTo( Object o ) public int compareTo( ArtifactVersion otherVersion )
{ {
DefaultArtifactVersion otherVersion = (DefaultArtifactVersion) o; if ( otherVersion instanceof DefaultArtifactVersion )
return this.comparable.compareTo( otherVersion.comparable ); {
return this.comparable.compareTo( ( (DefaultArtifactVersion) otherVersion).comparable );
}
else
{
return compareTo( new DefaultArtifactVersion( otherVersion.toString() ) );
}
} }
public int getMajorVersion() public int getMajorVersion()

View File

@ -30,7 +30,7 @@ import org.codehaus.plexus.component.annotations.Component;
* *
* @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a> * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
* @version $Id$ * @version $Id$
* @see ArtifactVersion#compareTo(Object) * @see ArtifactVersion#compareTo
* @since 3.0 * @since 3.0
*/ */
@Component( role = ConflictResolver.class, hint = "newest" ) @Component( role = ConflictResolver.class, hint = "newest" )

View File

@ -30,7 +30,7 @@ import org.codehaus.plexus.component.annotations.Component;
* *
* @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a> * @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
* @version $Id$ * @version $Id$
* @see ArtifactVersion#compareTo(Object) * @see ArtifactVersion#compareTo
* @since 3.0 * @since 3.0
*/ */
@Component( role = ConflictResolver.class, hint = "oldest" ) @Component( role = ConflictResolver.class, hint = "oldest" )