# HG changeset patch # User srastogi # Date 1465197215 -7200 # Node ID dacdc5add5eb2a528d0c74d017ce7432b4ba78d4 # Parent c0a88deb692ad8d5d9955d14e5a6a2708db1eb41 8158171: MethodHandles.dropArgumentsToMatch(...) non-documented IAE Reviewed-by: sundar, mhaupt diff -r c0a88deb692a -r dacdc5add5eb jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Fri Jun 03 17:01:23 2016 -0700 +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Mon Jun 06 09:13:35 2016 +0200 @@ -3360,9 +3360,9 @@ * @param pos place in {@code newTypes} where the non-skipped target parameters must occur * @return a possibly adapted method handle * @throws NullPointerException if either argument is null - * @throws IllegalArgumentException - * if either index is out of range in its corresponding list, or - * if the non-skipped target parameter types match the new types at {@code pos} + * @throws IllegalArgumentException if any element of {@code newTypes} is {@code void.class}, + * or if either index is out of range in its corresponding list, + * or if the non-skipped target parameter types match the new types at {@code pos} * @since 9 */ public static diff -r c0a88deb692a -r dacdc5add5eb jdk/test/java/lang/invoke/DropArgumentsTest.java --- a/jdk/test/java/lang/invoke/DropArgumentsTest.java Fri Jun 03 17:01:23 2016 -0700 +++ b/jdk/test/java/lang/invoke/DropArgumentsTest.java Mon Jun 06 09:13:35 2016 +0200 @@ -25,7 +25,7 @@ /* @test * @summary unit tests for java.lang.invoke.MethodHandles - * @run testng/othervm -ea -esa test.java.lang.invoke.DropArgumentsTest + * @run testng test.java.lang.invoke.DropArgumentsTest */ package test.java.lang.invoke; @@ -87,4 +87,13 @@ public void dropArgumentsToMatchIAE(MethodHandle target, int pos, List> valueType, int skip) { MethodHandles.dropArgumentsToMatch(target, pos, valueType , skip); } + + @Test + @ExpectedExceptions(IllegalArgumentException.class) + public void dropArgumentsToMatchTestWithVoid() throws Throwable { + MethodHandle cat = lookup().findVirtual(String.class, "concat", + MethodType.methodType(String.class, String.class)); + MethodType bigTypewithVoid = cat.type().insertParameterTypes(0, void.class, String.class, int.class); + MethodHandle handle2 = MethodHandles.dropArgumentsToMatch(cat, 0, bigTypewithVoid.parameterList(), 1); + } }