@FXML private void handleLeftButton() throws Throwable{
MethodHandles.Lookup lookup = MethodHandles.lookup();
MethodType methodType = MethodType.methodType(void.class, ListIterator.class, Text.class);
MethodHandle leftButtonClickMethod = lookup.findVirtual(HomePresenter.class, "leftButtonClick", methodType);
leftButtonClickMethod.invoke(list, menuTitle);
}
Why I get this error?
java.lang.invoke.WrongMethodTypeException: cannot convert MethodHandle(HomePresenter,ListIterator,Text)void to (ListIterator,Text)void
Looking at the example in MethodHandle - I think you need to pass the instance on which you want to call the method as the first argument
but because I never worked with java.lang.invoke this might be completely wrong.