Examples of invokeExact()


Examples of java.lang.invoke.MethodHandle.invokeExact()

                .append(CharSequence.class, "world")
                .drop(1)
                .invoke(target2);

        assertEquals(MethodType.methodType(String.class, String.class, Object.class), handle2.type());
        assertEquals("Hello, world", (String) handle2.invokeExact("Hello, ", new Object()));
    }

    @Test
    public void testPrepend() throws Throwable {
        MethodHandle target = Subjects.concatHandle();
View Full Code Here

Examples of java.lang.invoke.MethodHandle.invokeExact()

                .prepend("Hello, ")
                .drop(1)
                .invoke(target);

        assertEquals(MethodType.methodType(String.class, Object.class, String.class), handle.type());
        assertEquals("Hello, world", (String) handle.invokeExact(new Object(), "world"));

        MethodHandle target2 = Subjects.concatHandle();
        MethodHandle handle2 = Binder
                .from(String.class, Object.class, String.class)
                .prepend(String.class, "Hello, ")
View Full Code Here

Examples of java.lang.invoke.MethodHandle.invokeExact()

                .prepend(String.class, "Hello, ")
                .drop(1)
                .invoke(target2);

        assertEquals(MethodType.methodType(String.class, Object.class, String.class), handle2.type());
        assertEquals("Hello, world", (String) handle2.invokeExact(new Object(), "world"));
    }

    @Test
    public void testDropInsert() throws Throwable {
        MethodHandle target = Subjects.concatHandle();
View Full Code Here

Examples of java.lang.invoke.MethodHandle.invokeExact()

                .drop(1)
                .insert(1, "world")
                .invoke(target);

        assertEquals(MethodType.methodType(String.class, String.class, Object.class), handle.type());
        assertEquals("Hello, world", (String) handle.invokeExact("Hello, ", new Object()));
    }
   
    @Test
    public void testDropLast() throws Throwable {
        MethodHandle target = Subjects.concatHandle();
View Full Code Here

Examples of java.lang.invoke.MethodHandle.invokeExact()

                .dropLast()
                .insert(1, "world")
                .invoke(target);

        assertEquals(MethodType.methodType(String.class, String.class, Object.class), handle.type());
        assertEquals("Hello, world", (String) handle.invokeExact("Hello, ", new Object()));

        handle = Binder
                .from(String.class, String.class, Object.class, double.class)
                .dropLast(2)
                .insert(1, "world")
View Full Code Here

Examples of java.lang.invoke.MethodHandle.invokeExact()

                .dropLast(2)
                .insert(1, "world")
                .invoke(target);

        assertEquals(MethodType.methodType(String.class, String.class, Object.class, double.class), handle.type());
        assertEquals("Hello, world", (String) handle.invokeExact("Hello, ", new Object(), 1.0));
    }

    @Test
    public void testDropFirst() throws Throwable {
        MethodHandle target = Subjects.concatHandle();
View Full Code Here

Examples of java.lang.invoke.MethodHandle.invokeExact()

                .dropFirst()
                .insert(1, "world")
                .invoke(target);

        assertEquals(MethodType.methodType(String.class, Object.class, String.class), handle.type());
        assertEquals("Hello, world", (String) handle.invokeExact(new Object(), "Hello, "));

        handle = Binder
                .from(String.class, Object.class, double.class, String.class)
                .dropFirst(2)
                .insert(1, "world")
View Full Code Here

Examples of java.lang.invoke.MethodHandle.invokeExact()

                .dropFirst(2)
                .insert(1, "world")
                .invoke(target);

        assertEquals(MethodType.methodType(String.class, Object.class, double.class, String.class), handle.type());
        assertEquals("Hello, world", (String) handle.invokeExact(new Object(), 1.0, "Hello, "));
    }

    @Test
    public void testDropAll() throws Throwable {
        MethodHandle target = Subjects.concatHandle();
View Full Code Here

Examples of java.lang.invoke.MethodHandle.invokeExact()

                .dropAll()
                .insert(0, "Hello, ", "world")
                .invoke(target);

        assertEquals(MethodType.methodType(String.class, String.class, Object.class), handle.type());
        assertEquals("Hello, world", (String) handle.invokeExact("Hello, ", new Object()));
    }

    @Test
    public void testConvert() throws Throwable {
        MethodHandle target = mixedHandle();
View Full Code Here

Examples of java.lang.invoke.MethodHandle.invokeExact()

                .from(String.class, Object.class, Integer.class, Float.class)
                .convert(target.type())
                .invoke(target);

        assertEquals(MethodType.methodType(String.class, Object.class, Integer.class, Float.class), handle.type());
        assertEquals(null, (String) handle.invokeExact((Object) "foo", (Integer) 5, (Float) 5.0f));
    }

    @Test
    public void testConvert2() throws Throwable {
        MethodHandle target = mixedHandle();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.