예제 #1
0
파일: Bootstrap.java 프로젝트: godfat/jruby
 private static MethodHandle findStatic(
     Lookup lookup, Class target, String name, MethodType type) {
   try {
     return lookup.findStatic(target, name, type);
   } catch (Exception e) {
     throw new RuntimeException(e);
   }
 }
예제 #2
0
파일: Bootstrap.java 프로젝트: godfat/jruby
  public static CallSite ivar(Lookup lookup, String name, MethodType type) throws Throwable {
    String[] names = name.split(":");
    String operation = names[0];
    String varName = names[1];
    VariableSite site = new VariableSite(type, varName, "noname", 0);
    MethodHandle handle;

    handle =
        lookup.findStatic(
            Bootstrap.class, operation, type.insertParameterTypes(0, VariableSite.class));

    handle = handle.bindTo(site);
    site.setTarget(handle.asType(site.type()));

    return site;
  }