You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Mihai Nita (Jira)" <ji...@apache.org> on 2023/02/12 12:27:00 UTC

[jira] [Commented] (MJAVADOC-700) Plugin duplicates classes in Java 8 all-classes lists

    [ https://issues.apache.org/jira/browse/MJAVADOC-700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17687566#comment-17687566 ] 

Mihai Nita commented on MJAVADOC-700:
-------------------------------------

Here it is:


{code:java}
diff --git a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
index 4a9bb04d..8c5a7f92 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -4550,7 +4550,8 @@ public abstract class AbstractJavadocMojo
                    continue;
                }                {+// By the time we get here the separators have been already normalized to '/'+}
                if ( currentFile.indexOf( [-File.separatorChar-]{+'/'+} ) == -1 )
                {
                    returnList.add( currentSourcePath.resolve( currentFile ).toAbsolutePath().toString() );
                } {code}
 

 

In case the diff is hard to apply, the change is in src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java, in getFilesWithUnnamedPackages, line #4553.

 

The current line is:

 
{code:java}
if ( currentFile.indexOf( File.separatorChar ) == -1 ){code}
but it should be:

 

 
{code:java}
// By the time we get here the separators have been already normalized to '/'
if ( currentFile.indexOf( '/' ) == -1 ){code}
 

 

This only fails on Windows because the File.separatorChar is '\\'.

But by the time the file name gets here it was already normalized to '/' (one of the previous replaces took care of that).

---

I've tested it, works, but I would appreciate if you don't ask me to create a pull request for this small thing.

Going through figuring out some new workflow and rules, signing CLAs, creating yet another account somewhere (I already have too many :-), etc.

 

Thanks a lot, (and I hope for a quick fix & release ;-)

Mihai

 

 

> Plugin duplicates classes in Java 8 all-classes  lists
> ------------------------------------------------------
>
>                 Key: MJAVADOC-700
>                 URL: https://issues.apache.org/jira/browse/MJAVADOC-700
>             Project: Maven Javadoc Plugin
>          Issue Type: Bug
>    Affects Versions: 3.3.0, 3.3.1
>            Reporter: Rob Spoor
>            Priority: Major
>
> Versions 3.3.0 and 3.3.1 of the Javadoc Plugin create allclasses-frame.html and allclasses-noframe.html files that duplicate all classes, interfaces, etc.
> To reproduce:
> * Clone https://github.com/robtimus/data-url (a simple and small project that can be used to showcase the issue)
> * Run {{mvn javadoc:javadoc}}, which uses version 3.2.0
> * Check target/site/apidocs/allclasses-frame.html - no duplicates
> * Run {{mvn javadoc:javadoc -Dversion.plugin.javadoc=3.3.0}} to build the same with version 3.3.0
> * Check target/site/apidocs/allclasses-frame.html - all classes are duplicated
> The same issue occurs with {{javadoc:aggregate}}, possibly others as well.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)