void LinkResolver::lookup_method_in_klasses(methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, bool checkpolymorphism, bool in_imethod_resolve, TRAPS) {
  // Ignore overpasses so statics can be found during resolution
  Method* result_oop = klass->uncached_lookup_method(name, signature, Klass::skip_overpass);

  if (klass->oop_is_array()) {
    // Only consider klass and super klass for arrays
    result = methodHandle(THREAD, result_oop);
    return;
  }

  // JDK 8, JVMS 5.4.3.4: Interface method resolution should
  // ignore static and non-public methods of java.lang.Object,
  // like clone, finalize, registerNatives.
  if (in_imethod_resolve &&
      result_oop != NULL &&
      klass->is_interface() &&
      (result_oop->is_static() || !result_oop->is_public()) &&
      result_oop->method_holder() == SystemDictionary::Object_klass()) {
    result_oop = NULL;
  }

  // Before considering default methods, check for an overpass in the
  // current class if a method has not been found.
  if (result_oop == NULL) {
    result_oop = InstanceKlass::cast(klass())->find_method(name, signature);
  }

  if (result_oop == NULL) {
    Array<Method*>* default_methods = InstanceKlass::cast(klass())->default_methods();
    if (default_methods != NULL) {
      result_oop = InstanceKlass::find_method(default_methods, name, signature);
    }
  }

  if (checkpolymorphism && EnableInvokeDynamic && result_oop != NULL) {
    vmIntrinsics::ID iid = result_oop->intrinsic_id();
    if (MethodHandles::is_signature_polymorphic(iid)) {
      // Do not link directly to these.  The VM must produce a synthetic one using lookup_polymorphic_method.
      return;
    }
  }
  result = methodHandle(THREAD, result_oop);
}
void LinkResolver::lookup_method_in_klasses(methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, bool checkpolymorphism, bool in_imethod_resolve, TRAPS) {
   
  Method* result_oop = klass->uncached_lookup_method(name, signature, Klass::skip_overpass);

  if (klass->oop_is_array()) {
     
    result = methodHandle(THREAD, result_oop);
    return;
  }

   
   
   
  if (in_imethod_resolve &&
      result_oop != NULL &&
      klass->is_interface() &&
      (result_oop->is_static() || !result_oop->is_public()) &&
      result_oop->method_holder() == SystemDictionary::Object_klass()) {
    result_oop = NULL;
  }

   
   
  if (result_oop == NULL) {
    result_oop = InstanceKlass::cast(klass())->find_method(name, signature);
  }

  if (result_oop == NULL) {
    Array<Method*>* default_methods = InstanceKlass::cast(klass())->default_methods();
    if (default_methods != NULL) {
      result_oop = InstanceKlass::find_method(default_methods, name, signature);
    }
  }

  if (checkpolymorphism && EnableInvokeDynamic && result_oop != NULL) {
    vmIntrinsics::ID iid = result_oop->intrinsic_id();
    if (MethodHandles::is_signature_polymorphic(iid)) {
       
      return;
    }
  }
  result = methodHandle(THREAD, result_oop);
}