use of java.lang.invoke.MethodType in project jdk8u_jdk by JetBrains.
the class MethodHandleConstants method testCase.
private static void testCase(MethodHandle mh, Class<?> defc, String name, Class<?> rtype, Class<?>... ptypes) throws Throwable {
System.out.println(mh);
// we include defc, because we assume it is a non-static MH:
MethodType mt = methodType(rtype, ptypes);
assertEquals(mh.type(), mt);
// FIXME: Use revealDirect to find out more
}
use of java.lang.invoke.MethodType in project jdk8u_jdk by JetBrains.
the class MethodTypeTest method testHashCode.
/**
* Test of hashCode method, of class MethodType.
*/
@Test
public void testHashCode() {
System.out.println("hashCode");
MethodType instance = mt_viS;
ArrayList<Class<?>> types = new ArrayList<>();
types.add(instance.returnType());
types.addAll(instance.parameterList());
int expResult = types.hashCode();
int result = instance.hashCode();
assertEquals(expResult, result);
}
use of java.lang.invoke.MethodType in project jdk8u_jdk by JetBrains.
the class MethodTypeTest method testToString.
/**
* Test of toString method, of class MethodType.
*/
@Test
public void testToString() {
System.out.println("toString");
MethodType[] instances = { mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi };
//String expResult = "void[int, class java.lang.String]";
String[] expResults = { "(int,String)void", "(Object,Object)Object", "()void", "()Object", "(String,Integer)int", "(String,int)Integer", "(String,Integer)Integer", "(String,int)int" };
for (int i = 0; i < instances.length; i++) {
MethodType instance = instances[i];
String result = instance.toString();
System.out.println("#" + i + ":" + result);
assertEquals("#" + i, expResults[i], result);
}
}
use of java.lang.invoke.MethodType in project jdk8u_jdk by JetBrains.
the class MethodTypeTest method testReturnType.
/**
* Test of returnType method, of class MethodType.
*/
@Test
public void testReturnType() {
System.out.println("returnType");
MethodType instance = mt_viS;
Class<?> expResult = void.class;
Class<?> result = instance.returnType();
assertSame(expResult, result);
}
use of java.lang.invoke.MethodType in project jdk8u_jdk by JetBrains.
the class MethodTypeTest method testMake_Class_ClassArr.
/**
* Test of make method, of class MethodType.
*/
@Test
public void testMake_Class_ClassArr() {
System.out.println("make (from type array)");
MethodType result = MethodType.methodType(rtype, ptypes);
assertSame(mt_viS, result);
}
Aggregations