]> source.dussan.org Git - javassist.git/commitdiff
fixed JIRA JASSIST-85
authorchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>
Fri, 26 Jun 2009 07:08:32 +0000 (07:08 +0000)
committerchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>
Fri, 26 Jun 2009 07:08:32 +0000 (07:08 +0000)
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@483 30ef5769-5b8d-40dd-aea6-55b5d6557bb3

src/main/javassist/util/proxy/ProxyFactory.java

index 873e6243fb97722c1f625a7b4c15b403eb776ad3..82d98973942696a4426afe4190554f122de0d281 100644 (file)
@@ -749,6 +749,17 @@ public class ProxyFactory {
                 Method m = methods[i];
                 String key = m.getName() + ':' + RuntimeSupport.makeDescriptor(m);
                 hash.put(key, methods[i]);
+                // JIRA JASSIST-85
+                // put the method to the cache, retrieve previous definition (if any) 
+                Method oldMethod = (Method)hash.put(key, methods[i]); 
+
+                // check if visibility has been reduced 
+                if (null != oldMethod && Modifier.isPublic(oldMethod.getModifiers())
+                                      && !Modifier.isPublic(methods[i].getModifiers()) ) { 
+                    // we tried to overwrite a public definition with a non-public definition,
+                    // use the old definition instead. 
+                    hash.put(key, oldMethod); 
+                }
             }
     }