static SelType callJavaMethod(Object javaObj, SelType[] args, MethodHandle m, String methodName) {
    try {
      if (args.length == 0) {
        return callJavaMethod0(javaObj, m);
      } else if (args.length == 1) {
        return callJavaMethod1(javaObj, args[0], m);
      } else if (args.length == 2) {
        return callJavaMethod2(javaObj, args[0], args[1], m);
      }
    } catch (IllegalStateException e) {
      throw e;
    } catch (Throwable t) {
      throw new IllegalArgumentException("Failed calling method " + methodName, t);
    }
    throw new UnsupportedOperationException(
        "DO NOT support calling method: " + methodName + " with args: " + Arrays.toString(args));
  }
@Test
  public void testCallJavaMethodWithOneArg() throws Throwable {
    m1 =
        MethodHandles.lookup()
            .findStatic(
                MockType.class, "staticOneArg", MethodType.methodType(int.class, int.class));
    m2 =
        MethodHandles.lookup()
            .findVirtual(
                MockType.class, "oneArg", MethodType.methodType(String.class, String.class));
    SelType res =
        SelTypeUtil.callJavaMethod(null, new SelType[] {SelLong.of(123)}, m1, "staticOneArg");
    assertEquals(SelTypes.LONG, res.type());
    assertEquals(123L, ((SelLong) res).longVal());
    res =
        SelTypeUtil.callJavaMethod(
            new MockType(), new SelType[] {SelString.of("foo")}, m2, "oneArg");
    assertEquals(SelTypes.STRING, res.type());
    assertEquals("foo", res.toString());
  }