Issue227340
Created on 2001-01-02.22:42:26 by njcarriero, last changed 2001-02-07.09:25:37 by bckfnn.
Messages | |||
---|---|---|---|
msg242 (view) | Author: N J Carriero (njcarriero) | Date: 2001-01-02.22:42:26 | |
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(); } } |
|||
msg243 (view) | Author: Finn Bock (bckfnn) | Date: 2001-01-03.11:20:40 | |
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. |
|||
msg244 (view) | Author: Finn Bock (bckfnn) | Date: 2001-02-07.09:25:37 | |
Fixed in: PyClass.java: 2.19; PyFloat.java: 2.7; PyInstance.java: 2.18; PyInteger.java: 2.9; PyLong.java: 2.10; PyString.java: 2.39; |
History | |||
---|---|---|---|
Date | User | Action | Args |
2001-01-02 22:42:26 | njcarriero | create |
Supported by Python Software Foundation,
Powered by Roundup