Search in sources :

Example 96 with MethodType

use of java.lang.invoke.MethodType in project jdk8u_jdk by JetBrains.

the class MethodTypeTest method testWrap.

@Test
public void testWrap() {
    System.out.println("wrap");
    MethodType[] instances = { mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi };
    MethodType[] expResults = { mt_VIS, mt_OO2, mt_Vv, mt_Ov, mt_ISI, mt_ISI, mt_ISI, mt_ISI };
    for (int i = 0; i < instances.length; i++) {
        MethodType result = instances[i].wrap();
        assertSame("#" + i, expResults[i], result);
    }
}
Also used : MethodType(java.lang.invoke.MethodType)

Example 97 with MethodType

use of java.lang.invoke.MethodType in project jdk8u_jdk by JetBrains.

the class MethodTypeTest method testMake_Class.

/**
     * Test of make method, of class MethodType.
     */
@Test
public void testMake_Class() {
    System.out.println("make (from single type)");
    Class<?> rt = Integer.class;
    MethodType expResult = MethodType.methodType(rt, new Class<?>[0]);
    MethodType result = MethodType.methodType(rt);
    assertSame(expResult, result);
}
Also used : MethodType(java.lang.invoke.MethodType)

Example 98 with MethodType

use of java.lang.invoke.MethodType in project jdk8u_jdk by JetBrains.

the class MethodTypeTest method testEquals_Object.

/**
     * Test of equals method, of class MethodType.
     */
@Test
public void testEquals_Object() {
    System.out.println("equals");
    Object x = null;
    MethodType instance = mt_viS;
    boolean expResult = false;
    boolean result = instance.equals(x);
    assertEquals(expResult, result);
}
Also used : MethodType(java.lang.invoke.MethodType)

Example 99 with MethodType

use of java.lang.invoke.MethodType in project jdk8u_jdk by JetBrains.

the class MethodTypeTest method testUnwrap.

@Test
public void testUnwrap() {
    System.out.println("unwrap");
    MethodType[] instances = { mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSI, mt_ISi, mt_ISI, mt_iSi };
    MethodType[] expResults = { mt_viS, mt_OO2, mt_vv, mt_Ov, mt_iSi, mt_iSi, mt_iSi, mt_iSi };
    for (int i = 0; i < instances.length; i++) {
        MethodType result = instances[i].unwrap();
        assertSame("#" + i, expResults[i], result);
    }
}
Also used : MethodType(java.lang.invoke.MethodType)

Example 100 with MethodType

use of java.lang.invoke.MethodType in project jdk8u_jdk by JetBrains.

the class MethodTypeTest method testParameterArray.

/**
     * Test of parameterArray method, of class MethodType.
     */
@Test
public void testParameterArray() {
    System.out.println("parameterArray");
    MethodType instance = mt_viS;
    Class<?>[] expResult = ptypes;
    Class<?>[] result = instance.parameterArray();
    assertEquals(Arrays.asList(expResult), Arrays.asList(result));
}
Also used : MethodType(java.lang.invoke.MethodType)

Aggregations

MethodType (java.lang.invoke.MethodType)102 MethodHandle (java.lang.invoke.MethodHandle)36 Test (org.junit.Test)6 MethodHandles (java.lang.invoke.MethodHandles)5 ArrayList (java.util.ArrayList)4 BytecodeBlock (com.facebook.presto.bytecode.BytecodeBlock)3 ScriptObject (com.github.anba.es6draft.runtime.types.ScriptObject)3 OrdinaryObject (com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject)3 CallSite (java.lang.invoke.CallSite)3 LambdaReceiver_A (LambdaReceiver_anotherpkg.LambdaReceiver_A)2 MethodDefinition (com.facebook.presto.bytecode.MethodDefinition)2 ConnectorSession (com.facebook.presto.spi.ConnectorSession)2 PrestoException (com.facebook.presto.spi.PrestoException)2 Map (java.util.Map)2 Session (com.facebook.presto.Session)1 BytecodeNode (com.facebook.presto.bytecode.BytecodeNode)1 ClassDefinition (com.facebook.presto.bytecode.ClassDefinition)1 Parameter (com.facebook.presto.bytecode.Parameter)1 Scope (com.facebook.presto.bytecode.Scope)1 Variable (com.facebook.presto.bytecode.Variable)1