--- old/src/hotspot/share/oops/instanceKlass.hpp 2018-05-18 03:21:43.215141087 -0400 +++ new/src/hotspot/share/oops/instanceKlass.hpp 2018-05-18 03:21:41.647050010 -0400 @@ -162,6 +162,19 @@ // number_of_inner_classes * 4 + enclosing_method_attribute_size. Array* _inner_classes; + // The NestMembers attribute. An array of shorts, where each is a + // class info index for the class that is a nest member. This data + // has not been validated. + Array* _nest_members; + + // The NestHost attribute. The class info index for the class + // that is the nest-host of this class. This data has not been validated. + jushort _nest_host_index; + + // Resolved nest-host klass: either true nest-host or self if we are not nested. + // By always being set it makes nest-member access checks simpler. + InstanceKlass* _nest_host; + // the source debug extension for this klass, NULL if not specified. // Specified as UTF-8 string without terminating zero byte in the classfile, // it is stored in the instanceklass as a NULL-terminated UTF-8 string @@ -428,6 +441,24 @@ Array* inner_classes() const { return _inner_classes; } void set_inner_classes(Array* f) { _inner_classes = f; } + // nest members + Array* nest_members() const { return _nest_members; } + void set_nest_members(Array* m) { _nest_members = m; } + + // nest-host index + jushort nest_host_index() const { return _nest_host_index; } + void set_nest_host_index(u2 i) { _nest_host_index = i; } + + // Returns nest-host class, resolving and validating it if needed + // Returns NULL if an exception occurs during loading, or validation fails + InstanceKlass* nest_host(Symbol* validationException, TRAPS); + InstanceKlass* raw_nest_host() { return _nest_host; } // debugging + + // Called to verify that k is a member of this nest - does not look at k's nest-host + bool has_nest_member(InstanceKlass* k, TRAPS) const; + // Check if this klass is a nestmate of k - resolves this nest-host and k's + bool has_nestmate_access_to(InstanceKlass* k, TRAPS); + enum InnerClassAttributeOffset { // From http://mirror.eng/products/jdk/1.1/docs/guide/innerclasses/spec/innerclasses.doc10.html#18814 inner_class_inner_class_info_offset = 0, @@ -547,10 +578,12 @@ const Symbol* signature); // find a local method, but skip static methods - Method* find_instance_method(const Symbol* name, const Symbol* signature) const; + Method* find_instance_method(const Symbol* name, const Symbol* signature, + PrivateLookupMode private_mode = find_private) const; static Method* find_instance_method(const Array* methods, const Symbol* name, - const Symbol* signature); + const Symbol* signature, + PrivateLookupMode private_mode = find_private); // find a local method (returns NULL if not found) Method* find_local_method(const Symbol* name, @@ -578,7 +611,8 @@ // lookup operation (returns NULL if not found) Method* uncached_lookup_method(const Symbol* name, const Symbol* signature, - OverpassLookupMode overpass_mode) const; + OverpassLookupMode overpass_mode, + PrivateLookupMode private_mode = find_private) const; // lookup a method in all the interfaces that this class implements // (returns NULL if not found)