On Wed, 17 Dec 2025 20:09:44 GMT, Dan Smith <[email protected]> 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

Reply via email to