jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • JRuby
  • JRUBY-195

method dispatch on Java objects / classes should try to find a matching varargs method

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: JRuby 1.5
  • Component/s: Java Integration
  • Labels:
    None
  • Testcase included:
    yes

Description

When calling Java methods, in addition to trying to find an exact match JRuby should make an effort in trying to find a logical match, e.g. a ruby list should be automatically transformed into a java List or array. Also, Java emthods taking an array as their last param should be considered varargs methods (like in Java 5 (ok, you have to use the ... notation, but it's still an array)).
See the included test case.

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. File
    arrayargtest.rb
    11/Oct/06 1:21 AM
    0.7 kB
    Antti Karanta

Issue Links

is duplicated by

Bug - A problem which impairs or prevents the functions of the product. JRUBY-1924 NameError thrown when trying to pass argument to a Java method that is defined as having variable length arguments

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.
is related to

Bug - A problem which impairs or prevents the functions of the product. JRUBY-814 Multiple improvements to Java integration (was: Java method get lost.)

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Charles Oliver Nutter added a comment - 17/Apr/07 4:05 PM

There is supposed to be a library released soon by one of the Rhino developers that implements Java-standard overloaded method dispatch at runtime. I believe that is our best bet for resolving all remaining method dispatch issues, since we can feed it direct Java types and coerced types until an appropriate match results.

Varargs is actually a pretty good idea, since again it's just a compiler trick in Java 5. We could easily consider methods that have an array as their last arg to be var-argable, provided all extra args in a call can map successfully to that array type.

I would love to see this in 1.0 timeframe, but it could get pushed past 1.0 and certainly won't be ready for 0.9.9.

Note: a patch that makes this varargs behavior work before 1.0 beta/RC release would very likely be accepted. Otherwise it may not be a priority until after 1.0.

Show
Charles Oliver Nutter added a comment - 17/Apr/07 4:05 PM There is supposed to be a library released soon by one of the Rhino developers that implements Java-standard overloaded method dispatch at runtime. I believe that is our best bet for resolving all remaining method dispatch issues, since we can feed it direct Java types and coerced types until an appropriate match results. Varargs is actually a pretty good idea, since again it's just a compiler trick in Java 5. We could easily consider methods that have an array as their last arg to be var-argable, provided all extra args in a call can map successfully to that array type. I would love to see this in 1.0 timeframe, but it could get pushed past 1.0 and certainly won't be ready for 0.9.9. Note: a patch that makes this varargs behavior work before 1.0 beta/RC release would very likely be accepted. Otherwise it may not be a priority until after 1.0.
Hide
Permalink
Charles Oliver Nutter added a comment - 20/Apr/07 12:37 AM

I thought I saw some varargs stuff in Bill's patch. Either way, I think his patch will make this easier to fix.

Show
Charles Oliver Nutter added a comment - 20/Apr/07 12:37 AM I thought I saw some varargs stuff in Bill's patch. Either way, I think his patch will make this easier to fix.
Hide
Permalink
Charles Oliver Nutter added a comment - 05/May/07 6:47 PM

This would be nice-to-have for 1.0, but it's not a high priority at the moment. Bumping to post RC for now.

Show
Charles Oliver Nutter added a comment - 05/May/07 6:47 PM This would be nice-to-have for 1.0, but it's not a high priority at the moment. Bumping to post RC for now.
Hide
Permalink
Charles Oliver Nutter added a comment - 16/May/07 4:58 PM

Punting to post 1.0. Nice-to-have, but it would require too much code and would represent too much "new" or "changed" functionality to get into 1.0 this late in the game.

Show
Charles Oliver Nutter added a comment - 16/May/07 4:58 PM Punting to post 1.0. Nice-to-have, but it would require too much code and would represent too much "new" or "changed" functionality to get into 1.0 this late in the game.
Hide
Permalink
Charles Oliver Nutter added a comment - 30/Sep/07 12:28 PM

I think Bill's stuff could fix this in 1.1 timeframe.

Show
Charles Oliver Nutter added a comment - 30/Sep/07 12:28 PM I think Bill's stuff could fix this in 1.1 timeframe.
Hide
Permalink
Charles Oliver Nutter added a comment - 21/Oct/07 10:22 PM

Note, this bug should also fix the cases where you want to call a varargs methods without passing any of the varargs, as caused problems in JRUBY-1233.

Show
Charles Oliver Nutter added a comment - 21/Oct/07 10:22 PM Note, this bug should also fix the cases where you want to call a varargs methods without passing any of the varargs, as caused problems in JRUBY-1233.
Hide
Permalink
Charles Oliver Nutter added a comment - 15/Feb/08 12:55 PM

Removing target release from issues that fit any of the following criteria:

  • No known way to fix them
  • Java integration enhancements out of scope for 1.1 release
  • Other out of scope issues for 1.1
Show
Charles Oliver Nutter added a comment - 15/Feb/08 12:55 PM Removing target release from issues that fit any of the following criteria:
  • No known way to fix them
  • Java integration enhancements out of scope for 1.1 release
  • Other out of scope issues for 1.1
Hide
Permalink
Ketan Padegaonkar added a comment - 10/Apr/09 4:03 AM

Ping. Just wanted to voice my vote in favor of this bug. It leaves me having to add syntactic noise in an otherwise beautiful language.

Some bit of googling revealed that rhino supports varargs: https://bugzilla.mozilla.org/show_bug.cgi?id=382457

Show
Ketan Padegaonkar added a comment - 10/Apr/09 4:03 AM Ping. Just wanted to voice my vote in favor of this bug. It leaves me having to add syntactic noise in an otherwise beautiful language. Some bit of googling revealed that rhino supports varargs: https://bugzilla.mozilla.org/show_bug.cgi?id=382457
Hide
Permalink
Bill Dortch added a comment - 10/Apr/09 1:02 PM

Funny, I was just thinking about this issue this morning. Will take a look.

Show
Bill Dortch added a comment - 10/Apr/09 1:02 PM Funny, I was just thinking about this issue this morning. Will take a look.
Hide
Permalink
Charles Oliver Nutter added a comment - 18/Aug/09 8:47 PM

Bill: Give any more thought to varargs support? We could certainly use extra hands on JI stuff

Show
Charles Oliver Nutter added a comment - 18/Aug/09 8:47 PM Bill: Give any more thought to varargs support? We could certainly use extra hands on JI stuff
Hide
Permalink
Charles Oliver Nutter added a comment - 28/Dec/09 9:30 PM

I have finally implemented varargs support in af31aeb!

~/projects/jruby ➔ jruby -rjava -e "java.lang.System.out.format('foo %d, %d, %d, %d, %d', 1, 2, 3, 4, 5)"
foo 1, 2, 3, 4, 5

It's a little hackier than I like, but I'll mark this bug for 1.5 since it's working and has specs. More cleanup to come.

Show
Charles Oliver Nutter added a comment - 28/Dec/09 9:30 PM I have finally implemented varargs support in af31aeb!
~/projects/jruby ➔ jruby -rjava -e "java.lang.System.out.format('foo %d, %d, %d, %d, %d', 1, 2, 3, 4, 5)"
foo 1, 2, 3, 4, 5
It's a little hackier than I like, but I'll mark this bug for 1.5 since it's working and has specs. More cleanup to come.
Hide
Permalink
Charles Oliver Nutter added a comment - 29/Dec/09 7:20 PM

Marking as fixed. I did a pass to unify some of the method-construction logic, and additional cleanup will come with a future rewrite of the method-selection logic.

Show
Charles Oliver Nutter added a comment - 29/Dec/09 7:20 PM Marking as fixed. I did a pass to unify some of the method-construction logic, and additional cleanup will come with a future rewrite of the method-selection logic.

People

  • Assignee:
    Charles Oliver Nutter
    Reporter:
    Antti Karanta
Vote (5)
Watch (6)

Dates

  • Created:
    11/Oct/06 1:21 AM
    Updated:
    09/Feb/11 12:21 PM
    Resolved:
    29/Dec/09 7:20 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.