Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Can't Marshal.dump a Java object (from using Rjb)

Reply
Thread Tools

Can't Marshal.dump a Java object (from using Rjb)

 
 
Wes Gamble
Guest
Posts: n/a
 
      03-07-2007
All,

I have a Ruby object that actually encapsulates a Java object - I got it
by using Rjb to talk to a Java library.

When I attempt to marshal it, I get the following error:

"can't dump anonymous class"

If Rjb returned a named class instead of an anonymous one, would I then
be able to marshal it?

BTW, why can't anonymous classes be dumped?

Thanks,
Wes

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
MenTaLguY
Guest
Posts: n/a
 
      03-07-2007
On Thu, 8 Mar 2007 03:13:33 +0900, Wes Gamble <(E-Mail Removed)> wrote:
> If Rjb returned a named class instead of an anonymous one, would I then
> be able to marshal it?


No, not at this time. It isn't even technically feasible to implement unless the Java object being wrapped belongs to a class which supports Java serialization (i.e. implements java.io.Serializable).

> BTW, why can't anonymous classes be dumped?


A class name is required by Ruby's marshal format, since otherwise there would be no way to determine which class to use when loading the marshalled object. Remember that a dumped object may be loaded in a different interpreter instance than the one that dumped it.

-mental


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Object test = new Object() <-- Java, best way in C++ DrUg13 C++ 13 09-30-2008 04:20 AM
Copy Java Object into JavaScript Object Rahul Java 2 04-23-2007 11:06 AM
[compilation error] debugging this error message "Object() in java.lang.Object cannot be applied to" Gavin Java 3 03-28-2007 05:57 AM
Object creation - Do we really need to create a parent for a derieved object - can't the base object just point to an already created base object jon wayne C++ 9 09-22-2005 02:06 AM
Transform Java object to XML string object Matt Java 7 05-19-2004 05:20 AM



Advertisments