author | iignatyev |
Fri, 14 Sep 2018 14:02:57 -0700 | |
changeset 51754 | 594919232b8f |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
37347
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
1 |
/* |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
4 |
* |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
10 |
* |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
15 |
* accompanied this code). |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
16 |
* |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
20 |
* |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
23 |
* questions. |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
24 |
*/ |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
25 |
|
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
26 |
/* @test |
39488
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
27 |
* @bug 8158169 |
37347
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
28 |
* @summary unit tests for java.lang.invoke.MethodHandles |
38785
dacdc5add5eb
8158171: MethodHandles.dropArgumentsToMatch(...) non-documented IAE
srastogi
parents:
37347
diff
changeset
|
29 |
* @run testng test.java.lang.invoke.DropArgumentsTest |
37347
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
30 |
*/ |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
31 |
package test.java.lang.invoke; |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
32 |
|
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
33 |
import java.lang.invoke.MethodHandle; |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
34 |
import java.lang.invoke.MethodHandles; |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
35 |
import java.lang.invoke.MethodType; |
39488
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
36 |
import java.util.Collections; |
37347
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
37 |
import java.util.List; |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
38 |
import static java.lang.invoke.MethodHandles.*; |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
39 |
import static java.lang.invoke.MethodType.*; |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
40 |
import static org.testng.AssertJUnit.*; |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
41 |
import org.testng.annotations.*; |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
42 |
|
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
43 |
public class DropArgumentsTest { |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
44 |
|
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
45 |
@Test |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
46 |
public void testDropArgumentsToMatch() throws Throwable { |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
47 |
MethodHandle cat = lookup().findVirtual(String.class, "concat", methodType(String.class, String.class)); |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
48 |
MethodType bigType = cat.type().insertParameterTypes(0, String.class, String.class, int.class); |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
49 |
MethodHandle d0 = MethodHandles.dropArgumentsToMatch(cat, 0, bigType.parameterList(), 3); |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
50 |
assertEquals("xy",(String)d0.invokeExact("m", "n", 1, "x", "y")); |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
51 |
MethodHandle d1 = MethodHandles.dropArgumentsToMatch(cat, 0, bigType.parameterList(), 0); |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
52 |
assertEquals("mn",(String)d1.invokeExact("m", "n", 1, "x", "y")); |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
53 |
MethodHandle d2 = MethodHandles.dropArgumentsToMatch(cat, 1, bigType.parameterList(), 4); |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
54 |
assertEquals("xy",(String)d2.invokeExact("x", "b", "c", 1, "a", "y")); |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
55 |
|
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
56 |
} |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
57 |
|
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
58 |
@DataProvider(name = "dropArgumentsToMatchNPEData") |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
59 |
private Object[][] dropArgumentsToMatchNPEData() |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
60 |
throws NoSuchMethodException, IllegalAccessException { |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
61 |
MethodHandle cat = lookup().findVirtual(String.class, "concat", methodType(String.class, String.class)); |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
62 |
return new Object[][] { |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
63 |
{ (MethodHandle) null, 0, cat.type().parameterList(), 0 }, |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
64 |
{ cat, 0, null, 0 } |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
65 |
}; |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
66 |
} |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
67 |
|
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
68 |
@Test(dataProvider = "dropArgumentsToMatchNPEData") |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
69 |
@ExpectedExceptions(NullPointerException.class) |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
70 |
public void dropArgumentsToMatchNPE(MethodHandle target, int pos, List<Class<?>> valueType, int skip) { |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
71 |
MethodHandles.dropArgumentsToMatch(target, pos, valueType , skip); |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
72 |
} |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
73 |
|
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
74 |
@DataProvider(name = "dropArgumentsToMatchIAEData") |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
75 |
private Object[][] dropArgumentsToMatchIAEData() |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
76 |
throws NoSuchMethodException, IllegalAccessException { |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
77 |
MethodHandle cat = lookup().findVirtual(String.class, "concat", methodType(String.class, String.class)); |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
78 |
MethodType bigType = cat.type().insertParameterTypes(0, String.class, String.class, int.class); |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
79 |
return new Object[][] { |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
80 |
{cat, -1, bigType.parameterList(), 0}, |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
81 |
{cat, 0, bigType.parameterList(), -1}, |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
82 |
{cat, 3, bigType.parameterList(), 0}, |
39488
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
83 |
{cat, 0, bigType.parameterList(), 6}, |
37347
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
84 |
{cat, 0, bigType.parameterList(), 2} |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
85 |
}; |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
86 |
} |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
87 |
|
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
88 |
@Test(dataProvider = "dropArgumentsToMatchIAEData") |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
89 |
@ExpectedExceptions(IllegalArgumentException.class) |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
90 |
public void dropArgumentsToMatchIAE(MethodHandle target, int pos, List<Class<?>> valueType, int skip) { |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
91 |
MethodHandles.dropArgumentsToMatch(target, pos, valueType , skip); |
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
92 |
} |
38785
dacdc5add5eb
8158171: MethodHandles.dropArgumentsToMatch(...) non-documented IAE
srastogi
parents:
37347
diff
changeset
|
93 |
|
dacdc5add5eb
8158171: MethodHandles.dropArgumentsToMatch(...) non-documented IAE
srastogi
parents:
37347
diff
changeset
|
94 |
@Test |
dacdc5add5eb
8158171: MethodHandles.dropArgumentsToMatch(...) non-documented IAE
srastogi
parents:
37347
diff
changeset
|
95 |
@ExpectedExceptions(IllegalArgumentException.class) |
dacdc5add5eb
8158171: MethodHandles.dropArgumentsToMatch(...) non-documented IAE
srastogi
parents:
37347
diff
changeset
|
96 |
public void dropArgumentsToMatchTestWithVoid() throws Throwable { |
dacdc5add5eb
8158171: MethodHandles.dropArgumentsToMatch(...) non-documented IAE
srastogi
parents:
37347
diff
changeset
|
97 |
MethodHandle cat = lookup().findVirtual(String.class, "concat", |
dacdc5add5eb
8158171: MethodHandles.dropArgumentsToMatch(...) non-documented IAE
srastogi
parents:
37347
diff
changeset
|
98 |
MethodType.methodType(String.class, String.class)); |
dacdc5add5eb
8158171: MethodHandles.dropArgumentsToMatch(...) non-documented IAE
srastogi
parents:
37347
diff
changeset
|
99 |
MethodType bigTypewithVoid = cat.type().insertParameterTypes(0, void.class, String.class, int.class); |
dacdc5add5eb
8158171: MethodHandles.dropArgumentsToMatch(...) non-documented IAE
srastogi
parents:
37347
diff
changeset
|
100 |
MethodHandle handle2 = MethodHandles.dropArgumentsToMatch(cat, 0, bigTypewithVoid.parameterList(), 1); |
dacdc5add5eb
8158171: MethodHandles.dropArgumentsToMatch(...) non-documented IAE
srastogi
parents:
37347
diff
changeset
|
101 |
} |
39488
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
102 |
|
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
103 |
public static class MethodSet { |
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
104 |
|
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
105 |
static void mVoid() { |
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
106 |
|
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
107 |
} |
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
108 |
|
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
109 |
static void mVoid(int t) { |
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
110 |
|
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
111 |
} |
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
112 |
} |
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
113 |
|
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
114 |
@Test |
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
115 |
public void dropArgumentsToMatchPosSkipRange() throws Throwable { |
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
116 |
// newTypes.size() == 1, pos == 1 && target.paramSize() == 0, skip == 0 |
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
117 |
MethodHandle mh1 = MethodHandles.lookup().findStatic(MethodSet.class, "mVoid", |
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
118 |
MethodType.methodType(void.class)); |
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
119 |
MethodHandle handle1 = dropArgumentsToMatch(mh1, 0, Collections.singletonList(int.class), 1); |
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
120 |
assertEquals(1, handle1.type().parameterList().size()); |
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
121 |
|
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
122 |
// newTypes.size() == 1, pos == 0 && target.paramSize() == 1, skip == 1 |
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
123 |
MethodHandle mh2 = MethodHandles.lookup().findStatic(MethodSet.class, "mVoid", |
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
124 |
MethodType.methodType(void.class, int.class)); |
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
125 |
MethodHandle handle2 = dropArgumentsToMatch(mh2, 1, Collections.singletonList(int.class), 0); |
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
126 |
assertEquals(2, handle2.type().parameterList().size()); |
8dee5a37bdc7
8158169: MethodHandles.dropArgumentsToMatch(...)
srastogi
parents:
38785
diff
changeset
|
127 |
} |
37347
f6abe5d4bb1d
8150829: Enhanced drop-args, identity and default constant, varargs adjustment
srastogi
parents:
diff
changeset
|
128 |
} |