elharo commented on code in PR #2236:
URL: https://github.com/apache/maven/pull/2236#discussion_r2073224351


##########
api/maven-api-core/src/main/java/org/apache/maven/api/SourceRoot.java:
##########
@@ -46,23 +47,47 @@ default Path directory() {
     }
 
     /**
-     * {@return the list of pattern matchers for the files to include}.
+     * {@return the list of patterns for the files to include}.
+     * The path separator is {@code /} on all platforms, including Windows.
+     * The prefix before the {@code :} character, if present and longer than 1 
character, is the syntax.
+     * If no syntax is specified, or if its length is 1 character (interpreted 
as a Windows drive),
+     * the default is a Maven-specific variation of the {@code "glob"} pattern.
+     *
+     * <p>
      * The default implementation returns an empty list, which means to apply 
a language-dependent pattern.
      * For example, for the Java language, the pattern includes all files with 
the {@code .java} suffix.
+     *
+     * @see java.nio.file.FileSystem#getPathMatcher(String)
      */
-    default List<PathMatcher> includes() {
+    default List<String> includes() {
         return List.of();
     }
 
     /**
-     * {@return the list of pattern matchers for the files to exclude}.
+     * {@return the list of patterns for the files to exclude}.
      * The exclusions are applied after the inclusions.
      * The default implementation returns an empty list.
      */
-    default List<PathMatcher> excludes() {
+    default List<String> excludes() {
         return List.of();
     }
 
+    /**
+     * {@return a matcher combining the include and exclude patterns}.
+     * If the user did not specified any includes, the given {@code 
defaultIncludes} are used.
+     * These defaults depend on the plugin.
+     * For example, the default include of the Java compiler plugin is 
<code>"**&sol;*.java"</code>.
+     *
+     * <p>If the user did not specified any excludes, the default can be files 
generated

Review Comment:
   specified --> specify
   can be --> is often



##########
impl/maven-impl/src/test/java/org/apache/maven/impl/PathSelectorTest.java:
##########
@@ -0,0 +1,115 @@
+/*
+ * 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.impl;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class PathSelectorTest {
+    /**
+     * The temporary directory containing the files to test.
+     */
+    private Path directory;

Review Comment:
   This should probably be a local variable since it differs from method to 
method



##########
impl/maven-impl/src/test/java/org/apache/maven/impl/PathSelectorTest.java:
##########
@@ -0,0 +1,115 @@
+/*
+ * 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.impl;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class PathSelectorTest {
+    /**
+     * The temporary directory containing the files to test.
+     */
+    private Path directory;
+
+    /**
+     * The filtered set of paths. Created by {@link #filter()}.
+     */
+    private Set<Path> filtered;

Review Comment:
   Make this is a local variable. It's not a fixture since there's no setup, 
just shared global state between methods. Pass arguments instead. 



##########
api/maven-api-core/src/main/java/org/apache/maven/api/SourceRoot.java:
##########
@@ -46,23 +47,47 @@ default Path directory() {
     }
 
     /**
-     * {@return the list of pattern matchers for the files to include}.
+     * {@return the list of patterns for the files to include}.
+     * The path separator is {@code /} on all platforms, including Windows.
+     * The prefix before the {@code :} character, if present and longer than 1 
character, is the syntax.
+     * If no syntax is specified, or if its length is 1 character (interpreted 
as a Windows drive),
+     * the default is a Maven-specific variation of the {@code "glob"} pattern.
+     *
+     * <p>
      * The default implementation returns an empty list, which means to apply 
a language-dependent pattern.
      * For example, for the Java language, the pattern includes all files with 
the {@code .java} suffix.
+     *
+     * @see java.nio.file.FileSystem#getPathMatcher(String)
      */
-    default List<PathMatcher> includes() {
+    default List<String> includes() {
         return List.of();
     }
 
     /**
-     * {@return the list of pattern matchers for the files to exclude}.
+     * {@return the list of patterns for the files to exclude}.
      * The exclusions are applied after the inclusions.
      * The default implementation returns an empty list.
      */
-    default List<PathMatcher> excludes() {
+    default List<String> excludes() {
         return List.of();
     }
 
+    /**
+     * {@return a matcher combining the include and exclude patterns}.
+     * If the user did not specified any includes, the given {@code 
defaultIncludes} are used.
+     * These defaults depend on the plugin.
+     * For example, the default include of the Java compiler plugin is 
<code>"**&sol;*.java"</code>.

Review Comment:
   I don't think you need to use &sol; here. A forward slash should be fine if 
that's what you want. 



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

Reply via email to