RFR(XXS): 8156226: DiagnosticCommandImpl::invoke throws NoSuchMethodException even if the method actually exists but parameters are wrong

Kirill Zhaldybin kirill.zhaldybin at oracle.com
Fri May 6 17:39:06 UTC 2016


Alexander,

Thank you for reviewing the fix.

On 06.05.2016 20:24, Alexander Kulyakhtin wrote:
> Is there a specification of what shall be thrown, or the justification of the changes done?
> One can think that the currently thrown NoSuchMethodException is correct since methods, which differ in signature only, are still different methods.
I spent some time trying to figure out why I got NoSuchMethodException 
for "help" despite such method actually existed.

If you think that to throw NoSuchMethodException is better for wrong 
signature I could just change error message in this case.

Could you please let me know your opinion?

Thank you.

Regards, Kirill

>
> Best regards,
> Alexander
>
>
> ----- Original Message -----
> From: kirill.zhaldybin at oracle.com
> To: serviceability-dev at openjdk.java.net
> Sent: Friday, May 6, 2016 8:11:08 PM GMT +03:00 Iraq
> Subject: RFR(XXS): 8156226: DiagnosticCommandImpl::invoke throws NoSuchMethodException even if the method actually exists but parameters are wrong
>
> Dear all,
>
> Could you please review this small fix for 8156226?
>
> A case when a method exists but parameters' signature is wrong now
> causes new ReflectionException(new IllegalArgumentException()) thrown
> instead of new ReflectionException(new NoSuchMethodException()).
>
> WebRev: http://cr.openjdk.java.net/~kzhaldyb/webrevs/JDK-8156226/webrev.00/
>
> CR: https://bugs.openjdk.java.net/browse/JDK-8156226
>
> Thank you.
>
> Regards, Kirill
>



More information about the serviceability-dev mailing list