mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
speedup toString search
GitOrigin-RevId: fa27d74a28cce199d521669e17fd893c7eb96cab
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a06fbfaf0d
commit
26ea8cc0eb
@@ -1084,4 +1084,18 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Method concreteMethodByName(@NotNull ClassType type, String name, String signature) {
|
||||
//TODO: currently does not include interface default methods
|
||||
while (type != null) {
|
||||
for (Method candidate : type.methods()) {
|
||||
if (candidate.name().equals(name) && candidate.signature().equals(signature) && !candidate.isAbstract()) {
|
||||
return candidate;
|
||||
}
|
||||
}
|
||||
type = type.superclass();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.debugger.ui.tree.render;
|
||||
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
@@ -130,7 +130,7 @@ public class ToStringRenderer extends NodeRendererImpl implements OnDemandRender
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
private static boolean overridesToString(Type type) {
|
||||
if (type instanceof ClassType) {
|
||||
Method toStringMethod = ((ClassType)type).concreteMethodByName("toString", "()Ljava/lang/String;");
|
||||
Method toStringMethod = DebuggerUtilsEx.concreteMethodByName((ClassType)type, "toString", "()Ljava/lang/String;");
|
||||
return toStringMethod != null && !CommonClassNames.JAVA_LANG_OBJECT.equals(toStringMethod.declaringType().name());
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user