mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-04 23:48:33 +00:00
8255531: MethodHandles::permuteArguments throws NPE when duplicating dropped arguments
Reviewed-by: redestad
This commit is contained in:
parent
a68c6c2a13
commit
d07af2b8ec
@ -301,7 +301,7 @@ final class LambdaFormBuffer {
|
||||
int argp = firstChange, exprp = 0;
|
||||
for (int i = firstChange; i < arity; i++) {
|
||||
Name name = names[i];
|
||||
if (name.isParam()) {
|
||||
if (name != null && name.isParam()) {
|
||||
names[argp++] = name;
|
||||
} else {
|
||||
exprs[exprp++] = name;
|
||||
|
||||
@ -63,6 +63,8 @@ public class MethodHandlesPermuteArgumentsTest extends test.java.lang.invoke.Met
|
||||
testBadReorderIndex();
|
||||
testReturnTypeMismatch();
|
||||
testReorderTypeMismatch();
|
||||
|
||||
testPermuteWithEmpty();
|
||||
}
|
||||
|
||||
public void testPermuteArguments(int max, Class<?> type1, int t2c, Class<?> type2, int dilution) throws Throwable {
|
||||
@ -227,6 +229,12 @@ public class MethodHandlesPermuteArgumentsTest extends test.java.lang.invoke.Met
|
||||
IllegalArgumentException.class, ".*parameter types do not match after reorder.*");
|
||||
}
|
||||
|
||||
// for JDK-8255531
|
||||
private void testPermuteWithEmpty() {
|
||||
MethodHandle mh = MethodHandles.empty(MethodType.methodType(void.class, int.class, int.class));
|
||||
MethodHandles.permuteArguments(mh, MethodType.methodType(void.class, int.class), 0, 0);
|
||||
}
|
||||
|
||||
private interface RunnableX {
|
||||
void run() throws Throwable;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user