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...
-------------
Commit messages:
- Merge branch 'openjdk:master' into 8206181
- Initial commit
Changes: https://git.openjdk.java.net/jdk18/pull/44/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk18&pr=44&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8206181
Stats: 442 lines in 8 files changed: 430 ins; 11 del; 1 mod
Patch: https://git.openjdk.java.net/jdk18/pull/44.diff
Fetch: git fetch https://git.openjdk.java.net/jdk18 pull/44/head:pull/44
PR: https://git.openjdk.java.net/jdk18/pull/44