JDK-8150825 : MethodHandles.tryFinally throws IndexOutOfBoundsException for non-conforming parameter lists
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2016-02-29
  • Updated: 2016-03-03
  • Resolved: 2016-02-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b108Fixed
Related Reports
Relates :  
Description
private static void target() {}
private static void cleanup(Throwable t, int a1) {}

Calling tryFinally on these leads to "IndexOutOfBoundsException: toIndex = 1", when I expected to get IllegalArgumentException.
I think IllegalArgumentException description is OK, but the javadoc misses IndexOutOfBoundsException description.
Comments
The problem here is that a too short parameter type list in the target is not taken into account properly. The exception thrown should be an IAE.
29-02-2016