Avoid overwiting methods with same signature in JavaMembers method lookup.
One class that triggers this bug is com.google.javascript.jscomp.JSSourceFile from Google's closure-compiler project, which overrides static methods of the parent class with a different return type. git-svn-id: svn://10.0.0.236/trunk@261227 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
4c7eb758f4
commit
8d55c98f02
@ -354,9 +354,12 @@ class JavaMembers
|
||||
Modifier.isProtected(mods) ||
|
||||
includePrivate)
|
||||
{
|
||||
if (includePrivate)
|
||||
method.setAccessible(true);
|
||||
map.put(new MethodSignature(method), method);
|
||||
MethodSignature sig = new MethodSignature(method);
|
||||
if (!map.containsKey(sig)) {
|
||||
if (includePrivate && !method.isAccessible())
|
||||
method.setAccessible(true);
|
||||
map.put(sig, method);
|
||||
}
|
||||
}
|
||||
}
|
||||
clazz = clazz.getSuperclass();
|
||||
@ -369,7 +372,7 @@ class JavaMembers
|
||||
Method method = methods[i];
|
||||
MethodSignature sig
|
||||
= new MethodSignature(method);
|
||||
if (map.get(sig) == null)
|
||||
if (!map.containsKey(sig))
|
||||
map.put(sig, method);
|
||||
}
|
||||
break; // getMethods gets superclass methods, no
|
||||
@ -381,7 +384,9 @@ class JavaMembers
|
||||
for (int i = 0; i < methods.length; i++) {
|
||||
Method method = methods[i];
|
||||
MethodSignature sig = new MethodSignature(method);
|
||||
map.put(sig, method);
|
||||
// Array may contain methods with same signature but different return value!
|
||||
if (!map.containsKey(sig))
|
||||
map.put(sig, method);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user