testEarlyBoundArrayLengthGetter(arrayClass, "getLength", true);
}
private static void testEarlyBoundArrayLengthGetter(Class<?> arrayClass, String op, boolean early) throws Throwable {
final BeansLinker bl = new BeansLinker();
final CallSiteDescriptor csd =
createCallSiteDescriptor("dyn:" + op, MethodType.methodType(int.class, arrayClass));
final Object array = Array.newInstance(arrayClass.getComponentType(), 2);
final GuardedInvocation inv = getGuardedInvocation(bl, csd, array);
if(early) {
// early bound, as call site guarantees we'll pass an array
assertNull(inv.getGuard());
}
final MethodHandle mh = inv.getInvocation();
assertNotNull(mh);
assertEquals(csd.getMethodType(), mh.type());
assertEquals(2, mh.invokeWithArguments(array));
}