Running a closure through eval() throws ClassCastException
LadyCailinBot opened this issue ยท 4 comments
CMDHELPER-2901 - Reported by Octopod
The stacktrace: http://paste.thezomg.com/12956/64460139/
Relevant code: http://paste.thezomg.com/12958/39146467/
Running the code above throws java.lang.ClassCastException: com.laytonsmith.core.constructs.CString cannot be cast to com.laytonsmith.core.constructs.CLabel
Comment by LadyCailin
Closures can't be eval'd, so this is a misuse of the function. Given that it's a stracktrace though, it's still a bug.
Comment by EntityReborn
This seems to be working for me.
{{
[19:27:09 INFO]: CH: Running original command from a MCCommandSender ----> /eval eval(closure(msg('hi')))
[19:27:09 INFO]: hi}}
Comment by LadyCailin
A simple enough of a closure will work. A more complex one probably will not. This bug is valid, because I really need to explicitly check for a string being passed to eval. Closures should provide a specific error stating that they aren't supported.