8227046: compiler implementation for sealed classes

8225056: VM support for sealed classes
8227044: javax.lang.model for sealed classes
8227045: Preview APIs support for sealed classes
8227047: Javadoc for sealed types
8245854: JVM TI Specification for sealed classes

Co-authored-by: Harold Seigel <harold.seigel@oracle.com>
Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com>
Reviewed-by: mcimadamore, forax, darcy, dholmes, jlahoda, lfoltan, mchung, sspitsyn, vromero
This commit is contained in:
Vicente Romero 2020-06-01 17:00:40 -04:00
parent 567692e4ae
commit d42bfef8a4
139 changed files with 6877 additions and 192 deletions

View file

@ -198,6 +198,10 @@ class InstanceKlass: public Klass {
// By always being set it makes nest-member access checks simpler.
InstanceKlass* _nest_host;
// The PermittedSubclasses attribute. An array of shorts, where each is a
// class info index for the class that is a permitted subclass.
Array<jushort>* _permitted_subclasses;
// The contents of the Record attribute.
Array<RecordComponent*>* _record_components;
@ -469,6 +473,10 @@ class InstanceKlass: public Klass {
}
bool is_record() const { return _record_components != NULL; }
// permitted subclasses
Array<u2>* permitted_subclasses() const { return _permitted_subclasses; }
void set_permitted_subclasses(Array<u2>* s) { _permitted_subclasses = s; }
private:
// 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;
@ -484,6 +492,9 @@ public:
// Check if this klass is a nestmate of k - resolves this nest-host and k's
bool has_nestmate_access_to(InstanceKlass* k, TRAPS);
// Called to verify that k is a permitted subclass of this class
bool has_as_permitted_subclass(const InstanceKlass* k) const;
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,
@ -541,6 +552,9 @@ public:
ClassState init_state() { return (ClassState)_init_state; }
bool is_rewritten() const { return (_misc_flags & _misc_rewritten) != 0; }
// is this a sealed class
bool is_sealed() const;
// defineClass specified verification
bool should_verify_class() const {
return (_misc_flags & _misc_should_verify_class) != 0;