Examples of invokeWithArguments()


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

  }

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

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

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

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

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

    String str = (String) handle.invokeWithArguments(2, "a");
    assertThat(str, is("aa"));
View Full Code Here

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

    MethodHandle handle = OperatorSupport.bootstrap(lookup(), "times", BINOP_TYPE, 2).dynamicInvoker();

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

    String str = (String) handle.invokeWithArguments(2, "a");
    assertThat(str, is("aa"));

    str = (String) handle.invokeWithArguments("a", 4);
    assertThat(str, is("aaaa"));
  }
View Full Code Here

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

    assertThat(four, is(4));

    String str = (String) handle.invokeWithArguments(2, "a");
    assertThat(str, is("aa"));

    str = (String) handle.invokeWithArguments("a", 4);
    assertThat(str, is("aaaa"));
  }

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

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

  }

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

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

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

  }

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

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

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

  }

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

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

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

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

    assertThat((Boolean) handle.invokeWithArguments(null, null), is(true));
    assertThat((Boolean) handle.invokeWithArguments(null, "foo"), is(false));
    assertThat((Boolean) handle.invokeWithArguments("foo", null), is(false));
    assertThat((Boolean) handle.invokeWithArguments("foo", "foo"), is(true));
    assertThat((Boolean) handle.invokeWithArguments("foo", "bar"), is(false));
  }
View Full Code Here

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

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

    assertThat((Boolean) handle.invokeWithArguments(null, null), is(true));
    assertThat((Boolean) handle.invokeWithArguments(null, "foo"), is(false));
    assertThat((Boolean) handle.invokeWithArguments("foo", null), is(false));
    assertThat((Boolean) handle.invokeWithArguments("foo", "foo"), is(true));
    assertThat((Boolean) handle.invokeWithArguments("foo", "bar"), is(false));
  }
View Full Code Here

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

  public void check_equals() throws Throwable {
    MethodHandle handle = OperatorSupport.bootstrap(lookup(), "equals", BINOP_TYPE, 2).dynamicInvoker();

    assertThat((Boolean) handle.invokeWithArguments(null, null), is(true));
    assertThat((Boolean) handle.invokeWithArguments(null, "foo"), is(false));
    assertThat((Boolean) handle.invokeWithArguments("foo", null), is(false));
    assertThat((Boolean) handle.invokeWithArguments("foo", "foo"), is(true));
    assertThat((Boolean) handle.invokeWithArguments("foo", "bar"), is(false));
  }

  @Test
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.