This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git


The following commit(s) were added to refs/heads/master by this push:
     new 5b6c91b531 Sync DefaultTypeProvider and dependency-types docs across 
impl and compat (#12134)
5b6c91b531 is described below

commit 5b6c91b5315ff69ddebd9d1a647ecba015949494
Author: Guillaume Nodet <[email protected]>
AuthorDate: Fri Jun 19 09:55:02 2026 +0200

    Sync DefaultTypeProvider and dependency-types docs across impl and compat 
(#12134)
    
    * Sync DefaultTypeProvider and dependency-types.apt across impl and compat
    
    The two DefaultTypeProvider copies (impl/maven-impl and
    compat/maven-resolver-provider) had drifted out of sync:
    - fatjar type was missing from the impl provider
    - test-java-source type was missing from the compat provider
    - CLASSPATH_PROCESSOR and MODULAR_PROCESSOR ordering was inconsistent
    
    Both dependency-types.apt files also had copy-paste errors from the
    test-jar row (bogus "tests" classifier on modular-jar, classpath-jar,
    and fatjar) and were missing fatjar's includesDependencies=true flag.
    Added the missing processor types and test-java-source to both docs.
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
    
    * Add APT consistency tests for DefaultTypeProvider in impl and compat
    
    Validates dependency-types.apt against DefaultTypeProvider, checking
    classifier, extension, language, path types, and includesDependencies.
    Also verifies all provider types are documented. Mirrors the existing
    ArtifactHandlerTest pattern.
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
    
    ---------
    
    Co-authored-by: Claude Opus 4.6 <[email protected]>
---
 .../internal/type/DefaultTypeProvider.java         |   9 +-
 .../src/site/apt/dependency-types.apt              |  14 ++-
 .../internal/type/DefaultTypeProviderTest.java     | 114 +++++++++++++++++++++
 .../impl/resolver/type/DefaultTypeProvider.java    |   1 +
 impl/maven-impl/src/site/apt/dependency-types.apt  |  14 ++-
 .../resolver/type/DefaultTypeProviderTest.java     | 113 ++++++++++++++++++++
 6 files changed, 255 insertions(+), 10 deletions(-)

diff --git 
a/compat/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/type/DefaultTypeProvider.java
 
b/compat/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/type/DefaultTypeProvider.java
index 6d2e84ef4d..30efe88193 100644
--- 
a/compat/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/type/DefaultTypeProvider.java
+++ 
b/compat/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/type/DefaultTypeProvider.java
@@ -56,6 +56,7 @@ public Collection<DefaultType> types() {
                         false,
                         JavaPathType.CLASSES,
                         JavaPathType.PATCH_MODULE),
+                new DefaultType(Type.TEST_JAVA_SOURCE, Language.JAVA_FAMILY, 
"jar", "test-sources", false),
                 new DefaultType(Type.MODULAR_JAR, Language.JAVA_FAMILY, "jar", 
null, false, JavaPathType.MODULES),
                 new DefaultType(Type.CLASSPATH_JAR, Language.JAVA_FAMILY, 
"jar", null, false, JavaPathType.CLASSES),
                 new DefaultType(Type.FATJAR, Language.JAVA_FAMILY, "jar", 
null, true, JavaPathType.CLASSES),
@@ -68,19 +69,19 @@ public Collection<DefaultType> types() {
                         JavaPathType.PROCESSOR_CLASSES,
                         JavaPathType.PROCESSOR_MODULES),
                 new DefaultType(
-                        Type.MODULAR_PROCESSOR,
+                        Type.CLASSPATH_PROCESSOR,
                         Language.JAVA_FAMILY,
                         "jar",
                         null,
                         false,
-                        JavaPathType.PROCESSOR_MODULES),
+                        JavaPathType.PROCESSOR_CLASSES),
                 new DefaultType(
-                        Type.CLASSPATH_PROCESSOR,
+                        Type.MODULAR_PROCESSOR,
                         Language.JAVA_FAMILY,
                         "jar",
                         null,
                         false,
-                        JavaPathType.PROCESSOR_CLASSES),
+                        JavaPathType.PROCESSOR_MODULES),
                 // j2ee types
                 new DefaultType("ejb", Language.JAVA_FAMILY, "jar", null, 
false, JavaPathType.CLASSES),
                 new DefaultType("ejb-client", Language.JAVA_FAMILY, "jar", 
"client", false, JavaPathType.CLASSES),
diff --git a/compat/maven-resolver-provider/src/site/apt/dependency-types.apt 
b/compat/maven-resolver-provider/src/site/apt/dependency-types.apt
index a059faaae0..42ae1b7b6c 100644
--- a/compat/maven-resolver-provider/src/site/apt/dependency-types.apt
+++ b/compat/maven-resolver-provider/src/site/apt/dependency-types.apt
@@ -50,11 +50,19 @@ Default Dependency Types Reference
 
