1. jython
  2. jython

Commits

Darjus Loktevic  committed 4cea1e0

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.

  • Participants
  • Parent commits 4fea52c
  • Branches default

Comments (0)

Files changed (1)

File src/org/python/compiler/ProxyMaker.java

View file
     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;
             AnnotationDescr[] methodAnnotations,
             AnnotationDescr[][]parameterAnnotations) throws Exception {
         boolean isAbstract = false;
-
+        
         if (Modifier.isAbstract(access)) {
             access = access & ~Modifier.ABSTRACT;
             isAbstract = true;
         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) {
 
     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");