Message242

Author njcarriero
Recipients
Date 2001-01-02.22:42:26
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
An object crossing from jython to java seems to lose its identity
if passed as a serializable object . The following illustrates the problem.

==== Output from java ====
[carriero@callisto kinase-search]$ java TellMeMore
class java.util.Hashtable
{zwei=two, uno=one}
class java.util.Hashtable
{zwei=two, uno=one}

==== Output from jython 2.0b1 ====
[carriero@callisto kinase-search]$ /home/carriero/jython/jython-2.0b1/jython tmm.py
class java.util.Hashtable
{zwei=two, uno=one}
class org.python.core.PyJavaInstance
org.python.core.PyJavaInstance@38ed7d

==== Python source ====

from java.util import *
import TellMeMore

h = Hashtable()

h.put("uno", "one")
h.put("zwei", "two")

tmm = TellMeMore()

tmm.TellMeMoreO(h)
tmm.dump()

tmm.TellMeMoreS(h)
tmm.dump()

==== Java source ====

import java.io.*;
import java.util.*;

public class TellMeMore  {
    Object	o;

    public void TellMeMoreS(Serializable o) {
	this.o = o;
    }

    public void TellMeMoreO(Object o) {
	this.o = o;
    }
    
    public void dump() {
	System.out.println(o.getClass());
	System.out.println(o.toString());
    }
    
    public static void main(String args[]) {
	Hashtable h = new Hashtable();
	h.put("uno", "one");
	h.put("zwei", "two");

	TellMeMore tmm = new TellMeMore();

	tmm.TellMeMoreO(h);
	tmm.dump();
	tmm.TellMeMoreS(h);
	tmm.dump();

    }
}
History
Date User Action Args
2008-02-20 17:16:47adminlinkissue227340 messages
2008-02-20 17:16:47admincreate