Message287
There appears to be a problem with PyReflectedFunction
when a Python class is an implementation of a Java
interface and delegates to a Java implementation of
that interface.
The primary problem is overloaded methods on the
interface, such as the ISimple.get() methods.
Look at classes t and u. Both do as expected. t is
not the interface, so it's marginally useful. u
implements the interface but needs to handle the get()
methods in order for it to work properly. v is what I
want, but it ends up blowing the stack. Should this
work? I think yes, but can't figure out how to patch it.
Run the code to get the full affect:
import Simple, ISimple
class t:
def __init__(self, s):
self.s = s
def __getattr__(self, name):
return getattr(self.s, name)
class u(ISimple):
def __init__(self, s):
self.s = s
def get(self, i=None):
if i:
return self.s.get(i)
else:
return self.s.get()
class v(ISimple):
def __init__(self, s):
self.s = s
def __getattr__(self, name):
return getattr(self.s, name)
def main():
print "using Simple"
y = Simple()
print y
print y.get()
print y.get(2)
print y.get()
print y.get(0)
print "using t"
y = t(Simple())
print y
print y.get()
print y.get(2)
print y.get()
print y.get(0)
print "using u"
y = u(Simple())
print y
print y.get()
print y.get(2)
print y.get()
print y.get(0)
print "using v"
y = v(Simple())
print y
print y.get()
print y.get(2)
print y.get()
print y.get(0)
if __name__ == '__main__':
main()
|
|
Date |
User |
Action |
Args |
2008-02-20 17:16:49 | admin | link | issue406193 messages |
2008-02-20 17:16:49 | admin | create | |
|