Copilot commented on code in PR #2326:
URL: https://github.com/apache/maven-resolver/pull/2326#discussion_r4631377881


##########
maven-resolver-api/src/main/java/org/eclipse/aether/transfer/MetadataNotFoundException.java:
##########
@@ -91,4 +84,23 @@ public MetadataNotFoundException(
     public MetadataNotFoundException(Metadata metadata, RemoteRepository 
repository, String message, Throwable cause) {
         super(metadata, repository, message, cause);
     }
+
+    /**
+     * Creates a new exception with the specified metadata, repository and 
root cause.
+     *
+     * @param metadata The missing metadata, may be {@code null}.
+     * @param repository The involved remote repository, may be {@code null}.
+     * @param cause The exception that caused this one, may be {@code null}.
+     * @since 2.0.26
+     */
+    public MetadataNotFoundException(Metadata metadata, RemoteRepository 
repository, Throwable cause) {

Review Comment:
   This overload makes `new MetadataNotFoundException(metadata, repository, 
null)` ambiguous between the existing nullable `String` parameter and the new 
`Throwable` parameter. The change to DefaultDeployerTest works around this 
locally, but existing API consumers will encounter the same compilation 
failure. Please retain compatibility by using a named cause-based factory 
rather than adding the competing three-argument constructor.



##########
maven-resolver-api/src/main/java/org/eclipse/aether/transfer/ArtifactNotFoundException.java:
##########
@@ -37,6 +37,17 @@ public ArtifactNotFoundException(Artifact artifact, 
RemoteRepository repository)
         super(artifact, repository, getMessage(artifact, null, repository));
     }
 
+    /**
+     * Creates a new exception with the specified artifact, repository and 
root cause.
+     *
+     * @param artifact The missing artifact, may be {@code null}.
+     * @param repository The involved remote repository, may be {@code null}.
+     * @since 2.0.26
+     */
+    public ArtifactNotFoundException(Artifact artifact, RemoteRepository 
repository, Throwable cause) {

Review Comment:
   Adding this overload makes previously valid calls such as `new 
ArtifactNotFoundException(artifact, repository, null)` ambiguous between the 
`String` and `Throwable` constructors. The existing message constructor 
explicitly permits null, so downstream source code using that API will no 
longer compile after upgrading. Please preserve source compatibility by 
exposing cause-based construction through a named factory instead of another 
three-argument overload.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to