Skip to content

Unable to mix CompatVersions in @RubyMethod overloads #981

@dmarcotte

Description

@dmarcotte

It looks like it's not possible to mix CompatVersions for overloads of a method.

What I mean by this: in #979, I wanted to say

@JRubyMethod(name = "count", compat = CompatVersion.RUBY1_8)
public static IRubyObject count18(ThreadContext context, IRubyObject self, final Block block) {
    // snip
}

@JRubyMethod(compat = CompatVersion.RUBY1_9)
public static IRubyObject count(ThreadContext context, IRubyObject self, final Block block) {
    //snip
}

@JRubyMethod
public static IRubyObject count(ThreadContext context, IRubyObject self, final IRubyObject methodArg, final Block block) {
    //snip
}

and have the version which takes method arg apply to all CompatVersions.

But until I explicitly declared this function with both a CompatVersion.RUBY1_8 and CompatVersion.RUBY1_9, JRuby was convinced that there was no count method that took an argument (i.e. the with-args count didn't get registered when declared like this).

Am I misunderstanding something here? Or is this something that would be nice to support?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions