OpenJDK / amber / amber
changeset 56486:6709b58dc97d amber-demo-II
Automatic merge with records-and-sealed
author | mcimadamore |
---|---|
date | Fri, 31 May 2019 20:07:03 +0200 |
parents | e28832629f65 6a1e527fd6f3 |
children | 8e67bc1e81c6 |
files | |
diffstat | 4 files changed, 8 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/hotspot/share/classfile/classFileParser.cpp Thu May 30 23:17:04 2019 +0200 +++ b/src/hotspot/share/classfile/classFileParser.cpp Fri May 31 20:07:03 2019 +0200 @@ -3666,9 +3666,6 @@ _nest_host = class_info_index; } else if (tag == vmSymbols::tag_permitted_subtypes()) { // Check for PermittedSubtypes tag - if (!_access_flags.is_final()) { - classfile_parse_error("PermittedSubtypes attribute in non-final class file %s", CHECK); - } if (parsed_permitted_subtypes_attribute) { classfile_parse_error("Multiple PermittedSubtypes attributes in class file %s", CHECK); } else { @@ -6459,8 +6456,7 @@ _all_mirandas = new GrowableArray<Method*>(20); Handle loader(THREAD, _loader_data->class_loader()); - bool is_sealed = _access_flags.is_final() && - _permitted_subtypes != NULL && + bool is_sealed = _permitted_subtypes != NULL && _permitted_subtypes != Universe::the_empty_short_array() && _permitted_subtypes->length() > 0; klassVtable::compute_vtable_size_and_num_mirandas(&_vtable_size, @@ -6495,9 +6491,11 @@ assert(NULL != _klass, "_klass should have been resolved before calling this method"); if (_super_klass != NULL) { if (_super_klass->is_final()) { + THROW_MSG(vmSymbols::java_lang_VerifyError(), "Cannot inherit from final class"); + } else if (_super_klass->is_sealed()) { bool isPermittedSubtype = _super_klass->has_as_permitted_subtype(_klass, CHECK); if (!isPermittedSubtype) { - THROW_MSG(vmSymbols::java_lang_VerifyError(), "Cannot inherit from final class"); + THROW_MSG(vmSymbols::java_lang_VerifyError(), "Cannot inherit from sealed class"); } } } @@ -6506,9 +6504,11 @@ for (int i = 0; i < local_interfaces->length(); i++) { InstanceKlass* intf = local_interfaces->at(i); if (intf->is_final()) { + THROW_MSG(vmSymbols::java_lang_VerifyError(), "Cannot inherit from final interface"); + } else if (intf->is_sealed()) { bool isPermittedSubtype = intf->has_as_permitted_subtype(_klass, CHECK); if (!isPermittedSubtype) { - THROW_MSG(vmSymbols::java_lang_VerifyError(), "Cannot inherit from final interface"); + THROW_MSG(vmSymbols::java_lang_VerifyError(), "Cannot inherit from sealed interface"); } } }
--- a/src/hotspot/share/oops/instanceKlass.cpp Thu May 30 23:17:04 2019 +0200 +++ b/src/hotspot/share/oops/instanceKlass.cpp Fri May 31 20:07:03 2019 +0200 @@ -675,8 +675,7 @@ } bool InstanceKlass::is_sealed() const { - return is_final() && - _permitted_subtypes != NULL && + return _permitted_subtypes != NULL && _permitted_subtypes != Universe::the_empty_short_array() && _permitted_subtypes->length() > 0; }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java Thu May 30 23:17:04 2019 +0200 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java Fri May 31 20:07:03 2019 +0200 @@ -2484,7 +2484,6 @@ if (ct.permitted != null && !ct.permitted.isEmpty()) { c.flags_field |= SEALED; - c.flags_field &= ~FINAL; } // reset and read rest of classinfo
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Thu May 30 23:17:04 2019 +0200 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Fri May 31 20:07:03 2019 +0200 @@ -1690,8 +1690,6 @@ result |= ACC_VARARGS; if ((flags & DEFAULT) != 0) result &= ~ABSTRACT; - if ((flags & SEALED) != 0) - result |= FINAL; return result; }