rt/vm8/src/test/java/org/apidesign/bck2brwsr/vm8/InvokeDynamic.java
branchjdk8
changeset 1680 3b553acbd931
parent 1679 93f4fbc4d1b7
child 1681 2082d4c4bf11
     1.1 --- a/rt/vm8/src/test/java/org/apidesign/bck2brwsr/vm8/InvokeDynamic.java	Sat Sep 13 14:19:43 2014 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,59 +0,0 @@
     1.4 -/**
     1.5 - * Back 2 Browser Bytecode Translator
     1.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     1.7 - *
     1.8 - * This program is free software: you can redistribute it and/or modify
     1.9 - * it under the terms of the GNU General Public License as published by
    1.10 - * the Free Software Foundation, version 2 of the License.
    1.11 - *
    1.12 - * This program is distributed in the hope that it will be useful,
    1.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.15 - * GNU General Public License for more details.
    1.16 - *
    1.17 - * You should have received a copy of the GNU General Public License
    1.18 - * along with this program. Look for COPYING file in the top folder.
    1.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
    1.20 - */
    1.21 -package org.apidesign.bck2brwsr.vm8;
    1.22 -
    1.23 -import java.lang.invoke.CallSite;
    1.24 -import java.lang.invoke.ConstantCallSite;
    1.25 -import java.lang.invoke.MethodHandles;
    1.26 -import java.lang.invoke.MethodType;
    1.27 -import org.apidesign.bck2brwsr.core.JavaScriptBody;
    1.28 -
    1.29 -public class InvokeDynamic {
    1.30 -
    1.31 -    public static String dynamicSay() {
    1.32 -        return TEST_dynamic_boot1(new InvokeDynamic());
    1.33 -    }
    1.34 -
    1.35 -    private static String TEST_dynamic_boot1(InvokeDynamic instance) {
    1.36 -        throw new IllegalStateException("Can't touch this");
    1.37 -    }
    1.38 -
    1.39 -    public static CallSite boot1(MethodHandles.Lookup lookup, String name, MethodType type) {
    1.40 -        assertReal("1st parameter lookup", lookup);
    1.41 -        assertReal("2nd parameter name", name);
    1.42 -        assertReal("3rd parameter type", type);
    1.43 -        assert lookup.lookupClass() == InvokeDynamic.class : "We are making the lookup: " + lookup.lookupClass();
    1.44 -        try {
    1.45 -            return new ConstantCallSite(lookup.findVirtual(InvokeDynamic.class, "instance_sayHello", MethodType.methodType(String.class)));
    1.46 -        } catch (NoSuchMethodException | IllegalAccessException e) {
    1.47 -            throw new IllegalStateException(e);
    1.48 -        }
    1.49 -    }
    1.50 -
    1.51 -    @JavaScriptBody(args = { "msg", "value" }, body = 
    1.52 -        "if (!value) throw msg + ' value: ' + value;"
    1.53 -    )
    1.54 -    private static void assertReal(String msg, Object value) {
    1.55 -        assert value != null : msg;
    1.56 -        System.err.println(msg + " value: " + value);
    1.57 -    }
    1.58 -    
    1.59 -    public String instance_sayHello() {
    1.60 -        return "Hello from Dynamic!";
    1.61 -    }
    1.62 -}
    1.63 \ No newline at end of file