JEP 416: Missing throws IllegalArgumentException declaration for Method::invoke?
Hi, with the implementation of JEP 416 (https://github.com/openjdk/jdk/commit/c6339cb8a255d387bb182ad20dd69f3d460cf1... <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. Best regards, -marc
On 11/11/2021 08:21, Marc Hoffmann wrote:
Hi,
with the implementation of JEP 416 (https://github.com/openjdk/jdk/commit/c6339cb8a255d387bb182ad20dd69f3d460cf1... <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
Dear Alan, no issue at all, I just noticed in the API diff and wanted to understand whether this was on purpose. Also Thanks for the background information! -marc
On 11. Nov 2021, at 09:48, Alan Bateman <Alan.Bateman@oracle.com> wrote:
On 11/11/2021 08:21, Marc Hoffmann wrote:
Hi,
with the implementation of JEP 416 (https://github.com/openjdk/jdk/commit/c6339cb8a255d387bb182ad20dd69f3d460cf1... <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
participants (2)
-
Alan Bateman
-
Marc Hoffmann