Ejemplo n.º 1
0
  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;
  }