From: Carmona P. D. <DPe...@fc...> - 2004-05-07 08:23:54
|
I forgot in my snippet to add the public keyword to the Java classes. I have tried the Samuele's patch, and doesn't solve my problem. > -----Mensaje original----- > De: jyt...@li... > [mailto:jyt...@li...]En nombre de Carmona > Perez, David > Enviado el: viernes, 07 de mayo de 2004 9:21 > Para: JyDev (E-mail) > Asunto: RE: [Jython-dev] Class inheritance bug >=0D >=0D >=0D >=0D > The problem is: >=0D > Java code: > ------------ >=0D > package mypackage; >=0D > class Base { > ... > } >=0D > class Derived extends Base { > void newMethod() { > } > } >=0D > class AccessedFromJthon { > static Derived getData() { > return new Derived(); > } > } >=0D > Jython code: > ------------ >=0D > def myFunction(): > from mypackage import AccessedFromJthon > data =3D AccessedFromJthon.getData() > print 'type=3D'+str(type(data)) > data.newMethod() >=0D >=0D > The first time I call myFunction(), everything is ok and >=0D > type=3Dmypackage.Derived >=0D > is printed. > Next invocations of myFunction() print > type=3Dmypackage.Base > and the call to newMethod fails, Jython complains that=0D > mypackage.Base has no attribute called 'newMethod'. >=0D > > -----Mensaje original----- > > De: jyt...@li... > > [mailto:jyt...@li...]En nombre de=0D > Ype Kingma > > Enviado el: jueves, 06 de mayo de 2004 19:47 > > Para: jyt...@li... > > Asunto: Re: [Jython-dev] Class inheritance bug > > >=0D > > >=0D > > >=0D > > David, > > >=0D > > you wrote: > > > I have also seen another bug, that seems similar to this one. > > > > > > I have a static class method that returns an object. > > > Jython thinks the class of the object returned is its base >=0D > > class, so I > > >=0D > > That is unusual. Could you be more specific? > > >=0D > > > cannot call any method added in the derived class. > > > > > > Does anybody know a workaround? > > >=0D > > Did you try Samuele's workaround: > > >=0D > > TheDerivedClass.theAddedMethod(returnedObject) > > >=0D > > ? > > It should not matter that the object is returned by a static method. > > >=0D > > Regards, > > Ype > > >=0D > > >=0D > > >=0D > > ------------------------------------------------------- > > This SF.Net email is sponsored by Sleepycat Software > > Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to >=0D > > deliver higher performing products faster, at low TCO. > > http://www.sleepycat.com/telcomwpreg.php?From=3Dosdnemail3 > > _______________________________________________ > > Jython-dev mailing list > > Jyt...@li... > > https://lists.sourceforge.net/lists/listinfo/jython-dev > > >=0D > > ************************************************************* > > Este correo ha sido procesado por el antivirus del Grupo FCC. > > ************************************************************* > > >=0D >=0D > ************************************************************* > Este correo ha sido procesado por el Antivirus del Grupo FCC > ************************************************************* >=0D >=0D > ------------------------------------------------------- > This SF.Net email is sponsored by Sleepycat Software > Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to >=0D > deliver higher performing products faster, at low TCO. > http://www.sleepycat.com/telcomwpreg.php?Fromosdnemail3_______ ________________________________________ Jython-dev mailing list Jyt...@li... https://lists.sourceforge.net/lists/listinfo/jython-dev ************************************************************* Este correo ha sido procesado por el antivirus del Grupo FCC. ************************************************************* ************************************************************* Este correo ha sido procesado por el antivirus del Grupo FCC. ************************************************************* |