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


##########
api/maven-api-core/src/main/java/org/apache/maven/api/services/LifecycleExecutor.java:
##########
@@ -0,0 +1,94 @@
+/*
+ * 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.services;
+
+import java.util.List;
+import java.util.function.Predicate;
+
+import org.apache.maven.api.LifecyclePlan;
+import org.apache.maven.api.MojoExecution;
+import org.apache.maven.api.Project;
+import org.apache.maven.api.Service;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * Calculates, inspects, and executes Maven lifecycle plans for a single 
project.
+ *
+ * <p>This is the Maven API v4 lifecycle executor service. The legacy
+ * {@code org.apache.maven.lifecycle.LifecycleExecutor} interface serves a 
different role in the compatibility layer.
+ *
+ * @since 4.1.0
+ */
+@Experimental
+public interface LifecycleExecutor extends Service {
+
+    /**
+     * Calculates a lifecycle plan without executing it.
+     *
+     * @param request the planning request
+     * @return the planning result
+     * @throws LifecycleExecutorException if the lifecycle plan cannot be 
calculated
+     */
+    @Nonnull
+    LifecyclePlanResult plan(@Nonnull LifecyclePlanRequest request);
+
+    /**
+     * Executes all or part of a previously calculated lifecycle plan.
+     *
+     * @param request the execution request
+     * @return the execution result
+     * @throws LifecycleExecutorException if lifecycle execution fails
+     * @throws IllegalArgumentException if the plan was not produced by this 
service
+     */
+    @Nonnull
+    LifecycleExecutionResult execute(@Nonnull LifecycleExecutionRequest 
request);
+
+    @Nonnull
+    default LifecyclePlanResult plan(@Nonnull Session session, @Nonnull 
Project project, @Nonnull List<String> tasks) {
+        return plan(LifecyclePlanRequest.build(session, project, tasks));
+    }

Review Comment:
   ⚠️ **Missing Javadoc on all five default convenience methods** — 
`plan(Session, Project, List<String>)`, `execute(Session, LifecyclePlan)`, 
`execute(Session, LifecyclePlan, Predicate<>)`, and both `planAndExecute` 
overloads are the primary entry points for most callers (they avoid 
constructing request objects directly), yet they have no `@since`, no `@param`, 
no `@throws`, and no description at all.
   
   The abstract methods above them are well-documented; these defaults inherit 
nothing automatically. IDE users who discover the API through tab-completion 
see only the method signatures — they'll have no idea what `planAndExecute` 
does or that it can throw `LifecycleExecutorException`.
   
   At minimum, add `@since 4.1.0` and `@throws LifecycleExecutorException` to 
each. A one-line description and `@see` reference to the corresponding abstract 
method would also help.
   
   Example for the first default:
   ```suggestion
       /**
        * Calculates a lifecycle plan without executing it.
        *
        * @param session the current session
        * @param project the project for which to calculate the plan
        * @param tasks lifecycle phases or plugin goals used to calculate the 
plan
        * @return the lifecycle planning result
        * @throws LifecycleExecutorException if the lifecycle plan cannot be 
calculated
        * @since 4.1.0
        */
       @Nonnull
       default LifecyclePlanResult plan(@Nonnull Session session, @Nonnull 
Project project, @Nonnull List<String> tasks) {
           return plan(LifecyclePlanRequest.build(session, project, tasks));
       }
   ```



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