aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/javassist/util
diff options
context:
space:
mode:
authorShigeru Chiba <chibash@users.noreply.github.com>2018-08-31 09:22:59 +0900
committerGitHub <noreply@github.com>2018-08-31 09:22:59 +0900
commitbca5c7aad8551aebda6039fb74b41c20de3d23d9 (patch)
tree8ee14bf0b1fc00e99578a592e9b69a2d67f548cc /src/main/javassist/util
parenta3d1aa25133c2ec473e9b3ebe2bfa5b4ebe5759e (diff)
parentb81414539807dcc96f4e578351f619f97956b92a (diff)
downloadjavassist-bca5c7aad8551aebda6039fb74b41c20de3d23d9.tar.gz
javassist-bca5c7aad8551aebda6039fb74b41c20de3d23d9.zip
Merge pull request #210 from NingZhang-Ericsson/JASSIST-267
fixed JASSIST-267 (new )
Diffstat (limited to 'src/main/javassist/util')
-rw-r--r--src/main/javassist/util/proxy/ProxyFactory.java24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/main/javassist/util/proxy/ProxyFactory.java b/src/main/javassist/util/proxy/ProxyFactory.java
index 072fb42c..646bbcc4 100644
--- a/src/main/javassist/util/proxy/ProxyFactory.java
+++ b/src/main/javassist/util/proxy/ProxyFactory.java
@@ -1190,7 +1190,7 @@ public class ProxyFactory {
// ignore a bridge method with the same signature that the overridden one has.
if (null != oldMethod && isBridge(m)
&& !Modifier.isPublic(oldMethod.getDeclaringClass().getModifiers())
- && !Modifier.isAbstract(oldMethod.getModifiers()) && !isOverloaded(i, methods))
+ && !Modifier.isAbstract(oldMethod.getModifiers()) && !isDuplicated(i, methods))
hash.put(key, oldMethod);
// check if visibility has been reduced
@@ -1203,16 +1203,32 @@ public class ProxyFactory {
}
}
- private static boolean isOverloaded(int index, Method[] methods) {
+ private static boolean isDuplicated(int index, Method[] methods) {
String name = methods[index].getName();
for (int i = 0; i < methods.length; i++)
if (i != index)
- if (name.equals(methods[i].getName()))
+ if (name.equals(methods[i].getName()) && areParametersSame(methods[index], methods[i]))
return true;
return false;
}
-
+
+ private static boolean areParametersSame(Method method, Method targetMethod) {
+ Class<?>[] methodTypes = method.getParameterTypes();
+ Class<?>[] targetMethodTypes = targetMethod.getParameterTypes();
+ if (methodTypes.length == targetMethodTypes.length) {
+ for (int i = 0; i< methodTypes.length; i++) {
+ if (methodTypes[i].getName().equals(targetMethodTypes[i].getName())) {
+ continue;
+ } else {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
private static final String HANDLER_GETTER_KEY
= HANDLER_GETTER + ":()";