Integrated: 8255449: Improve the exception message of MethodHandles::permuteArguments

Jorn Vernee jvernee at openjdk.java.net
Thu Oct 29 18:37:49 UTC 2020


On Tue, 27 Oct 2020 12:43:47 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> Hi,
> 
> Currently, if MethodHandles::permuteArguments is used with a reorder array that is the wrong size, or one of the indexes in it is out of bounds of the new type, we simply get the exception message:
> 
>     bad reorder array [...]
> 
> I think we can improve the exception message by splitting these two error cases, and saying in the message exactly what went wrong.
> 
> permuteArguments is a tricky API, so improving the error message here should help to improve developer productivity.
> 
> This PR proposes splits the error message into e.g.:
> 
>     old type parameter count and reorder array length do not match: (int,int,String)int, [0, 0]
> 
> For an incorrect reorder array length, and:
> 
>     index is out of bounds for new type: 2, (int,String)int
> 
> For an out of bounds index.
> 
> Thanks,
> Jorn

This pull request has now been integrated.

Changeset: 2a2fa134
Author:    Jorn Vernee <jvernee at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/2a2fa134
Stats:     78 lines in 2 files changed: 62 ins; 3 del; 13 mod

8255449: Improve the exception message of MethodHandles::permuteArguments

Reviewed-by: chegar, mchung

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

PR: https://git.openjdk.java.net/jdk/pull/878


More information about the core-libs-dev mailing list