asciidoctor / asciidoclet

:clipboard: A Javadoc Doclet based on Asciidoctor that lets you write Javadoc in the AsciiDoc syntax.
https://github.com/asciidoctor/asciidoclet
Apache License 2.0
133 stars 40 forks source link

Asciidoclet fails with "invalid flag error" on Java 10 #81

Closed msgilligan closed 4 years ago

msgilligan commented 6 years ago

When I try to run the current Asciidoclet 1.5.5-SNAPSHOT with Java 10 via the Gradle javadoc task I get the following error:

javadoc: error - invalid flag: -d

This is because the old "Standard Doclet" was removed in Java 10 (http://www.oracle.com/technetwork/java/javase/10-relnote-issues-4108729.html#JDK-8177511) and Asciidoclet runs as a preprocessor that in-turn calls the Standard Doclet.

I'm not sure if this is worth trying to fix separately from Issue #71. In other words there are two approaches to resolving this:

  1. Create an Asciidoclet that implements the new JavaDoc API and have this new Asciidoclet call the new standard doclet for generating HTML. i.e. Issue #71
  2. Update the current Asciidoclet to use the new Standard Doclet w/o Asciidoclet itself implementing the new JavaDoc API. (I don't even know if this is possible)

So, it seems to me like #71 is probably the best solution. But there may be other solutions and we need to track this specific issue that we are seeing under Java 10+.

johncarl81 commented 6 years ago

Agreed, we should just move to the new API as you state in option 1 - option 2 is working in the wrong direction.

gsmet commented 6 years ago

I think I might have a similar issue with JDK 11 and the -Xdoclint option.

It would be nice if we could find a solution as the Hibernate ORM 6 javadoc is now heavily relying on Asciidoclet and we still have a lot of legacy javadoc that needs some fixing thus the use of the -Xdoclint option (we will fix it eventually but we are not in a good position to right now).

chrisvest commented 5 years ago

I'm also running into this on Java 11. Specifically I'm seeing that the -author flag is invalid.

chrisvest commented 5 years ago

Looks like maybe the "invalid flags" can be worked around by setting useStandardDocletOptions to false like so:

       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-javadoc-plugin</artifactId>
         <version>${javadoc.version}</version>
         <configuration>
           <doclet>org.asciidoctor.Asciidoclet</doclet>
           <docletArtifact>
             <groupId>org.asciidoctor</groupId>
             <artifactId>asciidoclet</artifactId>
             <version>${asciidoclet.version}</version>
           </docletArtifact>
           <additionalOptions>--base-dir ${basedir}</additionalOptions>
+          <useStandardDocletOptions>false</useStandardDocletOptions>
+          <doclint>none</doclint>
         </configuration>
       </plugin>

With that set, I now get a java.lang.NoSuchMethodError: com.sun.tools.doclets.standard.Standard.validOptions([[Ljava/lang/String;Lcom/sun/javadoc/DocErrorReporter;)Z from org.asciidoctor.asciidoclet.StandardAdapter.validOptions(StandardAdapter.java:38) (asciidoclet version 1.5.6) which I guess is a hint at the API problem mentioned in the issue description.

msgilligan commented 4 years ago

It seems like we've decided to move to the new JavaDoc API (Issue #71) and we have a PR for it (PR #96) so I'm going to close this issue as essentially a duplicate.