From 3fcf471e97d82d5f7ad17d554bdd582c8a1a6986 Mon Sep 17 00:00:00 2001 From: chiba Date: Fri, 26 Jun 2009 07:08:32 +0000 Subject: [PATCH] fixed JIRA JASSIST-85 git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@483 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- src/main/javassist/util/proxy/ProxyFactory.java | 11 +++++++++++ 1 file changed, 11 insertions(+) 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); + } } } -- 2.39.5