JEP 416: Missing throws IllegalArgumentException declaration for Method::invoke?
Alan Bateman
Alan.Bateman at oracle.com
Thu Nov 11 08:48:55 UTC 2021
On 11/11/2021 08:21, Marc Hoffmann wrote:
> Hi,
>
> with the implementation of JEP 416 (https://github.com/openjdk/jdk/commit/c6339cb8a255d387bb182ad20dd69f3d460cf1ed <https://github.com/openjdk/jdk/commit/c6339cb8a255d387bb182ad20dd69f3d460cf1ed>) the throws declaration for IllegalArgumentException on Method::invoke was removed — while it is still described in JavaDoc. Was this on purpose?
>
> Sorry if this was discussed before, but I was not able to find a review discussion around this commit. Also I’m not sure what the policy is whether unchecked exceptions should be declared if mentioned in JavaDoc.
Usually the method throws clause just lists the checked exceptions but
there cases where the source code (esp. older code) does declare that it
throws IllegalArgumentException, SecurityException or other unchecked
exceptions. All exceptions should of course be @throws documented in the
method description. In this case, I think it's just cleanup, the method
continues to document that it may throw IllegalArgumentException.
Are you running into an issue or is this just showing up with API
diffs? There shouldn't be a compatibility issue but maybe there is
something looking at the method Exceptions table that expects to see
unchecked exceptions?
-Alan
More information about the core-libs-dev
mailing list