On Tue, 4 Mar 2025 14:11:28 GMT, Jorn Vernee <jver...@openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 7664:
>> 
>>> 7662:             if (mh.type() != expectedType)
>>> 7663:                 throw new IllegalArgumentException(
>>> 7664:                     "Some targets do not have the expected type " + 
>>> expectedType + ": " + caseActions);
>> 
>> I think we should avoid changing the exception messages here, since it's 
>> observable from the outside.
>> 
>> FWIW, one of the downsides of only printing out a single method handle, is 
>> that a user can't tell which method handle in the list was problematic.
>
> At least, please motivate these changes. Why do you think changing the 
> message is needed?

Here you are making the check against the default case. However, these messages 
never print the default case's type, making this error message uninformative.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23763#discussion_r1979575675

Reply via email to