[1.9] Attempt to invoke any method on Delegator leads to ClassCastException
---------------------------------------------------------------------------

                 Key: JRUBY-4871
                 URL: http://jira.codehaus.org/browse/JRUBY-4871
             Project: JRuby
          Issue Type: Bug
          Components: Ruby 1.9, RubySpec, Standard Library
            Reporter: Vladimir Sizikov
            Assignee: Thomas E Enebo


{code}
require 'delegate'

class MyDelegator < Delegator
    attr_reader :__getobj__
    
    def __setobj__(o)
      @__getobj__ = o
    end
end

d = MyDelegator.new(10)
d.freeze ## fails HERE
{code}

An attempt to execute the example above leads to:

{noformat}
jruby --1.9 deleg.rb
org/jruby/RubyObject$i_method_0_0$RUBYINVOKER$freeze.gen:65535:in `call': 
java.lang.ClassCastException: org.jruby.RubyBasicObject
cannot be cast to org.jruby.RubyObject
        from JavaMethod.java:836:in `call'
        from JavaMethod.java:642:in `call'
        from SuperCallSite.java:286:in `cacheAndCall'
        from SuperCallSite.java:70:in `callBlock'
        from SuperCallSite.java:75:in `call'
        from ZSuperNode.java:100:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from BlockNode.java:71:in `interpret'
        from InterpretedMethod.java:139:in `call'
        from CachingCallSite.java:293:in `cacheAndCall'
        from CachingCallSite.java:112:in `call'
        from CallNoArgNode.java:61:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from BlockNode.java:71:in `interpret'
        from RootNode.java:129:in `interpret'
        from Ruby.java:707:in `runInterpreter'
        from Ruby.java:568:in `runNormally'
        from Ruby.java:410:in `runFromMain'
        from Main.java:286:in `run'
        from Main.java:128:in `run'
        from Main.java:97:in `main'
{noformat}

This also causes LOTS of new rubyspec failures for Delegate library.

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