From: Finn B. <bc...@us...> - 2001-03-22 20:07:12
|
Update of /cvsroot/jython/jython/Tools/jythonc In directory usw-pr-cvs1:/tmp/cvs-serv22524 Modified Files: ObjectFactory.py compile.py proxies.py Log Message: Fix for #406193, #231507 and #222819. Index: ObjectFactory.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/ObjectFactory.py,v retrieving revision 2.6 retrieving revision 2.7 diff -C2 -r2.6 -r2.7 *** ObjectFactory.py 2000/11/17 20:49:00 2.6 --- ObjectFactory.py 2001/03/22 20:07:08 2.7 *************** *** 193,196 **** --- 193,197 ---- self.proxyname = None self.supername = None + self.issuperproxy = 0 import compile for base in self.bases: *************** *** 214,217 **** --- 215,219 ---- self.proxyname = self.name self.supername = base.name + self.issuperproxy = 1 continue if isinstance(base, PyNamespace): *************** *** 227,230 **** --- 229,233 ---- self.proxyname = self.name self.supername = cls.value.name + self.issuperproxy = 1 if cls.value.name != mod.name: self.supername = mod.name + '.' + self.supername Index: compile.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/compile.py,v retrieving revision 2.16 retrieving revision 2.17 diff -C2 -r2.16 -r2.17 *** compile.py 2000/12/04 21:43:18 2.16 --- compile.py 2001/03/22 20:07:08 2.17 *************** *** 150,154 **** if pyc.isSuperclassJava(): return proxies.JavaProxy(pyc.name, pyc.supername, ! pyc.javaclasses, methods, module) return None --- 150,154 ---- if pyc.isSuperclassJava(): return proxies.JavaProxy(pyc.name, pyc.supername, ! pyc.javaclasses, methods, module, pyc.issuperproxy) return None Index: proxies.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/proxies.py,v retrieving revision 2.9 retrieving revision 2.10 diff -C2 -r2.9 -r2.10 *** proxies.py 2001/02/14 22:30:23 2.9 --- proxies.py 2001/03/22 20:07:08 2.10 *************** *** 113,121 **** class JavaProxy: ! def __init__(self, name, supername, bases, methods, module=None): self.bases = bases self.name = name self.supername = supername self.methods = methods self.packages = self.properties = jast.Null --- 113,123 ---- class JavaProxy: ! def __init__(self, name, supername, bases, methods, module=None, ! issuperproxy = 1): self.bases = bases self.name = name self.supername = supername self.methods = methods + self.issuperproxy = issuperproxy self.packages = self.properties = jast.Null *************** *** 142,145 **** --- 144,148 ---- self.jmethods = {} + self.supermethods = {} for base in bases: self.addMethods(base) *************** *** 164,167 **** --- 167,171 ---- self.dumpConstructors() self.addPyProxyInterface() + self.addClassDictInit() return self.statements *************** *** 286,289 **** --- 290,296 ---- def callSuperMethod(self, name, supername, access, ret, sig, throws=[]): + if self.issuperproxy: + return + self.supermethods[supername] = supername args = [typeName(ret)] argids = [] *************** *** 356,362 **** supercall = jast.Return(supercall) ! supermethod = jast.Method("super__"+name, jast.Modifier.ModifierString(access), args, jast.Block([supercall]), throws) else: if self.isAdapter: --- 363,372 ---- supercall = jast.Return(supercall) ! supermethod = None ! if not self.issuperproxy: ! supermethod = jast.Method("super__"+name, jast.Modifier.ModifierString(access), args, jast.Block([supercall]), throws) + self.supermethods["super__"+name] = "super__"+name else: if self.isAdapter: *************** *** 464,467 **** --- 474,489 ---- self.interfaces.append(org.python.core.PyProxy) + def addClassDictInit(self): + self.interfaces.append(org.python.core.ClassDictInit) + + namelist = jast.InvokeStatic("Py", "java2py", [ + jast.StringArray(self.supermethods.keys()) ]); + + code = jast.Invoke(jast.Identifier("dict"), "__setitem__", [ + jast.StringConstant("__supernames__"), namelist]); + + code = jast.Block([code]) + self.statements.append(jast.Method("classDictInit", "static public", + ["void", ("PyObject", "dict")], code)) def makeClass(self): |