ClassCastException when Queue implements Java interface
-------------------------------------------------------

                 Key: JRUBY-5166
                 URL: http://jira.codehaus.org/browse/JRUBY-5166
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.5.3, JRuby 1.5.2
         Environment: On both Windows and Linux.
            Reporter: Bob Whiteside


The following code gets a ClassCastException:
----
require 'thread'
require 'java'

class RunnableQueue < Queue
  include Java::java.lang.Runnable
end

puts RunnableQueue.new.size
----

The exception looks like:
---
org/jruby/libraries/ThreadLibrary$Queue$i_method_0_0$RUBYINVOKER$length.gen:65535:in
 `call': java.lang.ClassCastException: RunnableQueue_367947505 cannot be cast 
to org.jruby.libraries.ThreadLibrary$Queue
        from CachingCallSite.java:289:in `cacheAndCall'
        from CachingCallSite.java:108:in `call'
        from queue.rb:39:in `__file__'
        from queue.rb:-1:in `load'
        from Ruby.java:685:in `runScript'
        from Ruby.java:568:in `runNormally'
        from Ruby.java:414:in `runFromMain'
        from Main.java:286:in `run'
        from Main.java:128:in `run'
        from Main.java:97:in `main'
bash-3.2$
---


I hope this is not a waste of your time:  I *think* this is how I should be 
able to make Queue declare that it implements a Java interface.  This runs 
successfully on 1.1.6 and 1.2

Cheers,
--Bob


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