mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-27 02:30:06 +00:00
8143798: jck failures: api/java_lang/invoke/MethodHandle/index_MethodsTests[asSpreaderWMTE]: java.lang.VerifyError: Bad type on operand stack
Reviewed-by: vlivanov
This commit is contained in:
parent
f5466fa917
commit
063afcee2f
@ -938,7 +938,7 @@ assertEquals("[A, B, C]", (String) caToString2.invokeExact('A', "BC".toCharArray
|
||||
Class<?> arrayElement = arrayType.getComponentType();
|
||||
MethodType mtype = type();
|
||||
boolean match = true, fail = false;
|
||||
for (int i = pos; i < arrayLength; i++) {
|
||||
for (int i = pos; i < pos + arrayLength; i++) {
|
||||
Class<?> ptype = mtype.parameterType(i);
|
||||
if (ptype != arrayElement) {
|
||||
match = false;
|
||||
|
||||
@ -34,6 +34,7 @@ import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.MethodHandles.Lookup;
|
||||
import java.lang.invoke.MethodType;
|
||||
import java.lang.invoke.WrongMethodTypeException;
|
||||
import java.util.*;
|
||||
|
||||
import static java.lang.invoke.MethodType.methodType;
|
||||
@ -412,6 +413,18 @@ public class T8139885 {
|
||||
assertEquals(illegalPos.length, caught);
|
||||
}
|
||||
|
||||
@Test
|
||||
public static void testAsSpreaderIllegalMethodType() throws Throwable {
|
||||
MethodHandle h = MethodHandles.dropArguments(MethodHandles.constant(String.class, ""), 0, int.class, int.class);
|
||||
boolean caught = false;
|
||||
try {
|
||||
MethodHandle s = h.asSpreader(String[].class, 1);
|
||||
} catch (WrongMethodTypeException wmte) {
|
||||
caught = true;
|
||||
}
|
||||
assertTrue(caught);
|
||||
}
|
||||
|
||||
@Test
|
||||
public static void testAsCollector() throws Throwable {
|
||||
MethodHandle collector = SpreadCollect.MH_forCollecting.asCollector(1, int[].class, 1);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user