RFR: 8255449: Improve the exception message of MethodHandles::permuteArguments [v3]

Jorn Vernee jvernee at openjdk.java.net
Wed Oct 28 15:00:59 UTC 2020


> 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

Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision:

  Fail when exception is not thrown in assertThrows

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/878/files
  - new: https://git.openjdk.java.net/jdk/pull/878/files/2dbb4e57..34050c3e

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=878&range=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=878&range=01-02

  Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/878.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/878/head:pull/878

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


More information about the core-libs-dev mailing list