JDK-8253996 : Javac error on jdk16 build 18: invalid flag: -Xdoclint:-missing
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 16
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: linux,windows_10
  • CPU: x86_64
  • Submitted: 2020-10-02
  • Updated: 2024-12-20
  • Resolved: 2021-01-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 16 JDK 17
16 b32Fixed 17Fixed
Related Reports
Relates :  
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
- Linux Fedora30
- Maven 3.6.3
- Maven Java Compiler plugin 3.8.1
- OpenJDK16 EA build 18


A DESCRIPTION OF THE PROBLEM :
It looks like ZookKeeper does not build on JDK16 (it does with JDK15)

my error is:
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (pre-compile-jute) on project zookeeper-jute: Fatal error compiling: error: invalid flag: -Xdoclint:-missing -> [Help 1]

This is Maven debug:
[DEBUG] Classpath:
[DEBUG]  /home/eolivelli/dev/zookeeper/zookeeper-jute/target/classes
[DEBUG]  /home/eolivelli/.m2/repository/org/apache/yetus/audience-annotations/0.5.0/audience-annotations-0.5.0.jar
[DEBUG] Source roots:
[DEBUG]  /home/eolivelli/dev/zookeeper/zookeeper-jute/src/main/java
[DEBUG]  /home/eolivelli/dev/zookeeper/zookeeper-jute/target/generated-sources/java
[DEBUG]  /home/eolivelli/dev/zookeeper/zookeeper-jute/target/generated-sources/annotations
[DEBUG] Command line options:
[DEBUG] -d /home/eolivelli/dev/zookeeper/zookeeper-jute/target/classes -classpath /home/eolivelli/dev/zookeeper/zookeeper-jute/target/classes:/home/eolivelli/.m2/repository/org/apache/yetus/audience-annotations/0.5.0/audience-annotations-0.5.0.jar: -sourcepath /home/eolivelli/dev/zookeeper/zookeeper-jute/src/main/java:/home/eolivelli/dev/zookeeper/zookeeper-jute/target/generated-sources/java:/home/eolivelli/dev/zookeeper/zookeeper-jute/target/generated-sources/annotations: -s /home/eolivelli/dev/zookeeper/zookeeper-jute/target/generated-sources/annotations -g --release 8 -encoding UTF-8 -Werror -Xlint:deprecation -Xlint:unchecked -Xlint:-options -Xdoclint:-missing -Xpkginfo:always
[DEBUG] incrementalBuildHelper#beforeRebuildExecution
[INFO] Compiling 36 source files to /home/eolivelli/dev/zookeeper/zookeeper-jute/target/classes

from "javac -help -X" it looks like "-Xdoclint:-missing" is a valid option

REGRESSION : Last worked in version 15

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
(install Maven 3.6.3)

git clone https://github.com/apache/zookeeper
JAVA_HOME=/path/to/jdk-16 mvn clean package -DskipTest

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The build passes
ACTUAL -
 invalid flag: -Xdoclint:-missing

CUSTOMER SUBMITTED WORKAROUND :
Do not enable "-Xdoclint:-missing" option

FREQUENCY : always



Comments
There has been no response from the submitter after 14 days. Closing the bug.
25-05-2021

Requested the submitter to see if the bug is fixed in the latest build at https://www.oracle.com/java/technologies/javase-jdk16-downloads.html and provide the feedback.
11-05-2021

Changeset: 2cb271e6 Author: Jonathan Gibbons <jjg@openjdk.org> Date: 2021-01-11 17:35:50 +0000 URL: https://git.openjdk.java.net/jdk16/commit/2cb271e6
11-01-2021

While this may have been caused by class loader issues, which has been fixed in JDK-82584433 (thanks, [~alanb]) a subsidiary issue is the poor/misleading diagnostic. If javac is run on a limited image, in which the doclint service is not available, the message will now be a warning: Warning: No service provider for doclint is available instead of the less-friendly messages about unsupported options.
22-12-2020

See also discussion on jigsaw-dev, starting at: https://mail.openjdk.java.net/pipermail/jigsaw-dev/2020-December/014598.html I'm 99% sure the issue is that the Thread context ClassLoader is set by Plexus Classworlds and it might not be delegating to its parent (the app class loader) when trying to locate the DocLint providers. Changing DocLint to use the system class loader (2-arg load method) should work around this, at the cost of requiring any DocLint providers to be visible via the system class loader (meaning then need to be in the run-time image or deployed on the class path). As DocLint is not an exposed service interface then this should not matter.
15-12-2020

[~jjg] Update from ZooKeeper. This is very interesting. If I run javac in a separate process with -Dmaven.compiler.fork=true then the build works mvn clean install -Dmaven.compiler.fork=true I guess that it is because Maven is running javac using " com.sun.tools.javac.api.JavacTool" this is indeed the stacktrace of the error java.lang.IllegalArgumentException: error: invalid flag: -Xdoclint:-missing at com.sun.tools.javac.main.Arguments.reportDiag (Arguments.java:894) at com.sun.tools.javac.main.Arguments.doProcessArgs (Arguments.java:395) at com.sun.tools.javac.main.Arguments.processArgs (Arguments.java:347) at com.sun.tools.javac.main.Arguments.init (Arguments.java:246) at com.sun.tools.javac.api.JavacTool.getTask (JavacTool.java:185) at com.sun.tools.javac.api.JavacTool.getTask (JavacTool.java:119) at com.sun.tools.javac.api.JavacTool.getTask (JavacTool.java:68) at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess (JavaxToolsCompiler.java:125) at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile (JavacCompiler.java:174) at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1134) at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:187) I am not sure if I have to file an issue against Maven Compiler Plugin. Do you have any hint about how to fix it ? If Maven is running in classpath mode (and this won't change in the near/mid term AFAIK), is there any way to run javac and force the loading of that javadoc module ?
14-10-2020

The fact that ZooKeeper is classpath based is irrelevant. You need to add `jdk.javadoc` to the javac runtime environment (used to run javac), not the compilation environment (used to compile the program). But, service binding will do this automatically if `jdk.javadoc` is actually in the image used to run the compiler, which suggests that javac is being run with a restricted image, maybe with a minimal set of modules. If that is the case, you need to figure out how to ensure that `jdk.javadoc` is in the image used to run javac, more than just a command-line option to be used when running javac. Since Maven is being used to run javac, you might want to investigate why Maven is not running javac in an image without jdk.javadoc available.
13-10-2020

[~jjg] ZooKeeper has following queries related to the workaround you suggested. Please advice. Do you mean to add jdk.javadoc to the module path ? is there any way to do it for a classpath based build/application like the ZooKeeper codebase ?
13-10-2020

Right now, if doclint is not available, the implications is to return a dummy service that rejects options. A better solution may be to throw an exception if the service cannot be found, so that the caller can produce a one-off informative warning and then ignore doclint options.
07-10-2020

Workaround is to make sure that the jdk.javadoc module is available when javac is executed.
07-10-2020

Yes, almost certainly related to moving doclint to javac.
07-10-2020

Following observations can be seen both in Open JDK and Oracle JDK: ================= JDK 16 ea b 11: Pass JDK 16 ea b 14: Pass JDK 16 ea b 18: Fail
05-10-2020

As per the comment given in https://bugs.openjdk.java.net/browse/JDK-8252712?focusedCommentId=14366714&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14366714 "If the service is not available to javac, javac should gracefully reject use of the `-Xdoclint` option. " javac may be rejecting it as "invalid flag: -Xdoclint:-missing"
05-10-2020