Implementing Java interfaces doesn't work.
------------------------------------------

                 Key: JRUBY-1093
                 URL: http://jira.codehaus.org/browse/JRUBY-1093
             Project: JRuby
          Issue Type: Bug
          Components: Java Integration
    Affects Versions: JRuby 1.0.0RC3
            Reporter: Ola Bini
            Priority: Blocker
             Fix For: JRuby 1.0.0


I have a simple interface called com.liblib.LegacyMessageHandler:

{noformat}
package com.liblib;

public interface LegacyMessageHandler {
    void handle(String id, String msg);
}
{noformat}

I have another Java class (com.liblib.LegacyConnector) with this method:

{noformat}
    public void setHandler(LegacyMessageHandler handler) {
       this.handler = handler
    }
{noformat}

And finally I have this Ruby code:

{noformat}
require 'java'

import com.liblib.LegacyConnector
import com.liblib.LegacyMessageHandler

class RubyHandler
  import LegacyMessageHandler

  def handle(id, msg)
    puts "got: #{id}, #{msg.inspect}"
  end
end

conn = LegacyConnector.new
conn.handler = RubyHandler.new
{noformat}

This fails on the conn.handler= line saying: :-1: expected 
[com.liblib.LegacyMessageHandler]; got: [org.jruby.RubyObject]; error: argument 
type mismatch (TypeError)

If I replace the handler setter to do conn.handler = LegacyMessageHandler.impl 
... etc, this works.

I'm not sure how old this problem is, but from a Java Integration perspective, 
it's very dire.

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