当前位置: 首页>>代码示例>>C++>>正文


C++ VerificationType::is_null方法代码示例

本文整理汇总了C++中VerificationType::is_null方法的典型用法代码示例。如果您正苦于以下问题:C++ VerificationType::is_null方法的具体用法?C++ VerificationType::is_null怎么用?C++ VerificationType::is_null使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VerificationType的用法示例。


在下文中一共展示了VerificationType::is_null方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: is_reference_assignable_from

bool VerificationType::is_reference_assignable_from(
    const VerificationType& from, ClassVerifier* context,
    bool from_field_is_protected, TRAPS) const {
  instanceKlassHandle klass = context->current_class();
  if (from.is_null()) {
    // null is assignable to any reference
    return true;
  } else if (is_null()) {
    return false;
  } else if (name() == from.name()) {
    return true;
  } else if (is_object()) {
    // We need check the class hierarchy to check assignability
    if (name() == vmSymbols::java_lang_Object()) {
      // any object or array is assignable to java.lang.Object
      return true;
    }
    Klass* obj = SystemDictionary::resolve_or_fail(
        name(), Handle(THREAD, klass->class_loader()),
        Handle(THREAD, klass->protection_domain()), true, CHECK_false);
    if (TraceClassResolution) {
      Verifier::trace_class_resolution(obj, klass());
    }

    KlassHandle this_class(THREAD, obj);

    if (this_class->is_interface() && (!from_field_is_protected ||
        from.name() != vmSymbols::java_lang_Object())) {
      // If we are not trying to access a protected field or method in
      // java.lang.Object then we treat interfaces as java.lang.Object,
      // including java.lang.Cloneable and java.io.Serializable.
      return true;
    } else if (from.is_object()) {
      Klass* from_class = SystemDictionary::resolve_or_fail(
          from.name(), Handle(THREAD, klass->class_loader()),
          Handle(THREAD, klass->protection_domain()), true, CHECK_false);
      if (TraceClassResolution) {
        Verifier::trace_class_resolution(from_class, klass());
      }
      return InstanceKlass::cast(from_class)->is_subclass_of(this_class());
    }
  } else if (is_array() && from.is_array()) {
    VerificationType comp_this = get_component(context, CHECK_false);
    VerificationType comp_from = from.get_component(context, CHECK_false);
    if (!comp_this.is_bogus() && !comp_from.is_bogus()) {
      return comp_this.is_component_assignable_from(comp_from, context,
                                          from_field_is_protected, CHECK_false);
    }
  }
  return false;
}
开发者ID:benbenolson,项目名称:hotspot_9_mc,代码行数:51,代码来源:verificationType.cpp

示例2: is_reference_assignable_from

bool VerificationType::is_reference_assignable_from(
    const VerificationType& from, ClassVerifier* context,
    bool from_field_is_protected, TRAPS) const {
  instanceKlassHandle klass = context->current_class();
  if (from.is_null()) {
    // null is assignable to any reference
    return true;
  } else if (is_null()) {
    return false;
  } else if (name() == from.name()) {
    return true;
  } else if (is_object()) {
    // We need check the class hierarchy to check assignability
    if (name() == vmSymbols::java_lang_Object()) {
      // any object or array is assignable to java.lang.Object
      return true;
    }

    if (DumpSharedSpaces && SystemDictionaryShared::add_verification_constraint(klass(),
              name(), from.name(), from_field_is_protected, from.is_array(),
              from.is_object())) {
      // If add_verification_constraint() returns true, the resolution/check should be
      // delayed until runtime.
      return true;
    }

    return resolve_and_check_assignability(klass(), name(), from.name(),
          from_field_is_protected, from.is_array(), from.is_object(), THREAD);
  } else if (is_array() && from.is_array()) {
    VerificationType comp_this = get_component(context, CHECK_false);
    VerificationType comp_from = from.get_component(context, CHECK_false);
    if (!comp_this.is_bogus() && !comp_from.is_bogus()) {
      return comp_this.is_component_assignable_from(comp_from, context,
                                          from_field_is_protected, CHECK_false);
    }
  }
  return false;
}
开发者ID:lmsf,项目名称:jdk9-dev,代码行数:38,代码来源:verificationType.cpp


注:本文中的VerificationType::is_null方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。