gnodet-bot commented on code in PR #14013: URL: https://github.com/apache/maven/pull/14013#discussion_r4578840322
########## api/maven-api-core/src/main/java/org/apache/maven/api/AccessorBridge.java: ########## @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.api; + +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Map; + +/** Checks that a compatibility accessor has an implementation before delegating to it. */ Review Comment: đĄ **Nit â Javadoc precision:** The class-level Javadoc says "delegating to it", but `requireOverride` is a guard that *throws* â the caller delegates. A slightly more precise wording: ```suggestion /** Guards compatibility accessors: throws if no implementation overrides either form. */ ``` ########## api/maven-api-core/src/main/java/org/apache/maven/api/MojoExecution.java: ########## @@ -60,29 +72,95 @@ public interface MojoExecution { @Nonnull Optional<PluginExecution> model(); + /** + * {@return the execution element, or null if absent} + * + * @deprecated Use {@link #model()} instead. + */ + @Deprecated(since = "4.2.0", forRemoval = true) + @Nullable + default PluginExecution getModel() { Review Comment: âšī¸ **Contract narrowing on deprecated getters:** `getModel()`, `getExecutionId()` (line 115), and `getLifecyclePhase()` (line 145) are now `@Nullable`, whereas previously these methods had a `@Nonnull` annotation (they delegated to `String`-returning methods). This is semantically correct â the underlying noun-style accessors return `Optional` â but it is a contract change for callers of the deprecated API. If there are known implementations or plugins that call these deprecated methods without null checks, a migration note in the Javadoc `@deprecated` sentence could help: ```suggestion * @deprecated Use {@link #model()} instead. Note: unlike the previous declaration, this method may return {@code null} for CLI invocations. ``` ########## api/maven-api-core/src/main/java/org/apache/maven/api/Artifact.java: ########## @@ -33,6 +33,8 @@ * and downloads the artifact in the local repository. This operation returns a {@link DownloadedArtifact}. * </p> * + * <p>Implementations must override either the noun-style accessor or its legacy getter for each property. Review Comment: đ **Minor Javadoc style:** The added `<p>` tag is not closed. The existing style in this file uses `</p>` (see the preceding paragraph). Same pattern appears in `Dependency.java`, `DownloadedArtifact.java`, and `Exclusion.java`. ```suggestion * <p>Implementations must override either the noun-style accessor or its legacy getter for each property.</p> ``` -- 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]
