8189845: Fix for 8157000 causes significant performance regression
Reviewed-by: jjg
This commit is contained in:
parent
46e1e763c1
commit
3e52d34798
@ -895,8 +895,8 @@ public class Utils {
|
||||
}
|
||||
VisibleMemberMap vmm = configuration.getVisibleMemberMap(te,
|
||||
VisibleMemberMap.Kind.METHODS);
|
||||
List<? extends Element> methods = vmm.getMembers(te);
|
||||
for (ExecutableElement ee : ElementFilter.methodsIn(methods)) {
|
||||
for (Element e : vmm.getMembers(te)) {
|
||||
ExecutableElement ee = (ExecutableElement)e;
|
||||
if (configuration.workArounds.overrides(method, ee, origin) &&
|
||||
!isSimpleOverride(ee)) {
|
||||
return ee;
|
||||
|
@ -272,9 +272,20 @@ public class VisibleMemberMap {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Cache to improve performance
|
||||
private HashMap<ExecutableElement, Boolean> overridenMethodCache = new HashMap<>();
|
||||
|
||||
private boolean hasOverridden(ExecutableElement method) {
|
||||
return overridenMethodCache.computeIfAbsent(method, m -> hasOverriddenCompute(m));
|
||||
}
|
||||
|
||||
private boolean hasOverriddenCompute(ExecutableElement method) {
|
||||
if (kind != Kind.METHODS) {
|
||||
throw new AssertionError("Unexpected kind: " + kind);
|
||||
}
|
||||
for (TypeElement t : visibleClasses) {
|
||||
for (ExecutableElement inheritedMethod : ElementFilter.methodsIn(classMap.get(t).members)) {
|
||||
for (Element member : classMap.get(t).members) {
|
||||
ExecutableElement inheritedMethod = (ExecutableElement)member;
|
||||
if (utils.elementUtils.overrides(method, inheritedMethod, t)) {
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user