Public API for programmatic registration of Taglet?

Martin Desruisseaux martin.desruisseaux at geomatys.com
Wed May 2 19:44:05 UTC 2018


Thanks!

In the main time (just in case it may be of some use to someone), below
is the workaroud I applied in order to find the primary Doclet class:

    @Override
    public void init(final DocletEnvironment env, final jdk.javadoc.doclet.Doclet doclet) {
        StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).walk(stream ->
                stream.filter(frame -> frame.getClassName().equals("mypackage.MyDoclet"))
                      .map(frame -> frame.getDeclaringClass()).findFirst()).ifPresent(c -> init(c));
    }

    /**
     * Invoked with the primary doclet class.
     * This is not MyDoclet.class because of different ClassLoader.
     */
    protected void init(final Class<?> doclet) {
        // Invoke some method using reflection.
    }

    Martin

Le 02/05/2018 à 20:23, Jonathan Gibbons a écrit :

> FYI, the Taglet.init issue has been addressed.
>
> https://bugs.openjdk.java.net/browse/JDK-8201817
>
> The issue about programmatic registration (addCustomTag) is still
> under investigation.
>
> -- Jon
>



More information about the javadoc-dev mailing list