desruisseaux commented on code in PR #1378: URL: https://github.com/apache/maven/pull/1378#discussion_r1460555006
########## api/maven-api-core/src/main/java/org/apache/maven/api/PathType.java: ########## @@ -0,0 +1,143 @@ +/* + * 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.nio.file.Path; +import java.util.Objects; +import java.util.Optional; + +import org.apache.maven.api.annotations.Experimental; +import org.apache.maven.api.annotations.Nonnull; + +/** + * The option of a command-line tool where to place the paths to some dependencies. + * A {@code PathType} can identify the Java class-path, the Java module-path, + * or another kind of path for another programming language for example. + * This class is like an enumeration, except that it is extensible: + * plugins can define their own kinds of path. + * + * <p>Path types are often exclusive. For example, a dependency should not be both + * on the Java class-path and on the Java module-path.</p> + * + * @see DependencyProperties#PATH_TYPES + * @see org.apache.maven.api.services.DependencyResolverResult#getDispatchedPaths() + * + * @since 4.0.0 + */ +@Experimental +public abstract class PathType { Review Comment: The `JavaPathType` focuses on the standard Java tools. In order to avoid being opinionated, the current strategy is to take the [Java Development Kit Version 21 Tool Specifications](https://docs.oracle.com/en/java/javase/21/docs/specs/man/index.html) and put all options for all kinds of path in the `JavaPathType` enumeration. So this is non-arbitrary from a Java standard point of view. If there is a demand for other popular types of path, I suppose that they could be added to this enumeration as well. But even if they are not added, all plugins have the possibility to provide their own `PathType` enumeration if they want. The `PathType.option()` method could indeed be controversial. The reason for this API is because some options are formatted is a special way. Currently, `--patch-module` is the only example I'm aware of, but more may exist. This architecture makes possible to handle those special cases in dedicated `PathType` implementations. The presence of this API in a shared place is because _Java Development Kit Version 21 Tool Specifications_ uses those options consistently in all tools as far as I know. For `PathType` defined in plugins, the plugin has the possibility to provide the right option for the tool that they target. Note: `JavaPathType` is currently not the only Java-specific interface in core. There is also `JavaToolchain`. -- 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: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org