On Fri, 6 Jan 2023 01:05:40 GMT, Jaikiran Pai <[email protected]> wrote:
>> Trivial fix. Fix `Invokers.checkExactType` to call
>> `newWrongMethodTypeException(actual, expected)` with parameters in right
>> order.
>
> Hello Mandy, this looks good to me. The copyright year on the file will need
> an update.
>
> There's another call to this `newWrongMethodTypeException` method on line 515
> and I am guessing that one is already passing the params in the correct
> order. If I go by that same logic, then there appears to be a direct
> construction of `WrongMethodTypeException` on line 497 and I suspect the
> `String` passed to it is perhaps using the wrong order? It currently says:
>
>
> if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) !=
> ad.symbolicMethodTypeExact) {
> throw new WrongMethodTypeException("expected " +
> handle.accessModeType(ad.type) + " but found "
> + ad.symbolicMethodTypeExact);
> }
>
> Should it instead say:
>
> if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) !=
> ad.symbolicMethodTypeExact) {
> throw new WrongMethodTypeException("expected " +
> ad.symbolicMethodTypeExact + " but found "
> + handle.accessModeType(ad.type));
> }
@jaikiran good observation.
"expected" and "actual" parameters are confusing. "expected" is ambiguous and
it could refer to handle's method type or symbolic type descriptor. I decide
to rename the parameters and the exception message for clarity.
-------------
PR: https://git.openjdk.org/jdk/pull/11870