*-----------------------+---------------+------------+-----------+-----------------------+-----------------------+
 | <<<test-jar>>>        | <<<tests>>>   | <<<jar>>>  | java      | classes, 
patch module |                       |
 
*-----------------------+---------------+------------+-----------+-----------------------+-----------------------+
-| <<<modular-jar>>> *   | <<<tests>>>   | <<<jar>>>  | java      | modules     
          |                       |
+| <<<test-java-source>>> * | <<<test-sources>>> | <<<jar>>> | java   |         
              |                       |
 
*-----------------------+---------------+------------+-----------+-----------------------+-----------------------+
-| <<<classpath-jar>>> * | <<<tests>>>   | <<<jar>>>  | java      | classes     
          |                       |
+| <<<modular-jar>>> *   |               | <<<jar>>>  | java      | modules     
          |                       |
 
*-----------------------+---------------+------------+-----------+-----------------------+-----------------------+
-| <<<fatjar>>> *        | <<<tests>>>   | <<<jar>>>  | java      | classes     
          |                       |
+| <<<classpath-jar>>> * |               | <<<jar>>>  | java      | classes     
          |                       |
+*-----------------------+---------------+------------+-----------+-----------------------+-----------------------+
+| <<<fatjar>>> *        |               | <<<jar>>>  | java      | classes     
          | <<<true>>>            |
+*-----------------------+---------------+------------+-----------+-----------------------+-----------------------+
+| <<<processor>>> *     |               | <<<jar>>>  | java      | processor 
classes, processor modules |           |
+*-----------------------+---------------+------------+-----------+-----------------------+-----------------------+
+| <<<classpath-processor>>> * |         | <<<jar>>>  | java      | processor 
classes     |                       |
+*-----------------------+---------------+------------+-----------+-----------------------+-----------------------+
+| <<<modular-processor>>> * |           | <<<jar>>>  | java      | processor 
modules     |                       |
 
*-----------------------+---------------+------------+-----------+-----------------------+-----------------------+
 || Java/Jakarta EE      ||              ||           ||          ||            
          ||                      ||
 
*-----------------------+---------------+------------+-----------+-----------------------+-----------------------+
diff --git 
a/compat/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/type/DefaultTypeProviderTest.java
 
