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

When define_method replaces an inherited Java method, the ruby_case_version is not replaced

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: JRuby 1.1b1
  • Fix Version/s: None
  • Component/s: Java Integration
  • Labels:
    None
  • Environment:
    JRuby built from source, OSX 10.4

Description

The javaName and ruby_name versions of methods are not kept in synch.

An example

Java code:
public class Base {

public void firstMethod()

{ System.out.println("in original first method"); }

public void secondMethod()

{ System.out.println("in original second method"); }

}

Ruby code:
include_class 'Base'

class Sub < Base
def initialize(name, proc)
super()
self.class.send(:define_method, :firstMethod, proc.to_proc)
end
end

def replacement_first_method
puts "in replacement first method"
end

s = Sub.new(:firstMethod, method(:replacement_first_method))
puts s.firstMethod #=> replacement first method
puts s.first_method #=> in original first method
puts s.secondMethod #=> in original second method
puts s.second_method #=> in original second method

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Charles Oliver Nutter added a comment - 19/Oct/07 9:46 PM

Good point...and this also feeds into other bugs where you can't override/implement Java methods using underscore forms. We should try to resolve all those duality issues by 1.1.

Show
Charles Oliver Nutter added a comment - 19/Oct/07 9:46 PM Good point...and this also feeds into other bugs where you can't override/implement Java methods using underscore forms. We should try to resolve all those duality issues by 1.1.
Hide
Permalink
Charles Oliver Nutter added a comment - 26/Aug/08 2:54 PM

I see these synchronization issues like other aliases in Ruby, for example raise/fail, proc/lambda, and so on. Overriding one does not override the other, and they have their own lifecycles.

On a more positive note, implementing interfaces now works with both versions, which I think is correct behavior. And so there's a strong argument to be made for concrete subclasses. The same chance has not yet been done for concrete subclasses, so I think this end of things would certainly be valid to fix.

Show
Charles Oliver Nutter added a comment - 26/Aug/08 2:54 PM I see these synchronization issues like other aliases in Ruby, for example raise/fail, proc/lambda, and so on. Overriding one does not override the other, and they have their own lifecycles. On a more positive note, implementing interfaces now works with both versions, which I think is correct behavior. And so there's a strong argument to be made for concrete subclasses. The same chance has not yet been done for concrete subclasses, so I think this end of things would certainly be valid to fix.
Hide
Permalink
Charles Oliver Nutter added a comment - 09/Feb/09 10:40 AM

I don't think it's feasible to replace all implementations when any one of them changes, and it would be nigh impossible to know whether it's intended to replace one of them to reuse that name or to provide a new implementation. And as I mentioned above, this isn't really any different than other aliased method cases.

Show
Charles Oliver Nutter added a comment - 09/Feb/09 10:40 AM I don't think it's feasible to replace all implementations when any one of them changes, and it would be nigh impossible to know whether it's intended to replace one of them to reuse that name or to provide a new implementation. And as I mentioned above, this isn't really any different than other aliased method cases.

People

  • Assignee:
    Charles Oliver Nutter
    Reporter:
    David Koontz
Vote (0)
Watch (2)

Dates

  • Created:
    06/Sep/07 7:02 PM
    Updated:
    27/Oct/09 1:48 PM
    Resolved:
    09/Feb/09 10:40 AM
  • 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.