gnodet-bot commented on code in PR #13036:
URL: https://github.com/apache/maven/pull/13036#discussion_r4023885628


##########
api/maven-api-core/src/main/java/org/apache/maven/api/Node.java:
##########
@@ -40,37 +40,98 @@
 @Provider
 public interface Node {
 
+    /**
+     * Returns the artifact for this node.
+     *
+     * @return artifact for this node, or {@code null} if none
+     */
+    @Nullable
+    Artifact artifact();
+
+    /**
+     * Returns the dependency for this node.
+     *
+     * @return dependency for this node, or {@code null} if none
+     */
+    @Nullable
+    Dependency dependency();
+
+    /**
+     * Gets the child nodes of this node.
+     *
+     * @return the child nodes of this node, never {@code null}
+     */
+    @Nonnull
+    List<Node> children();
+
+    /**
+     * Returns the remote repositories of this node.
+     *
+     * @return repositories of this node, never {@code null}
+     */
+    @Nonnull
+    List<RemoteRepository> remoteRepositories();
+
+    /**
+     * The repository where this artifact has been downloaded from.
+     *
+     * @return the repository, never {@code null}
+     */
+    @Nonnull
+    Optional<RemoteRepository> repository();

Review Comment:
   ⚠️ **Inaccurate Javadoc contract**: `@return the repository, never {@code 
null}` was added in this commit, but `DefaultNode.repository()` always throws 
`UnsupportedOperationException("Not implemented yet")`. The `never null` claim 
is factually wrong and will mislead callers who guard against `null` instead of 
catching the exception.
   
   The previous `getRepository()` Javadoc had no `@return` at all — this new 
one introduced the false contract. It should either document the unimplemented 
state or be removed until the method is actually implemented:
   
   ```suggestion
       /**
        * The repository where this artifact has been downloaded from.
        *
        * @return an {@code Optional} containing the repository, or an empty 
Optional if not available
        * @throws UnsupportedOperationException if not yet implemented by the 
provider
        */
       @Nonnull
       Optional<RemoteRepository> repository();
   ```



-- 
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