From: chiba Date: Fri, 26 Jun 2009 07:08:32 +0000 (+0000) Subject: fixed JIRA JASSIST-85 X-Git-Tag: rel_3_17_1_ga~164 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3fcf471e97d82d5f7ad17d554bdd582c8a1a6986;p=javassist.git fixed JIRA JASSIST-85 git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@483 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- diff --git a/src/main/javassist/util/proxy/ProxyFactory.java b/src/main/javassist/util/proxy/ProxyFactory.java index 873e6243..82d98973 100644 --- a/src/main/javassist/util/proxy/ProxyFactory.java +++ b/src/main/javassist/util/proxy/ProxyFactory.java @@ -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); + } } }