Skip to content

Commit

Permalink
[MNG-7374] Mutating RelocatedArtifact does not retain type
Browse files Browse the repository at this point in the history
This closes #641
  • Loading branch information
michael-o committed Dec 30, 2021
1 parent d173bf9 commit ef74a62
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,40 @@ public String getVersion()
}
}

// Revise these three methods when MRESOLVER-233 is delivered
@Override
public Artifact setVersion( String version )
{
String current = getVersion();
if ( current.equals( version ) || ( version == null && current.length() <= 0 ) )
{
return this;
}
return new RelocatedArtifact( artifact, groupId, artifactId, version );
}

@Override
public Artifact setFile( File file )
{
File current = getFile();
if ( Objects.equals( current, file ) )
{
return this;
}
return new RelocatedArtifact( artifact.setFile( file ), groupId, artifactId, version );
}

@Override
public Artifact setProperties( Map<String, String> properties )
{
Map<String, String> current = getProperties();
if ( current.equals( properties ) || ( properties == null && current.isEmpty() ) )
{
return this;
}
return new RelocatedArtifact( artifact.setProperties( properties ), groupId, artifactId, version );
}

public String getClassifier()
{
return artifact.getClassifier();
Expand Down

0 comments on commit ef74a62

Please sign in to comment.