RFR: 8373909: JSpec and ToolGuide taglets use incorrect relative path

Chen Liang liach at openjdk.org
Wed Dec 17 22:24:29 UTC 2025


On Wed, 17 Dec 2025 20:09:44 GMT, Dan Smith <dlsmith at openjdk.org> wrote:

> Fixing the JSpec and ToolGuide taglets so that they produce correct links, no matter what file the tag appears in.
> 
> This is a workaround solution, sharing the necessary info via a ThreadLocal public static field in an internal API. See [JDK-8373922](https://bugs.openjdk.org/browse/JDK-8373922) for an API enhancement request that would make this possible without relying on internal API.

Marked as reviewed by liach (Reviewer).

I checked whether we can make the taglet compile against jdk.javadoc and use the field directly - don't think it's worth the make system hassle.

make/jdk/src/classes/build/tools/taglet/JSpec.java line 188:

> 186:         try {
> 187:             Class<?> c = Class.forName("jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter");
> 188:             ThreadLocal<?> tl = (ThreadLocal<?>) c.getField("CURRENT_PATH").get(null);

I hope the performance overhead of repeated reflective lookup is acceptable... Ideally we should keep the `Field` in a static final variable.

-------------

PR Review: https://git.openjdk.org/jdk/pull/28878#pullrequestreview-3589915819
PR Comment: https://git.openjdk.org/jdk/pull/28878#issuecomment-3667435436
PR Review Comment: https://git.openjdk.org/jdk/pull/28878#discussion_r2628841220


More information about the build-dev mailing list