Subclasses of generated Java proxy classes don't inherit correctly (patch 
attached)
-----------------------------------------------------------------------------------

                 Key: JRUBY-910
                 URL: http://jira.codehaus.org/browse/JRUBY-910
             Project: JRuby
          Issue Type: Bug
          Components: Java Integration
    Affects Versions: JRuby 1.0.0
            Reporter: Bill Dortch
         Attachments: java_proxy_subclasses.patch

Subclasses of (Ruby-defined, generated) Java proxy classes don't work as 
expected.  Specifically, interfaces and overridden methods defined farther up 
in the hierarchy aren't carried down past the defining subclass.  For example:
{code}
button = javax.swing.JButton.new

class A < javax.swing.JFrame
  include java.awt.event.ActionListener
...
end

button.add_action_listener A.new #=> works

class B < A
  include javax.swing.event.ChangeListener
...
end

button.add_change_listener B.new #=> works
button.add_action_listener B.new #=> fails: TypeError

class C < B
end

button.add_change_listener C.new #=> fails: TypeError
button.add_action_listener C.new #=> fails: TypeError
{code}

A similar problem exists (but is harder to demonstrate) for overridden methods.

The attached patch resolves both problems (which resulted from an oversight on 
my part). Interfaces and overrides are carried down through any number of 
derivations, even if intermediate classes are never instantiated:
{code}
class A < JFrame; end
class B < A
  include java.awt.event.ActionListener
end
class C < B; end
class D < C
  include javax.swing.event.ChangeListener
end
class E < D; end
class F < E; end

button.add_action_listener F.new #=> works
button.add_change_listener F.new #=> works
{code}

Tests they are a-comin....

-Bill


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