hotspot/src/share/vm/classfile/classFileParser.cpp
changeset 1550 be2fc37a817f
parent 670 ddf3e9583f2f
child 1661 7cb0f0d385f3
equal deleted inserted replaced
1549:710f8deef989 1550:be2fc37a817f
   166           u1* utf8_buffer = cfs->get_u1_buffer();
   166           u1* utf8_buffer = cfs->get_u1_buffer();
   167           assert(utf8_buffer != NULL, "null utf8 buffer");
   167           assert(utf8_buffer != NULL, "null utf8 buffer");
   168           // Got utf8 string, guarantee utf8_length+1 bytes, set stream position forward.
   168           // Got utf8 string, guarantee utf8_length+1 bytes, set stream position forward.
   169           cfs->guarantee_more(utf8_length+1, CHECK);  // utf8 string, tag/access_flags
   169           cfs->guarantee_more(utf8_length+1, CHECK);  // utf8 string, tag/access_flags
   170           cfs->skip_u1_fast(utf8_length);
   170           cfs->skip_u1_fast(utf8_length);
       
   171 
   171           // Before storing the symbol, make sure it's legal
   172           // Before storing the symbol, make sure it's legal
   172           if (_need_verify) {
   173           if (_need_verify) {
   173             verify_legal_utf8((unsigned char*)utf8_buffer, utf8_length, CHECK);
   174             verify_legal_utf8((unsigned char*)utf8_buffer, utf8_length, CHECK);
       
   175           }
       
   176 
       
   177           if (AnonymousClasses && has_cp_patch_at(index)) {
       
   178             Handle patch = clear_cp_patch_at(index);
       
   179             guarantee_property(java_lang_String::is_instance(patch()),
       
   180                                "Illegal utf8 patch at %d in class file %s",
       
   181                                index, CHECK);
       
   182             char* str = java_lang_String::as_utf8_string(patch());
       
   183             // (could use java_lang_String::as_symbol instead, but might as well batch them)
       
   184             utf8_buffer = (u1*) str;
       
   185             utf8_length = (int) strlen(str);
   174           }
   186           }
   175 
   187 
   176           unsigned int hash;
   188           unsigned int hash;
   177           symbolOop result = SymbolTable::lookup_only((char*)utf8_buffer, utf8_length, hash);
   189           symbolOop result = SymbolTable::lookup_only((char*)utf8_buffer, utf8_length, hash);
   178           if (result == NULL) {
   190           if (result == NULL) {
   243       case JVM_CONSTANT_InterfaceMethodref : {
   255       case JVM_CONSTANT_InterfaceMethodref : {
   244         if (!_need_verify) break;
   256         if (!_need_verify) break;
   245         int klass_ref_index = cp->klass_ref_index_at(index);
   257         int klass_ref_index = cp->klass_ref_index_at(index);
   246         int name_and_type_ref_index = cp->name_and_type_ref_index_at(index);
   258         int name_and_type_ref_index = cp->name_and_type_ref_index_at(index);
   247         check_property(valid_cp_range(klass_ref_index, length) &&
   259         check_property(valid_cp_range(klass_ref_index, length) &&
   248                        cp->tag_at(klass_ref_index).is_klass_reference(),
   260                        is_klass_reference(cp, klass_ref_index),
   249                        "Invalid constant pool index %u in class file %s",
   261                        "Invalid constant pool index %u in class file %s",
   250                        klass_ref_index,
   262                        klass_ref_index,
   251                        CHECK_(nullHandle));
   263                        CHECK_(nullHandle));
   252         check_property(valid_cp_range(name_and_type_ref_index, length) &&
   264         check_property(valid_cp_range(name_and_type_ref_index, length) &&
   253                        cp->tag_at(name_and_type_ref_index).is_name_and_type(),
   265                        cp->tag_at(name_and_type_ref_index).is_name_and_type(),
   324         ShouldNotReachHere();
   336         ShouldNotReachHere();
   325         break;
   337         break;
   326     } // end of switch
   338     } // end of switch
   327   } // end of for
   339   } // end of for
   328 
   340 
       
   341   if (_cp_patches != NULL) {
       
   342     // need to treat this_class specially...
       
   343     assert(AnonymousClasses, "");
       
   344     int this_class_index;
       
   345     {
       
   346       cfs->guarantee_more(8, CHECK_(nullHandle));  // flags, this_class, super_class, infs_len
       
   347       u1* mark = cfs->current();
       
   348       u2 flags         = cfs->get_u2_fast();
       
   349       this_class_index = cfs->get_u2_fast();
       
   350       cfs->set_current(mark);  // revert to mark
       
   351     }
       
   352 
       
   353     for (index = 1; index < length; index++) {          // Index 0 is unused
       
   354       if (has_cp_patch_at(index)) {
       
   355         guarantee_property(index != this_class_index,
       
   356                            "Illegal constant pool patch to self at %d in class file %s",
       
   357                            index, CHECK_(nullHandle));
       
   358         patch_constant_pool(cp, index, cp_patch_at(index), CHECK_(nullHandle));
       
   359       }
       
   360     }
       
   361     // Ensure that all the patches have been used.
       
   362     for (index = 0; index < _cp_patches->length(); index++) {
       
   363       guarantee_property(!has_cp_patch_at(index),
       
   364                          "Unused constant pool patch at %d in class file %s",
       
   365                          index, CHECK_(nullHandle));
       
   366     }
       
   367   }
       
   368 
   329   if (!_need_verify) {
   369   if (!_need_verify) {
   330     return cp;
   370     return cp;
   331   }
   371   }
   332 
   372 
   333   // second verification pass - checks the strings are of the right format.
   373   // second verification pass - checks the strings are of the right format.
       
   374   // but not yet to the other entries
   334   for (index = 1; index < length; index++) {
   375   for (index = 1; index < length; index++) {
   335     jbyte tag = cp->tag_at(index).value();
   376     jbyte tag = cp->tag_at(index).value();
   336     switch (tag) {
   377     switch (tag) {
   337       case JVM_CONSTANT_UnresolvedClass: {
   378       case JVM_CONSTANT_UnresolvedClass: {
   338         symbolHandle class_name(THREAD, cp->unresolved_klass_at(index));
   379         symbolHandle class_name(THREAD, cp->unresolved_klass_at(index));
       
   380         // check the name, even if _cp_patches will overwrite it
   339         verify_legal_class_name(class_name, CHECK_(nullHandle));
   381         verify_legal_class_name(class_name, CHECK_(nullHandle));
   340         break;
   382         break;
   341       }
   383       }
   342       case JVM_CONSTANT_Fieldref:
   384       case JVM_CONSTANT_Fieldref:
   343       case JVM_CONSTANT_Methodref:
   385       case JVM_CONSTANT_Methodref:
   376 
   418 
   377   return cp;
   419   return cp;
   378 }
   420 }
   379 
   421 
   380 
   422 
       
   423 void ClassFileParser::patch_constant_pool(constantPoolHandle cp, int index, Handle patch, TRAPS) {
       
   424   assert(AnonymousClasses, "");
       
   425   BasicType patch_type = T_VOID;
       
   426   switch (cp->tag_at(index).value()) {
       
   427 
       
   428   case JVM_CONSTANT_UnresolvedClass :
       
   429     // Patching a class means pre-resolving it.
       
   430     // The name in the constant pool is ignored.
       
   431     if (patch->klass() == SystemDictionary::class_klass()) { // %%% java_lang_Class::is_instance
       
   432       guarantee_property(!java_lang_Class::is_primitive(patch()),
       
   433                          "Illegal class patch at %d in class file %s",
       
   434                          index, CHECK);
       
   435       cp->klass_at_put(index, java_lang_Class::as_klassOop(patch()));
       
   436     } else {
       
   437       guarantee_property(java_lang_String::is_instance(patch()),
       
   438                          "Illegal class patch at %d in class file %s",
       
   439                          index, CHECK);
       
   440       symbolHandle name = java_lang_String::as_symbol(patch(), CHECK);
       
   441       cp->unresolved_klass_at_put(index, name());
       
   442     }
       
   443     break;
       
   444 
       
   445   case JVM_CONSTANT_UnresolvedString :
       
   446     // Patching a string means pre-resolving it.
       
   447     // The spelling in the constant pool is ignored.
       
   448     // The constant reference may be any object whatever.
       
   449     // If it is not a real interned string, the constant is referred
       
   450     // to as a "pseudo-string", and must be presented to the CP
       
   451     // explicitly, because it may require scavenging.
       
   452     cp->pseudo_string_at_put(index, patch());
       
   453     break;
       
   454 
       
   455   case JVM_CONSTANT_Integer : patch_type = T_INT;    goto patch_prim;
       
   456   case JVM_CONSTANT_Float :   patch_type = T_FLOAT;  goto patch_prim;
       
   457   case JVM_CONSTANT_Long :    patch_type = T_LONG;   goto patch_prim;
       
   458   case JVM_CONSTANT_Double :  patch_type = T_DOUBLE; goto patch_prim;
       
   459   patch_prim:
       
   460     {
       
   461       jvalue value;
       
   462       BasicType value_type = java_lang_boxing_object::get_value(patch(), &value);
       
   463       guarantee_property(value_type == patch_type,
       
   464                          "Illegal primitive patch at %d in class file %s",
       
   465                          index, CHECK);
       
   466       switch (value_type) {
       
   467       case T_INT:    cp->int_at_put(index,   value.i); break;
       
   468       case T_FLOAT:  cp->float_at_put(index, value.f); break;
       
   469       case T_LONG:   cp->long_at_put(index,  value.j); break;
       
   470       case T_DOUBLE: cp->double_at_put(index, value.d); break;
       
   471       default:       assert(false, "");
       
   472       }
       
   473     }
       
   474     break;
       
   475 
       
   476   default:
       
   477     // %%% TODO: put method handles into CONSTANT_InterfaceMethodref, etc.
       
   478     guarantee_property(!has_cp_patch_at(index),
       
   479                        "Illegal unexpected patch at %d in class file %s",
       
   480                        index, CHECK);
       
   481     return;
       
   482   }
       
   483 
       
   484   // On fall-through, mark the patch as used.
       
   485   clear_cp_patch_at(index);
       
   486 }
       
   487 
       
   488 
       
   489 
   381 class NameSigHash: public ResourceObj {
   490 class NameSigHash: public ResourceObj {
   382  public:
   491  public:
   383   symbolOop     _name;       // name
   492   symbolOop     _name;       // name
   384   symbolOop     _sig;        // signature
   493   symbolOop     _sig;        // signature
   385   NameSigHash*  _next;       // Next entry in hash table
   494   NameSigHash*  _next;       // Next entry in hash table
   446   objArrayHandle interfaces (THREAD, interface_oop);
   555   objArrayHandle interfaces (THREAD, interface_oop);
   447 
   556 
   448   int index;
   557   int index;
   449   for (index = 0; index < length; index++) {
   558   for (index = 0; index < length; index++) {
   450     u2 interface_index = cfs->get_u2(CHECK_(nullHandle));
   559     u2 interface_index = cfs->get_u2(CHECK_(nullHandle));
       
   560     KlassHandle interf;
   451     check_property(
   561     check_property(
   452       valid_cp_range(interface_index, cp->length()) &&
   562       valid_cp_range(interface_index, cp->length()) &&
   453         cp->tag_at(interface_index).is_unresolved_klass(),
   563       is_klass_reference(cp, interface_index),
   454       "Interface name has bad constant pool index %u in class file %s",
   564       "Interface name has bad constant pool index %u in class file %s",
   455       interface_index, CHECK_(nullHandle));
   565       interface_index, CHECK_(nullHandle));
   456     symbolHandle unresolved_klass (THREAD, cp->klass_name_at(interface_index));
   566     if (cp->tag_at(interface_index).is_klass()) {
   457 
   567       interf = KlassHandle(THREAD, cp->resolved_klass_at(interface_index));
   458     // Don't need to check legal name because it's checked when parsing constant pool.
   568     } else {
   459     // But need to make sure it's not an array type.
   569       symbolHandle unresolved_klass (THREAD, cp->klass_name_at(interface_index));
   460     guarantee_property(unresolved_klass->byte_at(0) != JVM_SIGNATURE_ARRAY,
   570 
   461                        "Bad interface name in class file %s", CHECK_(nullHandle));
   571       // Don't need to check legal name because it's checked when parsing constant pool.
   462 
   572       // But need to make sure it's not an array type.
   463     vmtimer->suspend();  // do not count recursive loading twice
   573       guarantee_property(unresolved_klass->byte_at(0) != JVM_SIGNATURE_ARRAY,
   464     // Call resolve_super so classcircularity is checked
   574                          "Bad interface name in class file %s", CHECK_(nullHandle));
   465     klassOop k = SystemDictionary::resolve_super_or_fail(class_name,
   575 
   466                   unresolved_klass, class_loader, protection_domain,
   576       vmtimer->suspend();  // do not count recursive loading twice
   467                   false, CHECK_(nullHandle));
   577       // Call resolve_super so classcircularity is checked
   468     KlassHandle interf (THREAD, k);
   578       klassOop k = SystemDictionary::resolve_super_or_fail(class_name,
   469     vmtimer->resume();
   579                     unresolved_klass, class_loader, protection_domain,
       
   580                     false, CHECK_(nullHandle));
       
   581       interf = KlassHandle(THREAD, k);
       
   582       vmtimer->resume();
       
   583 
       
   584       cp->klass_at_put(interface_index, interf()); // eagerly resolve
       
   585     }
   470 
   586 
   471     if (!Klass::cast(interf())->is_interface()) {
   587     if (!Klass::cast(interf())->is_interface()) {
   472       THROW_MSG_(vmSymbols::java_lang_IncompatibleClassChangeError(), "Implementing class", nullHandle);
   588       THROW_MSG_(vmSymbols::java_lang_IncompatibleClassChangeError(), "Implementing class", nullHandle);
   473     }
   589     }
   474     interfaces->obj_at_put(index, interf());
   590     interfaces->obj_at_put(index, interf());
   875                          "Illegal exception table range in class file %s", CHECK_(nullHandle));
   991                          "Illegal exception table range in class file %s", CHECK_(nullHandle));
   876       guarantee_property(handler_pc < code_length,
   992       guarantee_property(handler_pc < code_length,
   877                          "Illegal exception table handler in class file %s", CHECK_(nullHandle));
   993                          "Illegal exception table handler in class file %s", CHECK_(nullHandle));
   878       if (catch_type_index != 0) {
   994       if (catch_type_index != 0) {
   879         guarantee_property(valid_cp_range(catch_type_index, cp->length()) &&
   995         guarantee_property(valid_cp_range(catch_type_index, cp->length()) &&
   880                           (cp->tag_at(catch_type_index).is_klass() ||
   996                            is_klass_reference(cp, catch_type_index),
   881                            cp->tag_at(catch_type_index).is_unresolved_klass()),
       
   882                            "Catch type in exception table has bad constant type in class file %s", CHECK_(nullHandle));
   997                            "Catch type in exception table has bad constant type in class file %s", CHECK_(nullHandle));
   883       }
   998       }
   884     }
   999     }
   885     exception_handlers->int_at_put(index++, start_pc);
  1000     exception_handlers->int_at_put(index++, start_pc);
   886     exception_handlers->int_at_put(index++, end_pc);
  1001     exception_handlers->int_at_put(index++, end_pc);
  1115     if (tag == ITEM_Long || tag == ITEM_Double) {
  1230     if (tag == ITEM_Long || tag == ITEM_Double) {
  1116       index++;
  1231       index++;
  1117     } else if (tag == ITEM_Object) {
  1232     } else if (tag == ITEM_Object) {
  1118       u2 class_index = u2_array[i2++] = cfs->get_u2(CHECK);
  1233       u2 class_index = u2_array[i2++] = cfs->get_u2(CHECK);
  1119       guarantee_property(valid_cp_range(class_index, cp->length()) &&
  1234       guarantee_property(valid_cp_range(class_index, cp->length()) &&
  1120                          cp->tag_at(class_index).is_unresolved_klass(),
  1235                          is_klass_reference(cp, class_index),
  1121                          "Bad class index %u in StackMap in class file %s",
  1236                          "Bad class index %u in StackMap in class file %s",
  1122                          class_index, CHECK);
  1237                          class_index, CHECK);
  1123     } else if (tag == ITEM_Uninitialized) {
  1238     } else if (tag == ITEM_Uninitialized) {
  1124       u2 offset = u2_array[i2++] = cfs->get_u2(CHECK);
  1239       u2 offset = u2_array[i2++] = cfs->get_u2(CHECK);
  1125       guarantee_property(
  1240       guarantee_property(
  1181     cfs->guarantee_more(2 * len, CHECK_NULL);
  1296     cfs->guarantee_more(2 * len, CHECK_NULL);
  1182     for (int i = 0; i < len; i++) {
  1297     for (int i = 0; i < len; i++) {
  1183       checked_exception = cfs->get_u2_fast();
  1298       checked_exception = cfs->get_u2_fast();
  1184       check_property(
  1299       check_property(
  1185         valid_cp_range(checked_exception, cp->length()) &&
  1300         valid_cp_range(checked_exception, cp->length()) &&
  1186         cp->tag_at(checked_exception).is_klass_reference(),
  1301         is_klass_reference(cp, checked_exception),
  1187         "Exception name has bad type at constant pool %u in class file %s",
  1302         "Exception name has bad type at constant pool %u in class file %s",
  1188         checked_exception, CHECK_NULL);
  1303         checked_exception, CHECK_NULL);
  1189     }
  1304     }
  1190   }
  1305   }
  1191   // check exceptions attribute length
  1306   // check exceptions attribute length
  1916     // Inner class index
  2031     // Inner class index
  1917     u2 inner_class_info_index = cfs->get_u2_fast();
  2032     u2 inner_class_info_index = cfs->get_u2_fast();
  1918     check_property(
  2033     check_property(
  1919       inner_class_info_index == 0 ||
  2034       inner_class_info_index == 0 ||
  1920         (valid_cp_range(inner_class_info_index, cp_size) &&
  2035         (valid_cp_range(inner_class_info_index, cp_size) &&
  1921         cp->tag_at(inner_class_info_index).is_klass_reference()),
  2036         is_klass_reference(cp, inner_class_info_index)),
  1922       "inner_class_info_index %u has bad constant type in class file %s",
  2037       "inner_class_info_index %u has bad constant type in class file %s",
  1923       inner_class_info_index, CHECK_0);
  2038       inner_class_info_index, CHECK_0);
  1924     // Outer class index
  2039     // Outer class index
  1925     u2 outer_class_info_index = cfs->get_u2_fast();
  2040     u2 outer_class_info_index = cfs->get_u2_fast();
  1926     check_property(
  2041     check_property(
  1927       outer_class_info_index == 0 ||
  2042       outer_class_info_index == 0 ||
  1928         (valid_cp_range(outer_class_info_index, cp_size) &&
  2043         (valid_cp_range(outer_class_info_index, cp_size) &&
  1929         cp->tag_at(outer_class_info_index).is_klass_reference()),
  2044         is_klass_reference(cp, outer_class_info_index)),
  1930       "outer_class_info_index %u has bad constant type in class file %s",
  2045       "outer_class_info_index %u has bad constant type in class file %s",
  1931       outer_class_info_index, CHECK_0);
  2046       outer_class_info_index, CHECK_0);
  1932     // Inner class name
  2047     // Inner class name
  1933     u2 inner_name_index = cfs->get_u2_fast();
  2048     u2 inner_name_index = cfs->get_u2_fast();
  1934     check_property(
  2049     check_property(
  2086         if (class_index == 0) {
  2201         if (class_index == 0) {
  2087           classfile_parse_error("Invalid class index in EnclosingMethod attribute in class file %s", CHECK);
  2202           classfile_parse_error("Invalid class index in EnclosingMethod attribute in class file %s", CHECK);
  2088         }
  2203         }
  2089         // Validate the constant pool indices and types
  2204         // Validate the constant pool indices and types
  2090         if (!cp->is_within_bounds(class_index) ||
  2205         if (!cp->is_within_bounds(class_index) ||
  2091             !cp->tag_at(class_index).is_klass_reference()) {
  2206             !is_klass_reference(cp, class_index)) {
  2092           classfile_parse_error("Invalid or out-of-bounds class index in EnclosingMethod attribute in class file %s", CHECK);
  2207           classfile_parse_error("Invalid or out-of-bounds class index in EnclosingMethod attribute in class file %s", CHECK);
  2093         }
  2208         }
  2094         if (method_index != 0 &&
  2209         if (method_index != 0 &&
  2095             (!cp->is_within_bounds(method_index) ||
  2210             (!cp->is_within_bounds(method_index) ||
  2096              !cp->tag_at(method_index).is_name_and_type())) {
  2211              !cp->tag_at(method_index).is_name_and_type())) {
  2347 
  2462 
  2348 
  2463 
  2349 instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name,
  2464 instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name,
  2350                                                     Handle class_loader,
  2465                                                     Handle class_loader,
  2351                                                     Handle protection_domain,
  2466                                                     Handle protection_domain,
       
  2467                                                     GrowableArray<Handle>* cp_patches,
  2352                                                     symbolHandle& parsed_name,
  2468                                                     symbolHandle& parsed_name,
  2353                                                     TRAPS) {
  2469                                                     TRAPS) {
  2354   // So that JVMTI can cache class file in the state before retransformable agents
  2470   // So that JVMTI can cache class file in the state before retransformable agents
  2355   // have modified it
  2471   // have modified it
  2356   unsigned char *cached_class_file_bytes = NULL;
  2472   unsigned char *cached_class_file_bytes = NULL;
  2378       cfs = new ClassFileStream(ptr, end_ptr - ptr, cfs->source());
  2494       cfs = new ClassFileStream(ptr, end_ptr - ptr, cfs->source());
  2379       set_stream(cfs);
  2495       set_stream(cfs);
  2380     }
  2496     }
  2381   }
  2497   }
  2382 
  2498 
       
  2499   _cp_patches = cp_patches;
  2383 
  2500 
  2384   instanceKlassHandle nullHandle;
  2501   instanceKlassHandle nullHandle;
  2385 
  2502 
  2386   // Figure out whether we can skip format checking (matching classic VM behavior)
  2503   // Figure out whether we can skip format checking (matching classic VM behavior)
  2387   _need_verify = Verifier::should_verify_for(class_loader());
  2504   _need_verify = Verifier::should_verify_for(class_loader());
  2508                      "Invalid superclass index %u in class file %s",
  2625                      "Invalid superclass index %u in class file %s",
  2509                      super_class_index,
  2626                      super_class_index,
  2510                      CHECK_(nullHandle));
  2627                      CHECK_(nullHandle));
  2511     } else {
  2628     } else {
  2512       check_property(valid_cp_range(super_class_index, cp_size) &&
  2629       check_property(valid_cp_range(super_class_index, cp_size) &&
  2513                      cp->tag_at(super_class_index).is_unresolved_klass(),
  2630                      is_klass_reference(cp, super_class_index),
  2514                      "Invalid superclass index %u in class file %s",
  2631                      "Invalid superclass index %u in class file %s",
  2515                      super_class_index,
  2632                      super_class_index,
  2516                      CHECK_(nullHandle));
  2633                      CHECK_(nullHandle));
  2517       // The class name should be legal because it is checked when parsing constant pool.
  2634       // The class name should be legal because it is checked when parsing constant pool.
  2518       // However, make sure it is not an array type.
  2635       // However, make sure it is not an array type.
       
  2636       bool is_array = false;
       
  2637       if (cp->tag_at(super_class_index).is_klass()) {
       
  2638         super_klass = instanceKlassHandle(THREAD, cp->resolved_klass_at(super_class_index));
       
  2639         if (_need_verify)
       
  2640           is_array = super_klass->oop_is_array();
       
  2641       } else if (_need_verify) {
       
  2642         is_array = (cp->unresolved_klass_at(super_class_index)->byte_at(0) == JVM_SIGNATURE_ARRAY);
       
  2643       }
  2519       if (_need_verify) {
  2644       if (_need_verify) {
  2520         guarantee_property(cp->unresolved_klass_at(super_class_index)->byte_at(0) != JVM_SIGNATURE_ARRAY,
  2645         guarantee_property(!is_array,
  2521                           "Bad superclass name in class file %s", CHECK_(nullHandle));
  2646                           "Bad superclass name in class file %s", CHECK_(nullHandle));
  2522       }
  2647       }
  2523     }
  2648     }
  2524 
  2649 
  2525     // Interfaces
  2650     // Interfaces
  2555     objArrayHandle methods_annotations(THREAD, methods_annotations_oop);
  2680     objArrayHandle methods_annotations(THREAD, methods_annotations_oop);
  2556     objArrayHandle methods_parameter_annotations(THREAD, methods_parameter_annotations_oop);
  2681     objArrayHandle methods_parameter_annotations(THREAD, methods_parameter_annotations_oop);
  2557     objArrayHandle methods_default_annotations(THREAD, methods_default_annotations_oop);
  2682     objArrayHandle methods_default_annotations(THREAD, methods_default_annotations_oop);
  2558 
  2683 
  2559     // We check super class after class file is parsed and format is checked
  2684     // We check super class after class file is parsed and format is checked
  2560     if (super_class_index > 0) {
  2685     if (super_class_index > 0 && super_klass.is_null()) {
  2561       symbolHandle sk (THREAD, cp->klass_name_at(super_class_index));
  2686       symbolHandle sk (THREAD, cp->klass_name_at(super_class_index));
  2562       if (access_flags.is_interface()) {
  2687       if (access_flags.is_interface()) {
  2563         // Before attempting to resolve the superclass, check for class format
  2688         // Before attempting to resolve the superclass, check for class format
  2564         // errors not checked yet.
  2689         // errors not checked yet.
  2565         guarantee_property(sk() == vmSymbols::java_lang_Object(),
  2690         guarantee_property(sk() == vmSymbols::java_lang_Object(),
  2572                                                            protection_domain,
  2697                                                            protection_domain,
  2573                                                            true,
  2698                                                            true,
  2574                                                            CHECK_(nullHandle));
  2699                                                            CHECK_(nullHandle));
  2575       KlassHandle kh (THREAD, k);
  2700       KlassHandle kh (THREAD, k);
  2576       super_klass = instanceKlassHandle(THREAD, kh());
  2701       super_klass = instanceKlassHandle(THREAD, kh());
       
  2702       cp->klass_at_put(super_class_index, super_klass()); // eagerly resolve
       
  2703     }
       
  2704     if (super_klass.not_null()) {
  2577       if (super_klass->is_interface()) {
  2705       if (super_klass->is_interface()) {
  2578         ResourceMark rm(THREAD);
  2706         ResourceMark rm(THREAD);
  2579         Exceptions::fthrow(
  2707         Exceptions::fthrow(
  2580           THREAD_AND_LOCATION,
  2708           THREAD_AND_LOCATION,
  2581           vmSymbolHandles::java_lang_IncompatibleClassChangeError(),
  2709           vmSymbolHandles::java_lang_IncompatibleClassChangeError(),
  2998       this_klass->set_has_final_method();
  3126       this_klass->set_has_final_method();
  2999     }
  3127     }
  3000     this_klass->set_method_ordering(method_ordering());
  3128     this_klass->set_method_ordering(method_ordering());
  3001     this_klass->set_initial_method_idnum(methods->length());
  3129     this_klass->set_initial_method_idnum(methods->length());
  3002     this_klass->set_name(cp->klass_name_at(this_class_index));
  3130     this_klass->set_name(cp->klass_name_at(this_class_index));
       
  3131     cp->klass_at_put(this_class_index, this_klass()); // eagerly resolve
  3003     this_klass->set_protection_domain(protection_domain());
  3132     this_klass->set_protection_domain(protection_domain());
  3004     this_klass->set_fields_annotations(fields_annotations());
  3133     this_klass->set_fields_annotations(fields_annotations());
  3005     this_klass->set_methods_annotations(methods_annotations());
  3134     this_klass->set_methods_annotations(methods_annotations());
  3006     this_klass->set_methods_parameter_annotations(methods_parameter_annotations());
  3135     this_klass->set_methods_parameter_annotations(methods_parameter_annotations());
  3007     this_klass->set_methods_default_annotations(methods_default_annotations());
  3136     this_klass->set_methods_default_annotations(methods_default_annotations());