From: Daniel B. <dan...@gm...> - 2010-03-30 00:37:31
|
Hello, I'm a new user to jython and I need some help with copying or cloning an java object to which I have a subclass written in jython This is what I have.. In Java: public class ClassA implements Cloneable { @Override public Object clone() throws CloneNotSupportedException { /* some stuff here */ return super.clone(); } In Jython: import ClassA class ClassAJython(ClassA): # some other stuff here... pass and in some other jython file i want to copy/clone a ClassAJython object this way x = ClassAJython() # do some things with x. y = x.clone() # but at this point, x and y references the same pointer to memory... so every change i'll made to y will happen in x.. I also tried a deepcopy with the copy module but it seems it's still buggy (http://bugs.jython.org/issue1551) and it doesn't copy the variables of x. Anyone can help me? Thank you! -- Daniel Barreto N. volrath.fp[at]gmail:com daniel[at]ac:labf:usb:ve Linux Registered User #454783 "I stepped out. I did not step down..." |
From: Josh J. <jun...@gm...> - 2010-03-30 12:06:16
|
Daniel- I am currently working along with one of the other developers to address this issue. I've sent some other versions of copy.py out to the group for the meantime (no final resolution yet), but in the end we are going to take a different approach to resolve the issue. The other developer who is working on this issue is currently implementing a cleaner solution in which we will not need to change copy.py at all, but rather alter java objects "behind the scenes" to make them use copy and deepcopy as expected when copy.py is called upon. With that said, we are hoping to have a resolution for this issue soon. Sorry for the delay, please keep an eye on the bug tracker for more updates. Best Josh Juneau jun...@gm... http://jj-blogger.blogspot.com http://www.jythonpodcast.com Twitter ID: javajuneau On Mon, Mar 29, 2010 at 7:37 PM, Daniel Barreto <dan...@gm...>wrote: > Hello, I'm a new user to jython and I need some help with copying or > cloning an java object to which I have a subclass written in jython > > This is what I have.. > In Java: > > public class ClassA implements Cloneable { > @Override public Object clone() throws CloneNotSupportedException { > /* some stuff here */ > return super.clone(); > } > > In Jython: > > import ClassA > class ClassAJython(ClassA): > # some other stuff here... > pass > > and in some other jython file i want to copy/clone a ClassAJython > object this way > > x = ClassAJython() > # do some things with x. > y = x.clone() > # but at this point, x and y references the same pointer to memory... > so every change i'll made to y will happen in x.. > > I also tried a deepcopy with the copy module but it seems it's still > buggy (http://bugs.jython.org/issue1551) and it doesn't copy the > variables of x. > > Anyone can help me? > > Thank you! > > -- > Daniel Barreto N. > volrath.fp[at]gmail:com > daniel[at]ac:labf:usb:ve > Linux Registered User #454783 > "I stepped out. I did not step down..." > > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |
From: Daniel B. <dan...@gm...> - 2010-03-30 18:20:35
|
Thank you Josh, Where can I find those versions of copy.py? I'm really new around here and I don't know the organization. I'm currently working with Jython 2.5.1 and I've downloaded the developers version from the svn to compare the difference in that issue, but I've found that copy.py remains the same in both the 2.5.1 tarball and the repository. Is there any patch that I can apply directly over the 2.5.1 distribution? Again, thank you for your support. On Tue, Mar 30, 2010 at 7:36 AM, Josh Juneau <jun...@gm...> wrote: > Daniel- > I am currently working along with one of the other developers to address > this issue. I've sent some other versions of copy.py out to the group for > the meantime (no final resolution yet), but in the end we are going to take > a different approach to resolve the issue. The other developer who is > working on this issue is currently implementing a cleaner solution in which > we will not need to change copy.py at all, but rather alter java objects > "behind the scenes" to make them use copy and deepcopy as expected when > copy.py is called upon. > With that said, we are hoping to have a resolution for this issue soon. > Sorry for the delay, please keep an eye on the bug tracker for more > updates. > Best > > Josh Juneau > jun...@gm... > http://jj-blogger.blogspot.com > http://www.jythonpodcast.com > Twitter ID: javajuneau > > > On Mon, Mar 29, 2010 at 7:37 PM, Daniel Barreto <dan...@gm...> > wrote: >> >> Hello, I'm a new user to jython and I need some help with copying or >> cloning an java object to which I have a subclass written in jython >> >> This is what I have.. >> In Java: >> >> public class ClassA implements Cloneable { >> @Override public Object clone() throws CloneNotSupportedException { >> /* some stuff here */ >> return super.clone(); >> } >> >> In Jython: >> >> import ClassA >> class ClassAJython(ClassA): >> # some other stuff here... >> pass >> >> and in some other jython file i want to copy/clone a ClassAJython >> object this way >> >> x = ClassAJython() >> # do some things with x. >> y = x.clone() >> # but at this point, x and y references the same pointer to memory... >> so every change i'll made to y will happen in x.. >> >> I also tried a deepcopy with the copy module but it seems it's still >> buggy (http://bugs.jython.org/issue1551) and it doesn't copy the >> variables of x. >> >> Anyone can help me? >> >> Thank you! >> >> -- >> Daniel Barreto N. >> volrath.fp[at]gmail:com >> daniel[at]ac:labf:usb:ve >> Linux Registered User #454783 >> "I stepped out. I did not step down..." >> >> >> ------------------------------------------------------------------------------ >> Download Intel® Parallel Studio Eval >> Try the new software tools for yourself. Speed compiling, find bugs >> proactively, and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> _______________________________________________ >> Jython-users mailing list >> Jyt...@li... >> https://lists.sourceforge.net/lists/listinfo/jython-users > > -- Daniel Barreto N. volrath.fp[at]gmail:com daniel[at]ac:labf:usb:ve Linux Registered User #454783 "I stepped out. I did not step down..." |