Custom marshal_dump problems

I’ve written my own marshal_dump method for a class, in Java. When it
gets called, a ClassCastException is thrown. Here’s the top of the
stack trace:

java.lang.ClassCastException: org.jruby.RubySymbol
at
ed.lang.ruby.RubyObjectIdWrapper$i_method_0_0$RUBYINVOKER$marshal_dump.call(ed/lang/ruby/RubyObjectIdWrapper$i_method_0_0$RUBYINVOKER$marshal_dump.gen)
at org.jruby.RubyClass.finvoke(RubyClass.java:418)
at
org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:339)
at org.jruby.RubyObject.callMethod(RubyObject.java:692)

Here is the marshal_dump method, which is based on the one in
RubyComplex:

@JRubyMethod(name = "marshal_dump")
public IRubyObject marshal_dump(ThreadContext context) {
    System.err.println("marshal_dump; returning to_s = " + to_s()); 

// DEBUG
return to_s();
}

I don’t understand what is throwing the ClassCastException. Does
anybody have any ideas?

Jim

Jim M., [email protected], [email protected]
http://www.io.com/~jimm/


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

I have worked around this by defining marshal_dump and marshal_load in
Ruby instead of Java. I don’t know why it works in Ruby but throws a
ClassCastException if define in Java.

On Thu, Nov 20, 2008 at 4:20 PM, Jim M. [email protected]
wrote:

Jim


Jim M., [email protected], [email protected]
http://www.io.com/~jimm/


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email