javafx - Java MethodHandle -
@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 error?
java.lang.invoke.wrongmethodtypeexception: cannot convert methodhandle(homepresenter,listiterator,text)void (listiterator,text)void
looking @ example in methodhandle - think need pass instance on want call method first argument
leftbuttonclickmethod.invoke(this,list, menutitle);
but because never worked java.lang.invoke might wrong.
Comments
Post a Comment