Elements. Remove InterfaceElementImpl.lookUpInheritedMethod()

We have lookUpInheritedMethod2() now.

Change-Id: I679d91592873ed5fa9b6350a325ab65befc63379
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439801
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 6e61f67..8b1a84cb 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -5210,18 +5210,6 @@
     );
   }
 
-  MethodElement? lookUpInheritedMethod(
-    String methodName,
-    LibraryElement library,
-  ) {
-    return _implementationsOfMethod(methodName).firstWhereOrNull(
-      (method) =>
-          !method.isStatic &&
-          method.isAccessibleIn(library) &&
-          method.enclosingElement != this,
-    );
-  }
-
   @override
   MethodElement? lookUpInheritedMethod2({
     required String methodName,
diff --git a/pkg/analyzer/test/src/dart/element/class_element_test.dart b/pkg/analyzer/test/src/dart/element/class_element_test.dart
index 8e75a63..95a6ad2 100644
--- a/pkg/analyzer/test/src/dart/element/class_element_test.dart
+++ b/pkg/analyzer/test/src/dart/element/class_element_test.dart
@@ -1242,7 +1242,10 @@
 abstract class B implements A {}
 ''');
     var B = findElement2.class_('B');
-    assertElementNull(B._lookUpInheritedMethod('foo'));
+    assertElement(
+      B._lookUpInheritedMethod('foo'),
+      declaration: findElement2.method('foo', of: 'A'),
+    );
   }
 
   test_lookUpInheritedMethod_recursive() async {
@@ -1296,6 +1299,6 @@
   }
 
   MethodElement? _lookUpInheritedMethod(String name) {
-    return (this as InterfaceElementImpl).lookUpInheritedMethod(name, library);
+    return lookUpInheritedMethod2(methodName: name, library: library);
   }
 }