compat version in JRubyMethod hides method signatures without the attribute
---------------------------------------------------------------------------

                 Key: JRUBY-4228
                 URL: http://jira.codehaus.org/browse/JRUBY-4228
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
            Reporter: David Calavera


Trying to fix JRUBY-4222 I came across that when we have two methods with the 
same @JRubyMethod name and one of them contains the attribute "compat", it 
hides the other method and its not enabled in that mode.

this code doesn't work because jruby doesn't interpret the first method as ruby 
1.9 compatible:
{code}
    @JRubyMethod(name = "with_index", frame = true)
    public static IRubyObject with_index(ThreadContext context, IRubyObject 
self, final Block block) {
        return with_index_common(context, self, block, "with_index", 
context.getRuntime().getNil());
    }


    @JRubyMethod(name = "with_index", frame = true, compat = 
CompatVersion.RUBY1_9)
    public static IRubyObject with_index19(ThreadContext context, IRubyObject 
self, IRubyObject arg, final Block block) {
        return with_index_common(context, self, block, "with_index", arg);
    }
{code}

and calling the method without arguments fails because there is a wrong number 
of arguments:
{code}
da...@david-mirai ~/dev/jruby$ bin/jruby --1.9 -e 'p [1,2].each.with_index'
-e:1:in `with_index': wrong # of arguments(0 for 1) (ArgumentError)
        from -e:1
{code}

-- 
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


Reply via email to