Read static web page resources from MDoclet instead of from the JDK #24
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed that the javadoc search function was broken when javadocs were built using MDoclet 4.1.0 on JDK 21. It turns out that the required
search.js
andsearch-page.js
files are not part of the javadoc output.I did a deep dive into JDK internals but I have not found any way to make files like
search.js.template
from inside thejdk.javadoc
module available to outside classes, no matter what--add-opens
or--add-exports
flags are used. What makes it even more interesting is that files likejquery-ui.js
andjquery-3.6.1.js
are included in the output./jdk/javadoc/internal/doclets/formats/html/resources/script-dir/jquery-3.6.1.min.js
/jdk/javadoc/internal/doclets/formats/html/resources/search.js.template
The reason for this difference is that the path to the former file in the
jdk.javadoc
module is NOT a valid Java package names (because one of the folder names contain a dash), andClass#getResourceAsStream
handles files with valid and invalid package names differently.Assuming https://mail.openjdk.org/pipermail/jpms-spec-experts/2016-September/000392.html is the final spec, this works as intended.
In addition to that, 3 months ago the jQuery files were moved from
script-dir
to a directory calledjquery
(https://bugs.openjdk.org/browse/JDK-8310118 / https://git.openjdk.org/jdk/pull/15180), so I suspect those will also stop working whenever MDoclet is used with JDK 22 in the future.