JDK-8175277 : javadoc AssertionError when specified with release 8
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 9
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2017-02-20
  • Updated: 2020-07-21
  • Resolved: 2017-03-28
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 10 JDK 9
10Fixed 9 b164Fixed
Related Reports
Blocks :  
Relates :  
Description
When  javadoc is specified with --release 8 and -subpackages causes the following (redacted) crash within javac.

java.lang.AssertionError
	at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
	at jdk.compiler/com.sun.tools.javac.util.Assert.checkNonNull(Assert.java:62)
	at jdk.compiler/com.sun.tools.javac.comp.Modules.allModules(Modules.java:1127)
	at jdk.javadoc/jdk.javadoc.internal.tool.ElementsTable.findModuleOfPackageName(ElementsTable.java:768)
	at jdk.javadoc/jdk.javadoc.internal.tool.ElementsTable.computeSubpackages(ElementsTable.java:467)
	at jdk.javadoc/jdk.javadoc.internal.tool.ElementsTable.computeSpecifiedPackages(ElementsTable.java:652)
	at jdk.javadoc/jdk.javadoc.internal.tool.ElementsTable.analyze(ElementsTable.java:329)
	at jdk.javadoc/jdk.javadoc.internal.tool.JavadocTool.getEnvironment(JavadocTool.java:205)
	at jdk.javadoc/jdk.javadoc.internal.tool.Start.parseAndExecute(Start.java:591)
	at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:424)
	at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:341)
	at jdk.javadoc/jdk.javadoc.internal.tool.Main.execute(Main.java:63)
	at jdk.javadoc/jdk.javadoc.internal.tool.Main.main(Main.java:52)
2 errors
9 warnings

Comments
Please let me make sure if this bug is really fixed from JDK9 ? Combination of --release 8 and -subpackages still seems to cause an AssertionError.
21-07-2020

After some discussions this bug is still valid, when --release 8 is used with module-source-path javadoc should fail fast, and this is because javadoc does not set source and target like the way javac does, when a --release is specified, and therefore Arguments.validate() does not work correctly.
15-03-2017

Duplicate of JDK-8175346
14-03-2017

Right, with the new sanity checks in ElementsTable, this fix is no longer an issue, I am going to close this bug as dup of JDK-8175346
14-03-2017

Looking at the stack trace, these seem to be the key lines: at jdk.compiler/com.sun.tools.javac.comp.Modules.allModules(Modules.java:1127) at jdk.javadoc/jdk.javadoc.internal.tool.ElementsTable.findModuleOfPackageName(ElementsTable.java:768) So, with --release 8, why is ElementsTable trying to findModuleOfPackageName?
14-03-2017

Can we have a brief explanation of the rationale for the fix. With --release 8, we should not be getting deep into the module system, so why do these values need to be set?
14-03-2017

Quick hack suggested by Jan works: diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java @@ -255,6 +255,7 @@ tree.modle = syms.noModule; } defaultModule = syms.noModule; + allModules = rootModules = Collections.singleton(syms.noModule); return true; }
21-02-2017