Top


定義場所(file name)

hotspot/src/share/vm/interpreter/linkResolver.cpp

説明(description)

// throws linktime exceptions

名前(function name)

void LinkResolver::linktime_resolve_special_method(methodHandle& resolved_method, KlassHandle resolved_klass,
                                                   Symbol* method_name, Symbol* method_signature,
                                                   KlassHandle current_klass, bool check_access, TRAPS) {

本体部(body)

  {- -------------------------------------------
  (1) LinkResolver::resolve_method() を呼んで, 対象メソッドの解決処理を行う.
      ---------------------------------------- -}

      resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, check_access, CHECK);

  {- -------------------------------------------
  (1) もし対象メソッドがコンストラクタ(= <init> メソッド) の場合は,
      指定されたクラスで定義されたメソッドかどうかをチェック
      (もしそうでなければ NoSuchMethodError)
      ---------------------------------------- -}

      // check if method name is <init>, that it is found in same klass as static type
      if (resolved_method->name() == vmSymbols::object_initializer_name() &&
          resolved_method->method_holder() != resolved_klass()) {
        ResourceMark rm(THREAD);
        Exceptions::fthrow(
          THREAD_AND_LOCATION,
          vmSymbols::java_lang_NoSuchMethodError(),
          "%s: method %s%s not found",
          resolved_klass->external_name(),
          resolved_method->name()->as_C_string(),
          resolved_method->signature()->as_C_string()
        );
        return;
      }

  {- -------------------------------------------
  (1) もし解決結果が static method であれば IncompatibleClassChangeError.
      ---------------------------------------- -}

      // check if not static
      if (resolved_method->is_static()) {
        ResourceMark rm(THREAD);
        char buf[200];
        jio_snprintf(buf, sizeof(buf),
                     "Expecting non-static method %s",
                     methodOopDesc::name_and_sig_as_C_string(Klass::cast(resolved_klass()),
                                                             resolved_method->name(),
                                                             resolved_method->signature()));
        THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
      }
    }

This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.