I'm trying to do something which could be an unintended use of the language, but I feel loop may be a good fit for some of the logic I have in an existing Java application.
I want to compile and interpret a String of loop code within Java. Essentially I would like out of it a map of Objects to Methods I can call from Java. But I'm experiencing the following error:
java.lang.VerifyError: (class: _default, method: declarativeLogic
signature: (Ljava/lang/Object;)Ljava/lang/Object;) Unable to pop operand
off an empty stack
The error is caused by the following, very raw, test code:
Executable ex = new Executable( new StringReader("require `"+EditForm.class.getName()+"` \n" +
"declarativeLogic(editForm) -> { \n" +
"'blah': @(editForm) -> { \n" +
"editForm.editButton.disabled, \n" +
"editForm.newButton.disabled, \n" +
"editForm.cascade \n" +
"}, \n" +
"State: @(editForm) -> { \n" +
"editForm.cascade \n" +
"} \n" +
"}"));
ex.compile();
Method method = ex.getCompiled().getDeclaredMethod("declarativeLogic", EditForm.class);
Any assistance would be gratefully appreciated.