o Optimized performance (the string concatenation in getId() severely affected ReactorArtifactRepository which in turn is heavily used for key calculation/comparision in the plugin & metadata cache)

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@795939 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-07-20 18:13:49 +00:00
parent 4363bdecef
commit 9a6561c6f6
1 changed files with 15 additions and 6 deletions

View File

@ -1598,18 +1598,27 @@ public class MavenProject
{
return false;
}
else
{
MavenProject otherProject = (MavenProject) other;
return getId().equals( otherProject.getId() );
MavenProject that = (MavenProject) other;
return eq( getArtifactId(), that.getArtifactId() )
&& eq( getGroupId(), that.getGroupId() )
&& eq( getVersion(), that.getVersion() );
}
private static <T> boolean eq( T s1, T s2 )
{
return ( s1 != null ) ? s1.equals( s2 ) : s2 == null;
}
@Override
public int hashCode()
{
return getId().hashCode();
int hash = 17;
hash = 31 * hash + getGroupId().hashCode();
hash = 31 * hash + getArtifactId().hashCode();
hash = 31 * hash + getVersion().hashCode();
return hash;
}
public List<Extension> getBuildExtensions()