PylonsHQ.

Anonymous
May 19, 2009 3:12:42 AM

JVM + Indy crasher with Jython

Language: Java
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.dyn.CallSite;
import java.dyn.InvokeDynamic;
import java.dyn.Linkage;
import java.dyn.MethodType;
import java.dyn.MethodHandles;

import org.python.core.PySystemState;

public class Example {
    public static void main(String... args) {
        new PySystemState();
        InvokeDynamic.<void>baz();
    }

    public static void hello() {
        System.out.println("just a test");
    }

    static { Linkage.registerBootstrapMethod("linkDynamic"); }
    private static CallSite linkDynamic(Class caller, String name, MethodType type) {
        System.out.println("linking:" + name);
        CallSite c = new CallSite(caller, name, type);
        c.setTarget(MethodHandles.lookup().findStatic(Example.class, "hello", MethodType.make(void.class)));
        return c;
    }

}

Download

Comments (0)

You must login before you can comment.

Powered by Pylons - Contact Administrators