Public API for programmatic registration of Taglet?

2018-04-18 Thread Martin Desruisseaux
Hello I'm trying to write an extension of the standard doclet together with custom taglets in the same JAR file. The custom taglets and doclet need to share information. But I faced the following difficulties: When the Taglet.init​(DocletEnvironment,Doclet) method is invoked, the doclet argument

Re: Public API for programmatic registration of Taglet?

2018-04-18 Thread Jonathan Gibbons
On 4/18/18 9:08 AM, Martin Desruisseaux wrote: Hello I'm trying to write an extension of the standard doclet together with custom taglets in the same JAR file. The custom taglets and doclet need to share information. But I faced the following difficulties: When the Taglet.init​(DocletEnvi

Re: Public API for programmatic registration of Taglet?

2018-04-18 Thread Martin Desruisseaux
Hello Jonathan Thanks for your reply. Indeed, I understand that adding new API can be tricky. If it is desired to avoid that path, modifying the Taglet.init(…) specification the way you rephrased would help a lot. Alternatively, another way to work without any specification change may be to allow

Re: Public API for programmatic registration of Taglet?

2018-04-18 Thread Jonathan Gibbons
Yes, it is on my list to dig into the details of why the ClassCastException is being thrown. -- Jon On 4/18/18 9:53 AM, Martin Desruisseaux wrote: Hello Jonathan Thanks for your reply. Indeed, I understand that adding new API can be tricky. If it is desired to avoid that path, modifying the

Re: Public API for programmatic registration of Taglet?

2018-04-18 Thread Jonathan Gibbons
OK, we can't easily accept arbitrary subtypes of DocletEnvironment, without embarking on a bunch of changes to other public API. This means the correct solution here is that Taglet.init should be called with the "user doclet" (which we expect people to provide subtypes of) and the system-provi

Re: Public API for programmatic registration of Taglet?

2018-04-18 Thread Jonathan Gibbons
Tracked as JDK-8201817 https://bugs.openjdk.java.net/browse/JDK-8201817 -- Jon On 4/18/18 11:39 AM, Jonathan Gibbons wrote: OK, we can't easily accept arbitrary subtypes of DocletEnvironment, without embarking on a bunch of changes to other public API. This means the correct solution here is

Re: Public API for programmatic registration of Taglet?

2018-04-18 Thread Martin Desruisseaux
This is fine, thanks for investigating. Would the following implementation adjustment be also acceptable? * If the Doclet and the Taglet are defined in the same JAR file, then they share the same URLClassLoader. I'm not 100% sure that this is the right thing to do. But it would be helpful (

Re: Public API for programmatic registration of Taglet?

2018-04-18 Thread Jonathan Gibbons
In the general case, they cannot share classloaders ... 1. If you're loading user-defined taglets into the system-defined Standard Doclet, they probably should not be in the same class loader. 2. The user may use the -tagletpath option to specify a different searchpath for taglets. You did