Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
msgilligan opened this issue Jun 10, 2018 · 5 comments
Closed

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

msgilligan opened this issue Jun 10, 2018 · 5 comments

Comments

@msgilligan
Copy link
Member

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 Migrate to jdk.javadoc.doclet API for Java 9 and later #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
Copy link
Member

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

@gsmet
Copy link

gsmet commented Jul 15, 2018

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

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

@chrisvest
Copy link

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
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants