RFR JDK12: 8212233: javadoc fails on jdk12 with "The code being documented uses modules but the packages defined in $URL are in the unnamed module."

Jonathan Gibbons jonathan.gibbons at oracle.com
Fri Jan 11 00:44:11 UTC 2019


Please review a small but important fix for javadoc in JDK 12 to have it 
better support linking to API docs generated from automatic modules and 
to fix "false-positive" error messages.

An automatic module is a jar file without module-info.class, and for 
which the module name is inferred from the name of the jar file or from 
an entry in the JAR manifest.  The API docs for such a jar will 
typically not be structured with a file-name component named for the 
module. In other words, the API docs are organized as though it's an 
unnamed module.

The fix is to disable the module/package compatibility check for an 
automatic module, and to roll over to checking the extern link data for 
the unnamed module if no item is found for it as a named module.  While 
the logic of the fix is reasonable, it requires backdoor access to some 
currently-internal info to determine if a module is an automatic module. 
This functionality should be made available in public API in the next 
release, and the fix changed to use that new API.

There is a new test, which constructs a library JAR file and 
corresponding API docs. It then creates additional API to reference that 
library API, testing access to the library as an automatic module from a 
named and unnamed module, and testing access from a named module to the 
library API when it is placed in the unnamed module on the classpath. 
The fourth case of testing links from code in the unnamed module to 
additional code in the unnamed module is covered by existing tests. In 
all cases, the test verifies explicitly that the correct link is 
generated, and the standard built-in link checker verifies that no other 
links are broken.

-- Jon

JBS: https://bugs.openjdk.java.net/browse/JDK-8212233
Webrev: http://cr.openjdk.java.net/~jjg/8212233/webrev.00/





More information about the javadoc-dev mailing list