Examples of invokeWithArguments()


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

    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"));

    str = (String) handle.invokeWithArguments("x=", 1);
    assertThat(str, is("x=1"));
View Full Code Here

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

    assertThat(three, is(3));

    String str = (String) handle.invokeWithArguments("Foo", "Bar");
    assertThat(str, is("FooBar"));

    str = (String) handle.invokeWithArguments("x=", 1);
    assertThat(str, is("x=1"));

    str = (String) handle.invokeWithArguments(1, "=x");
    assertThat(str, is("1=x"));
View Full Code Here

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

    assertThat(str, is("FooBar"));

    str = (String) handle.invokeWithArguments("x=", 1);
    assertThat(str, is("x=1"));

    str = (String) handle.invokeWithArguments(1, "=x");
    assertThat(str, is("1=x"));

    str = (String) handle.invokeWithArguments("=> ", new Object() {
      @Override
      public String toString() {
View Full Code Here

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

    assertThat(str, is("x=1"));

    str = (String) handle.invokeWithArguments(1, "=x");
    assertThat(str, is("1=x"));

    str = (String) handle.invokeWithArguments("=> ", new Object() {
      @Override
      public String toString() {
        return "Mr Bean";
      }
    });
View Full Code Here

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

  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void plus_cannot_add_object_and_object() throws Throwable {
    MethodHandle handle = OperatorSupport.bootstrap(lookup(), "plus", BINOP_TYPE, 2).dynamicInvoker();
    handle.invokeWithArguments(new Object(), new Object());
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void plus_cannot_add_object_and_integer() throws Throwable {
    MethodHandle handle = OperatorSupport.bootstrap(lookup(), "plus", BINOP_TYPE, 2).dynamicInvoker();
View Full Code Here

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

  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void plus_cannot_add_object_and_integer() throws Throwable {
    MethodHandle handle = OperatorSupport.bootstrap(lookup(), "plus", BINOP_TYPE, 2).dynamicInvoker();
    handle.invokeWithArguments(new Object(), 1);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void plus_cannot_add_integer_and_object() throws Throwable {
    MethodHandle handle = OperatorSupport.bootstrap(lookup(), "plus", BINOP_TYPE, 2).dynamicInvoker();
View Full Code Here

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

  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void plus_cannot_add_integer_and_object() throws Throwable {
    MethodHandle handle = OperatorSupport.bootstrap(lookup(), "plus", BINOP_TYPE, 2).dynamicInvoker();
    handle.invokeWithArguments(1, new Object());
  }

  @Test
  public void check_minus() throws Throwable {
    MethodHandle handle = OperatorSupport.bootstrap(lookup(), "minus", BINOP_TYPE, 2).dynamicInvoker();
View Full Code Here

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

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

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

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void minus_cannot_substract_objects() throws Throwable {
View Full Code Here

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

  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void minus_cannot_substract_objects() throws Throwable {
    MethodHandle handle = OperatorSupport.bootstrap(lookup(), "minus", BINOP_TYPE, 2).dynamicInvoker();
    handle.invokeWithArguments(new Object(), new Object());
  }

  @Test
  public void check_divide() throws Throwable {
    MethodHandle handle = OperatorSupport.bootstrap(lookup(), "divide", BINOP_TYPE, 2).dynamicInvoker();
View Full Code Here

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

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

    Integer two = (Integer) handle.invokeWithArguments(4, 2);
    assertThat(two, is(2));
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void cannot_divide_objects() throws Throwable {
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.