Very nice workaround.

-- Jon

On 05/02/2018 12:44 PM, Martin Desruisseaux wrote:
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


Reply via email to