On Fri, 17 Dec 2021 17:51:17 GMT, Pavel Rappo <pra...@openjdk.org> wrote:

> Using a custom taglet may result in exceptions, not all of which are javadoc 
> bugs. Some of these exceptions are taglet bugs.
> 
> It was noticed that an exception in a static initializer of a custom taglet 
> looks like a javadoc bug, which it is not. The fix was to trivially catch 
> java.lang.ExceptionInInitializerError and translate it into an error like it 
> is already done for some other exceptions.
> 
> While working on this fix, I noticed that there were no tests that cover 
> various exceptions that could arise while registering a taglet:
> 
>   * ClassNotFoundException
>   * NoSuchMethodException
>   * InstantiationException
>   * InvocationTargetException
> 
> I added a test to cover all of those as well as ExceptionInInitializerError 
> and ClassCastException, which I proactively handled similarly to 
> ExceptionInInitializerError.
> 
> I note that a typical taglet-registration error message is quite poor and 
> should be improved in the future. For example, it is unclear that the method 
> that javadoc cannot find is the nullary (i.e. parameterless or no-arg) 
> MyTaglet constructor:
> 
>     Error - Exception java.lang.NoSuchMethodException thrown while trying to 
> register Taglet MyTaglet...

This pull request has now been integrated.

Changeset: 5aecb372
Author:    Pavel Rappo <pra...@openjdk.org>
URL:       
https://git.openjdk.java.net/jdk18/commit/5aecb37211c2dec475c56dcc354b6bb4f7e3585e
Stats:     442 lines in 8 files changed: 430 ins; 11 del; 1 mod

8206181: ExceptionInInitializerError: improve handling of exceptions in 
user-provided taglets

Reviewed-by: jjg

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

PR: https://git.openjdk.java.net/jdk18/pull/44

Reply via email to