Charles Oliver Nutter created JRUBY-6590:
--------------------------------------------

             Summary: DelegateClass subclasses can't include Java interfaces
                 Key: JRUBY-6590
                 URL: https://jira.codehaus.org/browse/JRUBY-6590
             Project: JRuby
          Issue Type: Bug
          Components: Ruby 1.9.3
    Affects Versions: JRuby 1.6.7
            Reporter: Charles Oliver Nutter
            Assignee: Thomas E Enebo
             Fix For: JRuby 1.7


Minimal reproduction:

{noformat}
system ~/projects/jruby $ jruby -rjava -rdelegate -e "class Foo; end; class Bar 
< DelegateClass(Foo); include java.lang.Runnable; end"
NameError: undefined method `===' for class `Bar'
  append_features at org/jruby/java/proxies/JavaInterfaceTemplate.java:81
          include at org/jruby/RubyModule.java:2123
              Bar at -e:1
           (root) at -e:1
{noformat}

I believe this is because the 1.9 version of delegate.rb explicitly undefines 
=== on the class, with this code:

{noformat}
class Delegator < BasicObject
  kernel = ::Kernel.dup
  kernel.class_eval do
    [:to_s,:inspect,:=~,:!~,:===,:<=>,:eql?,:hash].each do |m|
      undef_method m
    end
  end
  include kernel
...
{noformat}

And we unconditionally try to alias/wrap === with this code in 
JavaInterfaceTemplate.java:

{noformat}
            // Because we implement Java interfaces now, we need a new === 
that's
            // aware of those additional "virtual" supertypes
            clazz.defineAlias("old_eqq", "===");
            clazz.addMethod("===", new JavaMethodOne(clazz, Visibility.PUBLIC) {
{noformat}

I have a fix pending that will simply not do this when there's no === defined 
on the source class.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.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