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

elharo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new efb55610 [MJAVADOC-624] Skip module-info when auto-detecting taglet 
classes (#1454)
efb55610 is described below

commit efb55610e5160871ae61c6b59ab66c9cfe7d741f
Author: Arturo Bernal <[email protected]>
AuthorDate: Fri Nov 27 14:34:05 2026 +0100

    [MJAVADOC-624] Skip module-info when auto-detecting taglet classes (#1454)
    
    getClassNamesFromJar included module-info.class in the class list it 
returns, so getTagletClassNames tried to load it like any other class and threw 
NoClassDefFoundError. That aborted taglet auto-detection for the whole jar 
whenever a tagletArtifact happened to be a Java 9+ module, even though its real 
taglet classes were fine.
    
    Claude-Session: https://claude.ai/code/session_0153qygyTP2LcbRbWVPHCmjg
---
 .../org/apache/maven/plugins/javadoc/JavadocUtil.java |  5 ++++-
 .../apache/maven/plugins/javadoc/JavadocUtilTest.java | 19 +++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java 
b/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
index 012926f4..ed2a5979 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
@@ -977,7 +977,10 @@ public class JavadocUtil {
                     if ((version == null || version.isEmpty()) || 
JavaVersion.JAVA_VERSION.isAtLeast(version)) {
                         String name = matcher.group("n");
 
-                        classes.add(name.replaceAll("/", "\\."));
+                        // module-info is a compiler-generated descriptor, not 
a loadable class
+                        if (!"module-info".equals(name)) {
+                            classes.add(name.replaceAll("/", "\\."));
+                        }
                     }
                 }
 
diff --git 
a/src/test/java/org/apache/maven/plugins/javadoc/JavadocUtilTest.java 
b/src/test/java/org/apache/maven/plugins/javadoc/JavadocUtilTest.java
index f95f8e92..4714c38f 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/JavadocUtilTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/JavadocUtilTest.java
@@ -767,6 +767,25 @@ class JavadocUtilTest {
         assertThat(values).containsExactly("*.internal", 
"org.acme.exclude1.*", "org.acme.exclude2");
     }
 
+    /**
+     * MJAVADOC-624: a Java 9+ module jar used as a taglet artifact carries a 
module-info.class entry.
+     * Loading it as a class throws NoClassDefFoundError ("module-info is not 
a class because access_flag
+     * ACC_MODULE is set"), which must not abort taglet auto-detection for the 
jar's real classes.
+     */
+    @Test
+    void getTagletClassNamesSkipsModuleInfo(@TempDir Path tempDir) throws 
Exception {
+        Path jar = tempDir.resolve("taglet-module.jar");
+        try (OutputStream out = Files.newOutputStream(jar);
+                JarOutputStream jarOut = new JarOutputStream(out)) {
+            jarOut.putNextEntry(new ZipEntry("module-info.class"));
+            jarOut.closeEntry();
+        }
+
+        List<String> tagletClasses = 
JavadocUtil.getTagletClassNames(jar.toFile());
+
+        assertTrue(tagletClasses.isEmpty());
+    }
+
     /**
      * Turns a failure to reach maven.apache.org into a skipped test, so that 
a slow or blocked network
      * does not make the build red. Deliberately narrow: a refused connection 
is not handled, because

Reply via email to