185 // and EnclosingMethod attributes the _inner_classes array length is 186 // number_of_inner_classes * 4 + enclosing_method_attribute_size. 187 Array<jushort>* _inner_classes; 188 189 // The NestMembers attribute. An array of shorts, where each is a 190 // class info index for the class that is a nest member. This data 191 // has not been validated. 192 Array<jushort>* _nest_members; 193 194 // The NestHost attribute. The class info index for the class 195 // that is the nest-host of this class. This data has not been validated. 196 jushort _nest_host_index; 197 198 // Resolved nest-host klass: either true nest-host or self if we are not 199 // nested, or an error occurred resolving or validating the nominated 200 // nest-host. Can also be set directly by JDK API's that establish nest 201 // relationships. 202 // By always being set it makes nest-member access checks simpler. 203 InstanceKlass* _nest_host; 204 205 // Used to record a reason for nest-host resolution/validation failures. 206 const char* _nest_host_res_error; 207 208 // The contents of the Record attribute. 209 Array<RecordComponent*>* _record_components; 210 211 // the source debug extension for this klass, NULL if not specified. 212 // Specified as UTF-8 string without terminating zero byte in the classfile, 213 // it is stored in the instanceklass as a NULL-terminated UTF-8 string 214 const char* _source_debug_extension; 215 // Array name derived from this class which needs unreferencing 216 // if this class is unloaded. 217 Symbol* _array_name; 218 219 // Number of heapOopSize words used by non-static fields in this klass 220 // (including inherited fields but after header_size()). 221 int _nonstatic_field_size; 222 int _static_field_size; // number words used by static fields (oop and non-oop) in this klass 223 // Constant pool index to the utf8 entry of the Generic signature, 224 // or 0 if none. 225 u2 _generic_signature_index; 226 // Constant pool index to the utf8 entry for the name of source file 227 // containing this klass, 0 if not specified. 473 void set_nest_members(Array<u2>* m) { _nest_members = m; } 474 475 // nest-host index 476 jushort nest_host_index() const { return _nest_host_index; } 477 void set_nest_host_index(u2 i) { _nest_host_index = i; } 478 // dynamic nest member support 479 void set_nest_host(InstanceKlass* host, TRAPS); 480 481 // record components 482 Array<RecordComponent*>* record_components() const { return _record_components; } 483 void set_record_components(Array<RecordComponent*>* record_components) { 484 _record_components = record_components; 485 } 486 bool is_record() const { return _record_components != NULL; } 487 488 private: 489 // Called to verify that k is a member of this nest - does not look at k's nest-host 490 bool has_nest_member(InstanceKlass* k, TRAPS) const; 491 492 public: 493 // Used to construct informative IllegalAccessError messages at a higher level. 494 // Returns NULL if there was no error. 495 const char* nest_host_resolution_error() { return _nest_host_res_error; } 496 // Returns nest-host class, resolving and validating it if needed. 497 // Returns NULL if resolution is not possible from the calling context. 498 InstanceKlass* nest_host(TRAPS); 499 // Check if this klass is a nestmate of k - resolves this nest-host and k's 500 bool has_nestmate_access_to(InstanceKlass* k, TRAPS); 501 502 enum InnerClassAttributeOffset { 503 // From http://mirror.eng/products/jdk/1.1/docs/guide/innerclasses/spec/innerclasses.doc10.html#18814 504 inner_class_inner_class_info_offset = 0, 505 inner_class_outer_class_info_offset = 1, 506 inner_class_inner_name_offset = 2, 507 inner_class_access_flags_offset = 3, 508 inner_class_next_offset = 4 509 }; 510 511 enum EnclosingMethodAttributeOffset { 512 enclosing_method_class_index_offset = 0, 513 enclosing_method_method_index_offset = 1, 514 enclosing_method_attribute_size = 2 515 }; | 185 // and EnclosingMethod attributes the _inner_classes array length is 186 // number_of_inner_classes * 4 + enclosing_method_attribute_size. 187 Array<jushort>* _inner_classes; 188 189 // The NestMembers attribute. An array of shorts, where each is a 190 // class info index for the class that is a nest member. This data 191 // has not been validated. 192 Array<jushort>* _nest_members; 193 194 // The NestHost attribute. The class info index for the class 195 // that is the nest-host of this class. This data has not been validated. 196 jushort _nest_host_index; 197 198 // Resolved nest-host klass: either true nest-host or self if we are not 199 // nested, or an error occurred resolving or validating the nominated 200 // nest-host. Can also be set directly by JDK API's that establish nest 201 // relationships. 202 // By always being set it makes nest-member access checks simpler. 203 InstanceKlass* _nest_host; 204 205 // The contents of the Record attribute. 206 Array<RecordComponent*>* _record_components; 207 208 // the source debug extension for this klass, NULL if not specified. 209 // Specified as UTF-8 string without terminating zero byte in the classfile, 210 // it is stored in the instanceklass as a NULL-terminated UTF-8 string 211 const char* _source_debug_extension; 212 // Array name derived from this class which needs unreferencing 213 // if this class is unloaded. 214 Symbol* _array_name; 215 216 // Number of heapOopSize words used by non-static fields in this klass 217 // (including inherited fields but after header_size()). 218 int _nonstatic_field_size; 219 int _static_field_size; // number words used by static fields (oop and non-oop) in this klass 220 // Constant pool index to the utf8 entry of the Generic signature, 221 // or 0 if none. 222 u2 _generic_signature_index; 223 // Constant pool index to the utf8 entry for the name of source file 224 // containing this klass, 0 if not specified. 470 void set_nest_members(Array<u2>* m) { _nest_members = m; } 471 472 // nest-host index 473 jushort nest_host_index() const { return _nest_host_index; } 474 void set_nest_host_index(u2 i) { _nest_host_index = i; } 475 // dynamic nest member support 476 void set_nest_host(InstanceKlass* host, TRAPS); 477 478 // record components 479 Array<RecordComponent*>* record_components() const { return _record_components; } 480 void set_record_components(Array<RecordComponent*>* record_components) { 481 _record_components = record_components; 482 } 483 bool is_record() const { return _record_components != NULL; } 484 485 private: 486 // Called to verify that k is a member of this nest - does not look at k's nest-host 487 bool has_nest_member(InstanceKlass* k, TRAPS) const; 488 489 public: 490 // Used to construct informative IllegalAccessError messages at a higher level, 491 // if there was an issue resolving or validating the nest host. 492 // Returns NULL if there was no error. 493 const char* nest_host_error(TRAPS); 494 // Returns nest-host class, resolving and validating it if needed. 495 // Returns NULL if resolution is not possible from the calling context. 496 InstanceKlass* nest_host(TRAPS); 497 // Check if this klass is a nestmate of k - resolves this nest-host and k's 498 bool has_nestmate_access_to(InstanceKlass* k, TRAPS); 499 500 enum InnerClassAttributeOffset { 501 // From http://mirror.eng/products/jdk/1.1/docs/guide/innerclasses/spec/innerclasses.doc10.html#18814 502 inner_class_inner_class_info_offset = 0, 503 inner_class_outer_class_info_offset = 1, 504 inner_class_inner_name_offset = 2, 505 inner_class_access_flags_offset = 3, 506 inner_class_next_offset = 4 507 }; 508 509 enum EnclosingMethodAttributeOffset { 510 enclosing_method_class_index_offset = 0, 511 enclosing_method_method_index_offset = 1, 512 enclosing_method_attribute_size = 2 513 }; |