Package org.dynalang.dynalink.linker

Examples of org.dynalang.dynalink.linker.LinkerServices


        // we want to link to the vararg invocation
        assertBooReturns(2, linkerServices, 1, 2);

        // If we're linking with a converter that knows how to convert double to int, then we want to make sure we
        // don't link to the vararg (Class, int[]) invocation but to the (Class, int) invocation.
        final LinkerServices ls = new LinkerServicesImpl(new TypeConverterFactory(Collections.singleton(
                new GuardingTypeConverterFactory() {
                    @Override
                    public GuardedInvocation convertToType(Class<?> sourceType, Class<?> targetType) {
                        if(targetType == int.class) {
                            return new GuardedInvocation(new Lookup(MethodHandles.publicLookup()).findVirtual(
View Full Code Here


                        argList));
    }

    public static void main(String[] args) throws Throwable {
        TypeBasedGuardingDynamicLinker linker = BeansLinker.getLinkerForClass(Test1.class);
        LinkerServices ls = LinkerServicesFactory.getLinkerServices(linker);


        Test1 test1 = new Test1();
        GuardedInvocation inv = linker.getGuardedInvocation(new LinkRequestImpl(
                CallSiteDescriptorFactory.create(MethodHandles.publicLookup(), "dyn:callMethod:add",
View Full Code Here

     *
     * @throws Exception if an exception occurs
     */
    public void testAllNulls() throws Exception {
        final BeansLinker linker = new BeansLinker();
        final LinkerServices ls = new LinkerServices() {
            @Override
            public boolean canConvert(Class<?> from, Class<?> to) {
                throw new AssertionFailedError();
            }

View Full Code Here

        final MethodHandle mh = getTest1XMethod();
        final MethodType type = MethodType.methodType(int.class, Test1.class, int.class, int.class);

        final boolean[] converterInvoked = new boolean[1];

        LinkerServices ls = new MockLinkerServices() {
            @Override
            public MethodHandle asType(MethodHandle handle, MethodType fromType) {
                assertSame(handle, mh);
                assertEquals(type, fromType);
                converterInvoked[0] = true;
View Full Code Here

        final MethodHandle mh = getTest1XvMethod();
        final MethodType type = MethodType.methodType(int.class, Test1.class, int.class, int[].class);

        final boolean[] converterInvoked = new boolean[1];

        LinkerServices ls = new MockLinkerServices() {
            @Override
            public MethodHandle asType(MethodHandle handle, MethodType fromType) {
                assertEqualHandle(handle, mh);
                assertEquals(type, fromType);
                converterInvoked[0] = true;
View Full Code Here

        final MethodHandle mh = getTest1XvMethod();
        final MethodType callSiteType = MethodType.methodType(int.class, Object.class, int.class);

        final boolean[] converterInvoked = new boolean[1];

        LinkerServices ls = new MockLinkerServices() {
            @Override
            public MethodHandle asType(MethodHandle handle, MethodType fromType) {
                assertNotSame(handle, mh);
                assertEquals(MethodType.methodType(int.class, Test1.class, int.class), handle.type());
                assertEquals(callSiteType, fromType);
View Full Code Here

        final MethodType callSiteType = MethodType.methodType(int.class, Object.class, int.class, int.class, int.class);
        final MethodType declaredType = MethodType.methodType(int.class, Test1.class, int.class, int.class, int.class);

        final boolean[] converterInvoked = new boolean[1];

        LinkerServices ls = new MockLinkerServices() {
            @Override
            public MethodHandle asType(MethodHandle handle, MethodType fromType) {
                assertNotSame(handle, mh);
                assertEquals(declaredType, handle.type());
                assertEquals(callSiteType, fromType);
View Full Code Here

        final MethodType declaredType = MethodType.methodType(int.class, Test1.class, int.class, int.class);
        final MethodType callSiteType = MethodType.methodType(int.class, Object.class, int.class, int.class);

        final boolean[] converterInvoked = new boolean[1];

        LinkerServices ls = new MockLinkerServices() {
            @Override
            public boolean canConvert(Class<?> from, Class<?> to) {
                assertSame(int.class, from);
                assertSame(int[].class, to);
                return false;
View Full Code Here

        final MethodHandle mh = getTest1SvMethod();
        final MethodType callSiteType = MethodType.methodType(String.class, Object.class, String.class, String.class);

        final boolean[] converterInvoked = new boolean[1];

        LinkerServices ls = new MockLinkerServices() {
            @Override
            public boolean canConvert(Class<?> from, Class<?> to) {
                assertSame(String.class, from);
                assertSame(String[].class, to);
                return false;
View Full Code Here

        final MethodType callSiteType =
                MethodType.methodType(String.class, Object.class, String.class, String.class, String.class);

        final boolean[] converterInvoked = new boolean[1];

        LinkerServices ls = new MockLinkerServices() {
            @Override
            public MethodHandle asType(MethodHandle handle, MethodType fromType) {
                assertNotSame(handle, mh);
                assertEquals(
                        MethodType.methodType(String.class, Test1.class, String.class, String.class, String.class),
View Full Code Here

TOP

Related Classes of org.dynalang.dynalink.linker.LinkerServices

Copyright © 2018 www.massapicom. 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.