Ding! Any object that already exists in Ruby will get called before a method_missing. I am thinking about options. Yours is probably a pretty decent one...
David, change your code to use << instead of add for right now to keep moving through any regressions... -Tom On Tue, 14 Mar 2006, Charles O Nutter defenestrated me: > > Ahh, here's my theory, based on a quick look. > It's because of the lazy loading of methods!!! Huzzah! I knew this one > would come around to bite us eventually. > Because we rely on method_missing to trigger Java methods to be > loaded, if Object has a method that we want to use in an included Java > class, we'll never reach it. We will search all the way to the top of > the JavaProxy's hierarchy and eventually find the real method before > we ever trigger method_missing. > SO. We need to fix it. The solution Tom and I kicked around was to > take the list of methods from the Java class and load some faux > methods into the list, so that "methods" returns an appropriate list > and so that we don't depend on method_missing tricks. When we do > actually call those methods, we'll prime them then. > Until then I'm not sure there's an easy fix... > - Charlie > > On 3/14/06, David Corbin <[EMAIL PROTECTED] > wrote: > > The arity for list.add is coming from ModA#add, without any real > reason to be. > I'm not sure if this is "special case for the 'default' object", or > not. > ---cut---- > require 'java' > include_class 'java.util.ArrayList' > module ModA > def add a,b,c > end > end > include ModB > list = ArrayList.new > list.add "Foo" > ---end--- > > -- > Charles Oliver Nutter @ [2]headius.blogspot.com > JRuby Developer @ [3]jruby.sourceforge.net > Application Architect @ [4]www.ventera.com > > References > > 1. mailto:[EMAIL PROTECTED] > 2. http://headius.blogspot.com/ > 3. http://jruby.sourceforge.net/ > 4. http://www.ventera.com/ -- + http://www.tc.umn.edu/~enebo +---- mailto:[EMAIL PROTECTED] ----+ | Thomas E Enebo, Protagonist | "Luck favors the prepared | | | mind." -Louis Pasteur | ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ Jruby-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jruby-devel
