Guest User

Untitled

a guest
Jul 23rd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. package dyn;
  2.  
  3. import java.dyn.*;
  4.  
  5. public class Invoker {
  6.  
  7. protected Object targetObject;
  8.  
  9. public CallSite bootstrap(MethodHandles.Lookup lookup, String name, MethodType type) {
  10. try {
  11. MethodHandle handle = lookup.bind(targetObject, "bar",
  12. MethodType.methodType(void.class, String.class));
  13. return new ConstantCallSite(handle);
  14. } catch (NoAccessException e) {
  15. throw new RuntimeException("Failed lookup", e);
  16. }
  17. }
  18. }
Add Comment
Please, Sign In to add comment