Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8255531: MethodHandles::permuteArguments throws NPE when duplicating dropped arguments #2054

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ LambdaForm endEdit() {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public void testPermuteArguments0() throws Throwable {
testBadReorderIndex();
testReturnTypeMismatch();
testReorderTypeMismatch();

testPermuteWithEmpty();
}

public void testPermuteArguments(int max, Class<?> type1, int t2c, Class<?> type2, int dilution) throws Throwable {
Expand Down Expand Up @@ -227,6 +229,12 @@ public void testReorderTypeMismatch() throws Throwable {
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;
}
Expand Down