Top


定義場所(file name)

hotspot/src/share/vm/classfile/classFileParser.cpp

名前(function name)

void ClassFileParser::verify_legal_class_modifiers(jint flags, TRAPS) {

本体部(body)

  {- -------------------------------------------
  (1) _need_verify が false なら何もしない.
      ---------------------------------------- -}

      if (!_need_verify) { return; }

  {- -------------------------------------------
  (1) (変数宣言など)
      ---------------------------------------- -}

      const bool is_interface  = (flags & JVM_ACC_INTERFACE)  != 0;
      const bool is_abstract   = (flags & JVM_ACC_ABSTRACT)   != 0;
      const bool is_final      = (flags & JVM_ACC_FINAL)      != 0;
      const bool is_super      = (flags & JVM_ACC_SUPER)      != 0;
      const bool is_enum       = (flags & JVM_ACC_ENUM)       != 0;
      const bool is_annotation = (flags & JVM_ACC_ANNOTATION) != 0;
      const bool major_gte_15  = _major_version >= JAVA_1_5_VERSION;

  {- -------------------------------------------
  (1) JVMS 4.1 節に載っているチェックを行う.
      仕様違反があれば ClassFormatError.
      ---------------------------------------- -}

      if ((is_abstract && is_final) ||
          (is_interface && !is_abstract) ||
          (is_interface && major_gte_15 && (is_super || is_enum)) ||
          (!is_interface && major_gte_15 && is_annotation)) {
        ResourceMark rm(THREAD);
        Exceptions::fthrow(
          THREAD_AND_LOCATION,
          vmSymbols::java_lang_ClassFormatError(),
          "Illegal class modifiers in class %s: 0x%X",
          _class_name->as_C_string(), flags
        );
        return;
      }
    }

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