Examples of invokeWithArguments()


Examples of java.lang.invoke.MethodHandle.invokeWithArguments()

        }

        MethodHandle mh = getHandle(selfClass, switchPoint, site, method, 2, true);

        site.setTarget(mh);
        return (IRubyObject)mh.invokeWithArguments(context, self, arg0, arg1, block);
    }

    public static IRubyObject invokeSelfSimple(String name, ThreadContext context, IRubyObject self, IRubyObject arg0, IRubyObject arg1, Block block) throws Throwable {
        // TODO: literal block wrapper for break, etc
        return self.getMetaClass().invoke(context, self, name, arg0, arg1, CallType.FUNCTIONAL);
View Full Code Here

Examples of java.lang.invoke.MethodHandle.invokeWithArguments()

        }

        MethodHandle mh = getHandle(selfClass, switchPoint, site, method, 3, true);

        site.setTarget(mh);
        return (IRubyObject)mh.invokeWithArguments(context, self, arg0, arg1, arg2, block);
    }

    public static IRubyObject invokeSelfSimple(String name, ThreadContext context, IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) throws Throwable {
        // TODO: literal block wrapper for break, etc
        return self.getMetaClass().invoke(context, self, name, arg0, arg1, arg2, CallType.FUNCTIONAL);
View Full Code Here

Examples of java.lang.invoke.MethodHandle.invokeWithArguments()

  @Override
  public String render(ASTCompilationUnit compilationUnit) throws Throwable {
    MethodHandle template = template("template", "markdown");
    ModuleDocumentation documentation = new ModuleDocumentation(compilationUnit);
    return (String) template.invokeWithArguments(documentation);
  }

  @Override
  public void process(Map<String, ASTCompilationUnit> units, Path targetFolder) throws Throwable {
    TreeMap<String, String> moduleDocFile = new TreeMap<>();
View Full Code Here

Examples of java.lang.invoke.MethodHandle.invokeWithArguments()

      ensureFolderExists(docFile.getParent());
      Predefined.textToFile(render(unit), docFile);
      moduleDocFile.put(moduleName, targetFolder.relativize(docFile).toString());
    }
    MethodHandle indexTemplate = template("index", "markdown");
    String index = (String) indexTemplate.invokeWithArguments(moduleDocFile);
    Predefined.textToFile(index, targetFolder.resolve("index.markdown"));
  }
}
View Full Code Here

Examples of java.lang.invoke.MethodHandle.invokeWithArguments()

  @Test
  public void bindings() throws Throwable {
    Method lbind = moduleClass.getMethod("lbind");
    MethodHandle mh = (MethodHandle) lbind.invoke(null);
    Integer result = (Integer) mh.invokeWithArguments(2);
    assertThat(result, is(8));

    Method rbind = moduleClass.getMethod("rbind");
    mh = (MethodHandle) rbind.invoke(null);
    result = (Integer) mh.invokeWithArguments(2);
View Full Code Here

Examples of java.lang.invoke.MethodHandle.invokeWithArguments()

    Integer result = (Integer) mh.invokeWithArguments(2);
    assertThat(result, is(8));

    Method rbind = moduleClass.getMethod("rbind");
    mh = (MethodHandle) rbind.invoke(null);
    result = (Integer) mh.invokeWithArguments(2);
    assertThat(result, is(-8));
  }

  @Test
  public void chaining() throws Throwable {
View Full Code Here

Examples of java.lang.invoke.MethodHandle.invokeWithArguments()

  @Test
  public void chaining() throws Throwable {
    Method chaining = moduleClass.getMethod("chaining");
    MethodHandle mh = (MethodHandle) chaining.invoke(null);
    Integer result = (Integer) mh.invokeWithArguments(4);
    assertThat(result, is(-500));
  }

  @Test
  @SuppressWarnings("unchecked")
View Full Code Here

Examples of java.lang.invoke.MethodHandle.invokeWithArguments()

  @Override
  public String render(ASTCompilationUnit compilationUnit) throws Throwable {
    MethodHandle template = template("template", "html");
    ModuleDocumentation documentation = new ModuleDocumentation(compilationUnit);
    return (String) template.invokeWithArguments(documentation);
  }

  @Override
  public void process(Map<String, ASTCompilationUnit> units, Path targetFolder) throws Throwable {
    TreeMap<String, String> moduleDocFile = new TreeMap<>();
View Full Code Here

Examples of java.lang.invoke.MethodHandle.invokeWithArguments()

      ensureFolderExists(docFile.getParent());
      Predefined.textToFile(render(unit), docFile);
      moduleDocFile.put(moduleName, targetFolder.relativize(docFile).toString());
    }
    MethodHandle indexTemplate = template("index", "html");
    String index = (String) indexTemplate.invokeWithArguments(moduleDocFile);
    Predefined.textToFile(index, targetFolder.resolve("index.html"));
  }
}
View Full Code Here

Examples of java.lang.invoke.MethodHandle.invokeWithArguments()

  @Test
  public void check_plus() throws Throwable {
    MethodHandle handle = OperatorSupport.bootstrap(lookup(), "plus", BINOP_TYPE, 2).dynamicInvoker();

    Integer three = (Integer) handle.invokeWithArguments(1, 2);
    assertThat(three, is(3));

    String str = (String) handle.invokeWithArguments("Foo", "Bar");
    assertThat(str, is("FooBar"));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.