diff options
Diffstat (limited to 'tests/indy/three/Code1.java')
-rw-r--r-- | tests/indy/three/Code1.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/indy/three/Code1.java b/tests/indy/three/Code1.java new file mode 100644 index 000000000..2899340d2 --- /dev/null +++ b/tests/indy/three/Code1.java @@ -0,0 +1,21 @@ +import java.lang.invoke.CallSite; +import java.lang.invoke.ConstantCallSite; +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; + +public class Code1 { + + // Called via invokedynamic from a generated class + private static void foo() { + System.out.println("foo() is running"); + } + + public static CallSite bootstrap(MethodHandles.Lookup caller, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException { + MethodHandles.Lookup lookup = MethodHandles.lookup(); + Class<?> thisClass = lookup.lookupClass(); + MethodHandle mh = lookup.findStatic(thisClass, name, type); + return new ConstantCallSite(mh);//mh.asType(type)); + } + +}
\ No newline at end of file |