|
From: <no...@so...> - 2001-01-03 11:20:51
|
Bug #127340, was updated on 2001-Jan-02 14:42
Here is a current snapshot of the bug.
Project: Jython
Category: Core
Status: Open
Resolution: Later
Bug Group: None
Priority: 5
Submitted by: njcarriero
Assigned to : nobody
Summary: Problem with serializable method parameters
Details: 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();
}
}
Follow-Ups:
Date: 2001-Jan-03 03:20
By: bckfnn
Comment:
This problem have been raised before and we quick forgot all about it:
http://mail.python.org/pipermail/jpython-interest/1999-July/001944.html
I don't feel that the solution Jim describe is such a big hack, but it does
require changes to the highly sensitive __tojava__() methods in the
classes:
PyClass
PyFloat
PyInstance
PyInteger
PyLong
PyString
Because such a change will need a long period if test, I'll delay the fix
until after the 2.0 release.
-------------------------------------------------------
For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=127340&group_id=12867
|