Closure conversion doesn't play nice with some interface method names ---------------------------------------------------------------------
Key: JRUBY-5294 URL: http://jira.codehaus.org/browse/JRUBY-5294 Project: JRuby Issue Type: Bug Components: Java Integration Affects Versions: JRuby 1.5.6 Environment: Mac OS X 10.6.5 Java(TM) SE Runtime Environment (build 1.6.0_22-b04-307-10M3261) Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03-307, mixed mode) JRuby 1.5.6 Reporter: Jason Fager Attachments: jruby_exec_method_problem.tar.gz Define a Java interface with a single-argument method named 'exec'. Define a Java class that defines a method that uses instances of that interface as a callback. Use JRuby to invoke the class's method using a block as its argument, attempting to take advantage of the closure conversion feature of JRuby. When the callback is invoked by the Java method, rather than running the code defined in the block, the system attempts to coerce the argument to a String and Kernel.exec it. The same issue happens for any Kernel.* method name I've tried. I'm a complete Ruby/JRuby noob, but based on a quick perusal of the code, it looks like closure conversion is implemented by defining method_missing on a fresh new RubyClass, and that any methods already defined for Ruby's Object are going to be invoked ahead of any interface methods with the same names. This behavior may be completely expected, then; if so, I apologize for the trouble. I've attached example code illustrating the problem. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email