3162 u2 length = 0; 3163 if (nest_members_attribute_start != NULL) { 3164 cfs->set_current(nest_members_attribute_start); 3165 cfs->guarantee_more(2, CHECK_0); // length 3166 length = cfs->get_u2_fast(); 3167 } 3168 const int size = length; 3169 Array<u2>* const nest_members = MetadataFactory::new_array<u2>(_loader_data, size, CHECK_0); 3170 _nest_members = nest_members; 3171 3172 int index = 0; 3173 cfs->guarantee_more(2 * length, CHECK_0); 3174 for (int n = 0; n < length; n++) { 3175 const u2 class_info_index = cfs->get_u2_fast(); 3176 check_property( 3177 valid_klass_reference_at(class_info_index), 3178 "Nest member class_info_index %u has bad constant type in class file %s", 3179 class_info_index, CHECK_0); 3180 nest_members->at_put(index++, class_info_index); 3181 } 3182 if (_need_verify) { 3183 for (int i = 0; i < length; i++) { 3184 for (int j = i + 1; j < length; j++) { 3185 guarantee_property((nest_members->at(i) != nest_members->at(j)), 3186 "Duplicate entry in NestMembers in class file %s", 3187 CHECK_0); 3188 } 3189 } 3190 } 3191 assert(index == size, "wrong size"); 3192 3193 // Restore buffer's current position. 3194 cfs->set_current(current_mark); 3195 3196 return length; 3197 } 3198 3199 void ClassFileParser::parse_classfile_synthetic_attribute(TRAPS) { 3200 set_class_synthetic_flag(true); 3201 } 3202 3203 void ClassFileParser::parse_classfile_signature_attribute(const ClassFileStream* const cfs, TRAPS) { 3204 assert(cfs != NULL, "invariant"); 3205 3206 const u2 signature_index = cfs->get_u2(CHECK); 3207 check_property( 3208 valid_symbol_at(signature_index), 3209 "Invalid constant pool index %u in Signature attribute in class file %s", 3210 signature_index, CHECK); | 3162 u2 length = 0; 3163 if (nest_members_attribute_start != NULL) { 3164 cfs->set_current(nest_members_attribute_start); 3165 cfs->guarantee_more(2, CHECK_0); // length 3166 length = cfs->get_u2_fast(); 3167 } 3168 const int size = length; 3169 Array<u2>* const nest_members = MetadataFactory::new_array<u2>(_loader_data, size, CHECK_0); 3170 _nest_members = nest_members; 3171 3172 int index = 0; 3173 cfs->guarantee_more(2 * length, CHECK_0); 3174 for (int n = 0; n < length; n++) { 3175 const u2 class_info_index = cfs->get_u2_fast(); 3176 check_property( 3177 valid_klass_reference_at(class_info_index), 3178 "Nest member class_info_index %u has bad constant type in class file %s", 3179 class_info_index, CHECK_0); 3180 nest_members->at_put(index++, class_info_index); 3181 } 3182 assert(index == size, "wrong size"); 3183 3184 // Restore buffer's current position. 3185 cfs->set_current(current_mark); 3186 3187 return length; 3188 } 3189 3190 void ClassFileParser::parse_classfile_synthetic_attribute(TRAPS) { 3191 set_class_synthetic_flag(true); 3192 } 3193 3194 void ClassFileParser::parse_classfile_signature_attribute(const ClassFileStream* const cfs, TRAPS) { 3195 assert(cfs != NULL, "invariant"); 3196 3197 const u2 signature_index = cfs->get_u2(CHECK); 3198 check_property( 3199 valid_symbol_at(signature_index), 3200 "Invalid constant pool index %u in Signature attribute in class file %s", 3201 signature_index, CHECK); |