b/compat/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/type/DefaultTypeProviderTest.java
new file mode 100644
index 0000000000..83fd669e43
--- /dev/null
+++ 
b/compat/maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/type/DefaultTypeProviderTest.java
@@ -0,0 +1,114 @@
+/*
+ * 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.repository.internal.type;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.apache.maven.api.JavaPathType;
+import org.apache.maven.api.PathType;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+@SuppressWarnings("deprecation")
+class DefaultTypeProviderTest {
+
+    private static final Map<String, PathType> PATH_TYPE_NAMES = Map.of(
+            "classes", JavaPathType.CLASSES,
+            "modules", JavaPathType.MODULES,
+            "patch module", JavaPathType.PATCH_MODULE,
+            "processor classes", JavaPathType.PROCESSOR_CLASSES,
+            "processor modules", JavaPathType.PROCESSOR_MODULES);
+
+    @Test
+    void testAptConsistency() throws Exception {
+        Map<String, DefaultType> types =
+                new 
DefaultTypeProvider().types().stream().collect(Collectors.toMap(DefaultType::id,
 t -> t));
+
+        Path apt = Path.of(System.getProperty("basedir", ""), 
"src/site/apt/dependency-types.apt");
+        List<String> lines = Files.readAllLines(apt);
+
+        Set<String> documentedTypes = new LinkedHashSet<>();
+
+        for (String line : lines) {
+            if (line.startsWith("||") || !line.startsWith("|")) {
+                continue;
+            }
+
+            String[] cols = line.split("\\|");
+            String typeId = trimApt(cols[1]);
+            if (typeId == null) {
+                continue;
+            }
+
+            documentedTypes.add(typeId);
+
+            String classifier = trimApt(cols[2]);
+            String extension = trimApt(cols[3]);
+            if ("= type".equals(extension)) {
+                extension = typeId;
+            }
+            String language = trimApt(cols[4]);
+            String pathTypesStr = trimApt(cols[5]);
+            String includesDependencies = trimApt(cols[6]);
+
+            DefaultType type = types.get(typeId);
+            assertNotNull(type, "Type not found in provider: " + typeId);
+            assertEquals(extension, type.getExtension(), typeId + " 
extension");
+            assertEquals(classifier, type.getClassifier(), typeId + " 
classifier");
+            assertEquals(language, type.getLanguage().id(), typeId + " 
language");
+            assertEquals(
+                    type.isIncludesDependencies() ? "true" : null,
+                    includesDependencies,
+                    typeId + " includesDependencies");
+            assertEquals(parsePathTypes(pathTypesStr), type.getPathTypes(), 
typeId + " pathTypes");
+        }
+
+        Set<String> undocumented = new LinkedHashSet<>(types.keySet());
+        undocumented.removeAll(documentedTypes);
+        assertTrue(undocumented.isEmpty(), "Types in provider but not in APT 
doc: " + undocumented);
+    }
+
+    private Set<PathType> parsePathTypes(String pathTypesStr) {
+        Set<PathType> result = new LinkedHashSet<>();
+        if (pathTypesStr != null) {
+            for (String name : pathTypesStr.split(",")) {
+                name = name.trim();
+                PathType pt = PATH_TYPE_NAMES.get(name);
+                if (pt != null) {
+                    result.add(pt);
+                }
+            }
+        }
+        return result;
+    }
+
+    private String trimApt(String content) {
+        content = content.replace('<', ' ').replace('>', ' ').replace('*', ' 
').trim();
+        return content.isEmpty() ? null : content;
+    }
+}
diff --git 
a/impl/maven-impl/src/main/java/org/apache/maven/impl/resolver/type/DefaultTypeProvider.java
 
b/impl/maven-impl/src/main/java/org/apache/maven/impl/resolver/type/DefaultTypeProvider.java
index b0eead6840..75c6e9fd8e 100644
--- 
a/impl/maven-impl/src/main/java/org/apache/maven/impl/resolver/type/DefaultTypeProvider.java
+++ 
b/impl/maven-impl/src/main/java/org/apache/maven/impl/resolver/type/DefaultTypeProvider.java
@@ -60,6 +60,7 @@ public Collection<DefaultType> types() {
                 new DefaultType(Type.TEST_JAVA_SOURCE, Language.JAVA_FAMILY, 
"jar", "test-sources", false),
                 new DefaultType(Type.MODULAR_JAR, Language.JAVA_FAMILY, "jar", 
null, false, JavaPathType.MODULES),
                 new DefaultType(Type.CLASSPATH_JAR, Language.JAVA_FAMILY, 
"jar", null, false, JavaPathType.CLASSES),
+                new DefaultType(Type.FATJAR, Language.JAVA_FAMILY, "jar", 
null, true, JavaPathType.CLASSES),
                 new DefaultType(
                         Type.PROCESSOR,
                         Language.JAVA_FAMILY,
diff --git a/impl/maven-impl/src/site/apt/dependency-types.apt 
b/impl/maven-impl/src/site/apt/dependency-types.apt
index 10bb5f02a0..1d119112b6 100644
--- a/impl/maven-impl/src/site/apt/dependency-types.apt
+++ b/impl/maven-impl/src/site/apt/dependency-types.apt
@@ -50,11 +50,19 @@ Default Dependency Types Reference
 
*-----------------------+---------------+------------+-----------+-----------------------+-----------------------+
 | <<<test-jar>>>        | <<<tests>>>   | <<<jar>>>  | java      | classes, 
patch module |                       |
 
*-----------------------+---------------+------------+-----------+-----------------------+-----------------------+
-| <<<modular-jar>>> *   | <<<tests>>>   | <<<jar>>>  | java      | modules     
          |                       |
+| <<<test-java-source>>> * | <<<test-sources>>> | <<<jar>>> | java   |         
              |                       |
 
*-----------------------+---------------+------------+-----------+-----------------------+-----------------------+
-| <<<classpath-jar>>> * | <<<tests>>>   | <<<jar>>>  | java      | classes     
          |                       |
+| <<<modular-jar>>> *   |               | <<<jar>>>  | java      | modules     
          |                       |
 
*-----------------------+---------------+------------+-----------+-----------------------+-----------------------+
-| <<<fatjar>>> *        | <<<tests>>>   | <<<jar>>>  | java      | classes     
          |                       |
+| <<<classpath-jar>>> * |               | <<<jar>>>  | java      | classes     
          |                       |
+*-----------------------+---------------+------------+-----------+-----------------------+-----------------------+
+| <<<fatjar>>> *        |               | <<<jar>>>  | java      | classes     
          | <<<true>>>            |
+*-----------------------+---------------+------------+-----------+-----------------------+-----------------------+
+| <<<processor>>> *     |               | <<<jar>>>  | java      | processor 
classes, processor modules |           |
+*-----------------------+---------------+------------+-----------+-----------------------+-----------------------+
+| <<<classpath-processor>>> * |         | <<<jar>>>  | java      | processor 
classes     |                       |
+*-----------------------+---------------+------------+-----------+-----------------------+-----------------------+
+| <<<modular-processor>>> * |           | <<<jar>>>  | java      | processor 
modules     |                       |
 
*-----------------------+---------------+------------+-----------+-----------------------+-----------------------+
 || Java/Jakarta EE      ||              ||           ||          ||            
          ||                      ||
 
*-----------------------+---------------+------------+-----------+-----------------------+-----------------------+
diff --git 
a/impl/maven-impl/src/test/java/org/apache/maven/impl/resolver/type/DefaultTypeProviderTest.java
 
b/impl/maven-impl/src/test/java/org/apache/maven/impl/resolver/type/DefaultTypeProviderTest.java
new file mode 100644
index 0000000000..d0bf22edca
--- /dev/null
+++ 
b/impl/maven-impl/src/test/java/org/apache/maven/impl/resolver/type/DefaultTypeProviderTest.java
@@ -0,0 +1,113 @@
+/*
+ * 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.resolver.type;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.apache.maven.api.JavaPathType;
+import org.apache.maven.api.PathType;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class DefaultTypeProviderTest {
+
+    private static final Map<String, PathType> PATH_TYPE_NAMES = Map.of(
+            "classes", JavaPathType.CLASSES,
+            "modules", JavaPathType.MODULES,
+            "patch module", JavaPathType.PATCH_MODULE,
+            "processor classes", JavaPathType.PROCESSOR_CLASSES,
+            "processor modules", JavaPathType.PROCESSOR_MODULES);
+
+    @Test
+    void testAptConsistency() throws Exception {
+        Map<String, DefaultType> types =
+                new 
DefaultTypeProvider().types().stream().collect(Collectors.toMap(DefaultType::id,
 t -> t));
+
+        Path apt = Path.of(System.getProperty("basedir", ""), 
"src/site/apt/dependency-types.apt");
+        List<String> lines = Files.readAllLines(apt);
+
+        Set<String> documentedTypes = new LinkedHashSet<>();
+
+        for (String line : lines) {
+            if (line.startsWith("||") || !line.startsWith("|")) {
+                continue;
+            }
+
+            String[] cols = line.split("\\|");
+            String typeId = trimApt(cols[1]);
+            if (typeId == null) {
+                continue;
+            }
+
+            documentedTypes.add(typeId);
+
+            String classifier = trimApt(cols[2]);
+            String extension = trimApt(cols[3]);
+            if ("= type".equals(extension)) {
+                extension = typeId;
+            }
+            String language = trimApt(cols[4]);
+            String pathTypesStr = trimApt(cols[5]);
+            String includesDependencies = trimApt(cols[6]);
+
+            DefaultType type = types.get(typeId);
+            assertNotNull(type, "Type not found in provider: " + typeId);
+            assertEquals(extension, type.getExtension(), typeId + " 
extension");
+            assertEquals(classifier, type.getClassifier(), typeId + " 
classifier");
+            assertEquals(language, type.getLanguage().id(), typeId + " 
language");
+            assertEquals(
+                    type.isIncludesDependencies() ? "true" : null,
+                    includesDependencies,
+                    typeId + " includesDependencies");
+            assertEquals(parsePathTypes(pathTypesStr), type.getPathTypes(), 
typeId + " pathTypes");
+        }
+
+        Set<String> undocumented = new LinkedHashSet<>(types.keySet());
+        undocumented.removeAll(documentedTypes);
+        assertTrue(undocumented.isEmpty(), "Types in provider but not in APT 
doc: " + undocumented);
+    }
+
+    private Set<PathType> parsePathTypes(String pathTypesStr) {
+        Set<PathType> result = new LinkedHashSet<>();
+        if (pathTypesStr != null) {
+            for (String name : pathTypesStr.split(",")) {
+                name = name.trim();
+                PathType pt = PATH_TYPE_NAMES.get(name);
+                if (pt != null) {
+                    result.add(pt);
+                }
+            }
+        }
+        return result;
+    }
+
+    private String trimApt(String content) {
+        content = content.replace('<', ' ').replace('>', ' ').replace('*', ' 
').trim();
+        return content.isEmpty() ? null : content;
+    }
+}

Reply via email to