コード例 #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;
  }