Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
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
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.