[Jython-checkins] jython: Make sure ProxyMaker generates only one method per method+signature combination.
frank.wierzbicki
jython-checkins at python.org
Sat Dec 22 20:52:06 CET 2012
http://hg.python.org/jython/rev/4cea1e0ecd1f
changeset: 6908:4cea1e0ecd1f
user: Darjus Loktevic <darjus at gmail.com>
date: Wed Oct 24 00:25:25 2012 -0700
summary:
Make sure ProxyMaker generates only one method per method+signature combination.
The new ProxyMaker allows generating methods with the same name but multiple signatures so the old method of tracking just the name was not sufficient and i actually omitted it in the original request.
files:
src/org/python/compiler/ProxyMaker.java | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/src/org/python/compiler/ProxyMaker.java b/src/org/python/compiler/ProxyMaker.java
--- a/src/org/python/compiler/ProxyMaker.java
+++ b/src/org/python/compiler/ProxyMaker.java
@@ -19,6 +19,7 @@
protected final Class<?>[] interfaces;
Set<String> names;
Set<String> supernames = Generic.set();
+ Set<String> namesAndSigs; // name+signature pairs
public ClassFile classfile;
/** The name of the class to build. */
public String myClass;
@@ -332,7 +333,7 @@
AnnotationDescr[] methodAnnotations,
AnnotationDescr[][]parameterAnnotations) throws Exception {
boolean isAbstract = false;
-
+
if (Modifier.isAbstract(access)) {
access = access & ~Modifier.ABSTRACT;
isAbstract = true;
@@ -342,6 +343,11 @@
String[] exceptionTypes = mapExceptions(exceptions);
names.add(name);
+
+ // make sure we have only one name + signature pair available per method
+ if (!namesAndSigs.add(name + sig)) {
+ return;
+ }
Code code = null;
if (methodAnnotations != null && parameterAnnotations != null) {
@@ -608,6 +614,7 @@
public void build() throws Exception {
names = Generic.set();
+ namesAndSigs = Generic.set();
int access = superclass.getModifiers();
if ((access & Modifier.FINAL) != 0) {
throw new InstantiationException("can't subclass final class");
--
Repository URL: http://hg.python.org/jython
More information about the Jython-checkins
mailing list