From: Charlie Groves <report@bu...> - 2009-04-27 01:04:58
New submission from Charlie Groves <cgroves@...>:
When Java proxy classes are generated for python classes, they only create overriding Java methods for method names
present in the Python class at the time of creation. This means if someone adds methods to an instance of a Python
subclass of a Java class and expects them to be called from Java as it would be from a regular python class, it won't
happen. It also means __getattr__ and the like won't work for overriding Java methods unless the name was present at
the time of creation.
This has been the case since the beginning of time, and fixing it would slowdown Python subclasses of Java -- this
would cause a Python lookup every time a method is invoked in Java -- but it seems like the right thing to do to keep
from surprising people. The obvious thing to do is to eliminate addMethod in JavaMaker, and add some checking to
ProxyMaker to keep it from generating overriding methods for the proxy methods it already adds. Unfortunately this
generates some stack-busting recursion in constructors that I haven't looked into, and it's probably too close to 2.5
to do this anyway.
title: Only methods present at class creation time added to proxy classes
Jython tracker <report@...>