You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2021/12/25 14:35:15 UTC
[maven] 01/01: [MNG-7374] Mutating RelocatedArtifact does not retain type
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch MNG-7374
in repository https://gitbox.apache.org/repos/asf/maven.git
commit c6e404ad5bda4ea055abd18f25fda6c534ddfc74
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sat Dec 25 12:28:18 2021 +0100
[MNG-7374] Mutating RelocatedArtifact does not retain type
This closes #641
---
.../repository/internal/RelocatedArtifact.java | 33 ++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/RelocatedArtifact.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/RelocatedArtifact.java
index 2e277f0..85fa604 100644
--- a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/RelocatedArtifact.java
+++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/RelocatedArtifact.java
@@ -86,6 +86,39 @@ final class RelocatedArtifact
}
}
+ @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();