changeset 56921:7ffd78ba1db0 amber-demo-II

manual merge with records
author vromero
date Tue, 09 Jul 2019 14:36:41 -0400
parents 43a6ba90748b 17909be32d4f
children 6d2b8e46b010
files src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties test/langtools/tools/javac/records/bodyless_interfaces/AllowBodyLessInterfacesTest.java test/langtools/tools/javac/records/fields/RecordsCantDeclareFieldModifiersTest.java test/langtools/tools/javac/records/fields/RecordsCantDeclareFieldModifiersTest.out
diffstat 39 files changed, 282 insertions(+), 308 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/classfile/classFileParser.cpp	Thu Jun 27 20:51:33 2019 +0200
+++ b/src/hotspot/share/classfile/classFileParser.cpp	Tue Jul 09 14:36:41 2019 -0400
@@ -3282,37 +3282,18 @@
   for (int n = 0; n < num_of_params; n++) {
     cfs->guarantee_more(RecordParamInfo::param_slots, CHECK);
 
-    const u2 name_index = cfs->get_u2_fast();
-    check_property(valid_symbol_at(name_index),
-      "Invalid constant pool index %u for record parameter name in class file %s",
-      name_index, CHECK);
-    const Symbol* const name = cp->symbol_at(name_index);
-    verify_legal_field_name(name, CHECK);
+    const u2 method_ref_index = cfs->get_u2_fast();
+    //check_property(valid_symbol_at(method_ref_index),
+    //  "Invalid constant pool index %u for record parameter name in class file %s",
+    //  method_ref_index, CHECK);
+    //const Symbol* const method_ref = cp->symbol_at(method_ref_index);
+    // we will need a way to verify that the symbol is correct
+    // verify_legal_field_name(name, CHECK);
     // DEBUG
     // tty->print_cr("name read %s", name->as_klass_external_name());
 
-    const u2 descriptor_index = cfs->get_u2_fast();
-    check_property(valid_symbol_at(descriptor_index),
-      "Invalid constant pool index %u for record parameter descriptor in class file %s",
-      descriptor_index, CHECK);
-    const Symbol* const descriptor = cp->symbol_at(descriptor_index);
-    verify_legal_field_signature(name, descriptor, CHECK);
-    // DEBUG
-    // tty->print_cr("descriptor read %s", descriptor->as_klass_external_name());
-
-    const u2 signature_index = cfs->get_u2_fast();
-    check_property(valid_symbol_at(signature_index),
-      "Invalid constant pool index %u for record parameter signature in class file %s",
-      signature_index, CHECK);
-    const Symbol* const sig = cp->symbol_at(signature_index);
-    // DEBUG
-    // tty->print_cr("signature read %s", sig->as_klass_external_name());
-
     RecordParamInfo* const record_param_info = RecordParamInfo::from_record_params_array(record_params_array, n);
-    record_param_info->initialize(
-                      name_index,
-                      descriptor_index,
-                      signature_index);
+    record_param_info->initialize(method_ref_index);
   }
 
   assert(NULL == _record_params, "invariant");
--- a/src/hotspot/share/oops/instanceKlass.hpp	Thu Jun 27 20:51:33 2019 +0200
+++ b/src/hotspot/share/oops/instanceKlass.hpp	Tue Jul 09 14:36:41 2019 -0400
@@ -457,9 +457,7 @@
   void set_nest_host_index(u2 i)  { _nest_host_index = i; }
 
   // record parameters
-  Symbol* record_param_name(int index) const { return record_param(index)->name(constants()); }
-  Symbol* record_param_signature(int index) const { return record_param(index)->signature(constants()); }
-  Symbol* record_param_descriptor(int index) const { return record_param(index)->signature(constants()); }
+  int record_param_accessor_index(int index) const { return record_param(index)->accessor_index(); }
 
   int record_params_count() const       { return _record_params_count; }
 
--- a/src/hotspot/share/oops/recordParamInfo.hpp	Thu Jun 27 20:51:33 2019 +0200
+++ b/src/hotspot/share/oops/recordParamInfo.hpp	Tue Jul 09 14:36:41 2019 -0400
@@ -40,22 +40,15 @@
   friend class RecordParameterStreamBase;
   friend class JavaRecordParameterStream;
   enum ParamOffset {
-    name_index_offset        = 0,
-    descriptor_index_offset  = 1,
-    signature_index_offset   = 2,
-    param_slots              = 3
+    accessor_index_offset    = 0,
+    param_slots              = 1
   };
 
 private:
   u2 _shorts[param_slots];
 
-  void set_name_index(u2 val)                              { _shorts[name_index_offset] = val;         }
-  void set_descriptor_index(u2 val)                        { _shorts[descriptor_index_offset] = val;   }
-  void set_signature_index(u2 val)                         { _shorts[signature_index_offset] = val;    }
+  void set_accessor_index(u2 val)                          { _shorts[accessor_index_offset] = val;    }
 
-  u2 name_index() const                                    { return _shorts[name_index_offset];        }
-  u2 descriptor_index() const                              { return _shorts[descriptor_index_offset];  }
-  u2 signature_index() const                               { return _shorts[signature_index_offset];   }
 public:
   static RecordParamInfo* from_record_params_array(Array<u2>* record_params, int index) {
     return ((RecordParamInfo*)record_params->adr_at(index * param_slots));
@@ -64,17 +57,20 @@
     return ((RecordParamInfo*)(record_params + index * param_slots));
   }
 
-  void initialize(u2 name_index,
-                  u2 descriptor_index,
-                  u2 signature_index) {
-    _shorts[name_index_offset] = name_index;
-    _shorts[descriptor_index_offset] = descriptor_index;
-    _shorts[signature_index_offset] = signature_index;
+  void initialize(u2 accessor_index) {
+    _shorts[accessor_index_offset] = accessor_index;
   }
 
-  Symbol* name(const constantPoolHandle& cp) const          { return cp->symbol_at(name_index());       }
-  Symbol* signature(const constantPoolHandle& cp) const     { return cp->symbol_at(signature_index());  }
-  Symbol* descriptor(const constantPoolHandle& cp) const    { return cp->symbol_at(descriptor_index()); }
+  u2 accessor_index() const                                { return _shorts[accessor_index_offset];   }
+
+  Symbol* name(const constantPoolHandle& cp) const {
+    int accessor_index = _shorts[accessor_index_offset];
+    int method_ref_info = cp->int_at(accessor_index);
+    int name_and_type_index = extract_high_short_from_int(method_ref_info);
+    int name_and_type_info = cp->int_at(name_and_type_index);
+    int name_index = extract_low_short_from_int(name_and_type_info);
+    return cp->symbol_at(name_index);
+  }
 };
 
 #endif // SHARE_VM_OOPS_RECORDPARAMINFO_HPP
--- a/src/hotspot/share/oops/recordParamStreams.hpp	Thu Jun 27 20:51:33 2019 +0200
+++ b/src/hotspot/share/oops/recordParamStreams.hpp	Tue Jul 09 14:36:41 2019 -0400
@@ -76,17 +76,13 @@
   }
   bool done() const { return _index >= _limit; }
 
+  int accessor_index() const {
+    return record_param()->accessor_index();
+  }
+
   Symbol* name() const {
     return record_param()->name(_constants);
   }
-
-  Symbol* descriptor() const {
-    return record_param()->descriptor(_constants);
-  }
-
-  Symbol* signature() const {
-    return record_param()->signature(_constants);
-  }
 };
 
 // Iterate over the record parameters
@@ -94,23 +90,11 @@
  public:
   JavaRecordParameterStream(const InstanceKlass* k): RecordParameterStreamBase(k->record_params(), k->constants(), 0, k->record_params_count()) {}
 
-  int name_index() const {
-    return record_param()->name_index();
+  int accessor_index() const {
+    return record_param()->accessor_index();
   }
-  void set_name_index(int index) {
-    record_param()->set_name_index(index);
-  }
-  int descriptor_index() const {
-    return record_param()->descriptor_index();
-  }
-  void set_descriptor_index(int index) {
-    record_param()->set_descriptor_index(index);
-  }
-  int signature_index() const {
-    return record_param()->signature_index();
-  }
-  void set_generic_signature_index(int index) {
-    record_param()->set_signature_index(index);
+  void set_accessor_index(int index) {
+    record_param()->set_accessor_index(index);
   }
 };
 
--- a/src/hotspot/share/prims/jvm.cpp	Thu Jun 27 20:51:33 2019 +0200
+++ b/src/hotspot/share/prims/jvm.cpp	Tue Jul 09 14:36:41 2019 -0400
@@ -1689,7 +1689,7 @@
 
   int out_idx = 0;
   for (JavaRecordParameterStream recordParamsStream(k); !recordParamsStream.done(); recordParamsStream.next()) {
-    Handle str = java_lang_String::create_from_symbol(recordParamsStream.name(), CHECK_NULL);
+    Handle str = java_lang_String::create_from_symbol(recordParamsStream.name() , CHECK_NULL);
     dest->obj_at_put(out_idx, str());
     ++out_idx;
   }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java	Thu Jun 27 20:51:33 2019 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java	Tue Jul 09 14:36:41 2019 -0400
@@ -342,7 +342,7 @@
     /**
      * Flag to indicate that the class/interface has explicitly being annotated as not sealed.
      */
-    public static final long NON_FINAL = 1L<<62;
+    public static final long NON_SEALED = 1L<<62;
 
     /**
      * Flag to indicate that a class is a record. The flag is also used to mark fields that are
@@ -367,8 +367,13 @@
         MethodFlags                 = AccessFlags | ABSTRACT | STATIC | NATIVE |
                                       SYNCHRONIZED | FINAL | STRICTFP;
     public static final long
-        ExtendedStandardFlags       = (long)StandardFlags | DEFAULT,
-        ModifierFlags               = ((long)StandardFlags & ~INTERFACE) | DEFAULT,
+        ExtendedStandardFlags            = (long)StandardFlags | DEFAULT | SEALED | NON_SEALED,
+        ExtendedLocalClassFlags          = (long)LocalClassFlags | SEALED | NON_SEALED,
+        ExtendedLocalRecordFlags         = (long)LocalRecordFlags | SEALED | NON_SEALED,
+        ExtendedMemberClassFlags         = (long)MemberClassFlags | SEALED | NON_SEALED,
+        ExtendedMemberRecordClassFlags   = (long)MemberRecordClassFlags | SEALED | NON_SEALED,
+        ExtendedClassFlags               = (long)ClassFlags | SEALED | NON_SEALED,
+        ModifierFlags                    = ((long)StandardFlags & ~INTERFACE) | DEFAULT | SEALED | NON_SEALED,
         InterfaceMethodMask         = ABSTRACT | PRIVATE | STATIC | PUBLIC | STRICTFP | DEFAULT,
         AnnotationTypeElementMask   = ABSTRACT | PUBLIC,
         LocalVarFlags               = FINAL | PARAMETER,
@@ -472,6 +477,7 @@
         ANONCONSTR_BASED(Flags.ANONCONSTR_BASED),
         NAME_FILLED(Flags.NAME_FILLED),
         SEALED(Flags.SEALED),
+        NON_SEALED(Flags.NON_SEALED),
         RECORD(Flags.RECORD);
 
         Flag(long flag) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Jun 27 20:51:33 2019 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Tue Jul 09 14:36:41 2019 -0400
@@ -2794,6 +2794,10 @@
             Type currentTarget = targetInfo.target;
             Type lambdaType = targetInfo.descriptor;
 
+            if (currentTarget.tsym != null && ((ClassSymbol)currentTarget.tsym).isSealed()) {
+                log.error(that, Errors.CantInheritFromSealed(currentTarget.tsym));
+            }
+
             if (currentTarget.isErroneous()) {
                 result = that.type = currentTarget;
                 return;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Thu Jun 27 20:51:33 2019 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Tue Jul 09 14:36:41 2019 -0400
@@ -94,6 +94,7 @@
     private final Target target;
     private final Profile profile;
     private final boolean warnOnAnyAccessToMembers;
+    private final boolean debug;
 
     // The set of lint options currently in effect. It is initialized
     // from the context, and then is set/reset as needed by Attr as it
@@ -155,6 +156,7 @@
                 enforceMandatoryWarnings, "sunapi", null);
 
         deferredLintHandler = DeferredLintHandler.instance(context);
+        debug = options.isSet("debug");
     }
 
     /** Character for synthetic names
@@ -1137,6 +1139,9 @@
                 mask = VarFlags;
             break;
         case MTH:
+            if (debug) {
+                System.out.println("checking method with flags " + Flags.toString(flags));
+            }
             if (sym.name == names.init) {
                 if ((sym.owner.flags_field & ENUM) != 0) {
                     // enum constructors cannot be declared public or
@@ -1168,8 +1173,11 @@
                 implicit |= sym.owner.flags_field & STRICTFP;
             break;
         case TYP:
+            if (debug) {
+                System.out.println("checking type with flags " + Flags.toString(flags));
+            }
             if (sym.isLocal()) {
-                mask = (flags & RECORD) != 0 ? LocalRecordFlags : LocalClassFlags;
+                mask = (flags & RECORD) != 0 ? LocalRecordFlags : ExtendedLocalClassFlags;
                 if ((sym.owner.flags_field & STATIC) == 0 &&
                     (flags & ENUM) != 0) {
                     log.error(pos, Errors.EnumsMustBeStatic);
@@ -1178,7 +1186,7 @@
                     log.error(pos, Errors.NestedRecordsMustBeStatic);
                 }
             } else if (sym.owner.kind == TYP) {
-                mask = (flags & RECORD) != 0 ? MemberRecordClassFlags : MemberClassFlags;
+                mask = (flags & RECORD) != 0 ? ExtendedMemberRecordClassFlags : ExtendedMemberClassFlags;
                 if (sym.owner.owner.kind == PCK ||
                     (sym.owner.flags_field & STATIC) != 0)
                     mask |= STATIC;
@@ -1188,7 +1196,7 @@
                 // Nested interfaces and enums are always STATIC (Spec ???)
                 if ((flags & (INTERFACE | ENUM)) != 0 ) implicit = STATIC;
             } else {
-                mask = ClassFlags;
+                mask = ExtendedClassFlags;
             }
             // Interfaces are always ABSTRACT
             if ((flags & INTERFACE) != 0) implicit |= ABSTRACT;
@@ -1209,6 +1217,9 @@
             throw new AssertionError();
         }
         long illegal = flags & ExtendedStandardFlags & ~mask;
+        if (debug) {
+            System.out.println("illegal flags: " + Flags.toString(illegal));
+        }
         if (illegal != 0) {
             if ((illegal & INTERFACE) != 0) {
                 log.error(pos, ((flags & ANNOTATION) != 0) ? Errors.AnnotationDeclNotAllowedHere : Errors.IntfNotAllowedHere);
@@ -1249,7 +1260,13 @@
                  (sym.kind == TYP ||
                   checkDisjoint(pos, flags,
                                 ABSTRACT | NATIVE,
-                                STRICTFP))) {
+                                STRICTFP))
+                 && checkDisjoint(pos, flags,
+                                FINAL,
+                           SEALED | NON_SEALED)
+                 && checkDisjoint(pos, flags,
+                                SEALED,
+                           FINAL | NON_SEALED)) {
             // skip
         }
         return flags & (mask | ~ExtendedStandardFlags) | implicit;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java	Thu Jun 27 20:51:33 2019 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java	Tue Jul 09 14:36:41 2019 -0400
@@ -2303,6 +2303,23 @@
         return buffer.toList();
     }
 
+    /* this method looks for explicit accessors to add them to the corresponding field
+     */
+    void findUserDefinedAccessors(JCClassDecl tree) {
+        tree.defs.stream()
+                .filter(t -> t.hasTag(VARDEF))
+                .map(t -> (JCVariableDecl)t)
+                .filter(vd -> (vd.sym.accessors.isEmpty() && !vd.sym.isStatic()))
+                .forEach(vd -> {
+                    MethodSymbol msym = lookupMethod(tree.pos(),
+                            vd.name,
+                            tree.sym.type,
+                            List.nil());
+                    Assert.check(msym != null, "there has to be a user defined accessor");
+                    vd.sym.accessors = List.of(new Pair<>(Accessors.Kind.GET, msym));
+                });
+    }
+
     /** Translate an enum class. */
     private void visitEnumDef(JCClassDecl tree) {
         make_at(tree.pos());
@@ -2488,6 +2505,7 @@
                 recordExtractor(tree, getterMethHandlesForExtractor),
                 recordReadResolve(tree)
         ));
+        findUserDefinedAccessors(tree);
     }
 
     JCTree generateRecordMethod(JCClassDecl tree, Name name, List<VarSymbol> vars, MethodHandleSymbol[] getterMethHandles) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java	Thu Jun 27 20:51:33 2019 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java	Tue Jul 09 14:36:41 2019 -0400
@@ -1091,7 +1091,11 @@
                     boolean isSealed = sealedParentPair.fst.tsym.isSealed();
                     if (areInSameCompilationUnit) {
                         if (sealedParentPair.fst.tsym.isSealed() && !((ClassType)sealedParentPair.fst.tsym.type).isPermittedExplicit) {
-                            sealedParentPair.fst.permitted = sealedParentPair.fst.permitted.prepend(tree.sym.type);
+                            if (tree.sym.isAnonymous()) {
+                                log.error(sealedParentPair.snd, Errors.CantInheritFromSealed(sealedParentPair.fst.tsym));
+                            } else {
+                                sealedParentPair.fst.permitted = sealedParentPair.fst.permitted.prepend(tree.sym.type);
+                            }
                         } else if (!dontErrorIfSealedExtended) {
                             log.error(sealedParentPair.snd, Errors.CantInheritFromSealed(sealedParentPair.fst.tsym));
                         }
@@ -1101,10 +1105,14 @@
                 }
             }
 
-            if (anyParentIsSealed) {
+            if (anyParentIsSealed && ((tree.sym.flags_field & Flags.NON_SEALED) == 0) ) {
                 // once we have the non-final keyword this will change
                 tree.sym.flags_field |= (tree.sym.flags_field & ABSTRACT) != 0 ? SEALED : FINAL;
             }
+
+            if (!anyParentIsSealed && ((tree.sym.flags_field & Flags.NON_SEALED) != 0) ) {
+                log.error(tree, Errors.NonSealedWithNoSealedSupertype);
+            }
         }
 
         /** Add the accessors for fields to the symbol table.
@@ -1139,7 +1147,7 @@
                         log.error(TreeInfo.declarationFor(implSym, env.enclClass), Errors.MethodMustBePublic(implSym.name));
                     }
                     if (!types.isSameType(implSym.type.getReturnType(), tree.sym.type)) {
-                        log.error(TreeInfo.declarationFor(implSym, env.enclClass), Errors.AccessorReturnTypeDoesntMatch);
+                        log.error(TreeInfo.declarationFor(implSym, env.enclClass), Errors.AccessorReturnTypeDoesntMatch(tree.sym.type, implSym.type.getReturnType()));
                     }
                 }
             }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Thu Jun 27 20:51:33 2019 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Tue Jul 09 14:36:41 2019 -0400
@@ -845,16 +845,8 @@
         }
         databuf.appendChar(numParams);
         for (VarSymbol v: vars) {
-            databuf.appendChar(poolWriter.putName(v.name));
-            // descriptor
-            databuf.appendChar(poolWriter.putDescriptor(v));
-            // signature
-            databuf.appendChar(poolWriter.putSignature(v));
+            databuf.appendChar(poolWriter.putMember(v.accessors.head.snd));
         }
-        int acountIdx = beginAttrs();
-        int acount = 0;
-        acount += writeParameterAttrs(vars);
-        endAttrs(acountIdx, acount);
         endAttr(alenIdx);
         return 1;
     }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Thu Jun 27 20:51:33 2019 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Tue Jul 09 14:36:41 2019 -0400
@@ -38,7 +38,6 @@
 import com.sun.tools.javac.parser.Tokens.*;
 import com.sun.tools.javac.parser.Tokens.Comment.CommentStyle;
 import com.sun.tools.javac.resources.CompilerProperties.Errors;
-import com.sun.tools.javac.resources.CompilerProperties.Fragments;
 import com.sun.tools.javac.resources.CompilerProperties.Warnings;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.tree.JCTree.*;
@@ -106,6 +105,8 @@
     /** End position mappings container */
     protected final AbstractEndPosTable endPosTable;
 
+    private final boolean debug;
+
     // Because of javac's limited lookahead, some contexts are ambiguous in
     // the presence of type annotations even though they are not ambiguous
     // in the absence of type annotations.  Consider this code:
@@ -184,6 +185,7 @@
         endPosTable = newEndPosTable(keepEndPositions);
         this.allowYieldStatement = (!preview.isPreview(Feature.SWITCH_EXPRESSION) || preview.isEnabled()) &&
                 Feature.SWITCH_EXPRESSION.allowedInSource(source);
+        debug = fac.options.isSet("debug");
     }
 
     protected AbstractEndPosTable newEndPosTable(boolean keepEndPositions) {
@@ -3070,17 +3072,17 @@
             case DEFAULT     : checkSourceLevel(Feature.DEFAULT_METHODS); flag = Flags.DEFAULT; break;
             case ERROR       : flag = 0; nextToken(); break;
             case IDENTIFIER  : {
-                if (token.name() == names.non && peekToken(0, TokenKind.SUB, TokenKind.FINAL)) {
+                if (token.name() == names.non && peekToken(0, TokenKind.SUB, TokenKind.IDENTIFIER)) {
                     Token tokenSub = S.token(1);
-                    Token tokenFinal = S.token(2);
-                    if (token.endPos == tokenSub.pos && tokenSub.endPos == tokenFinal.pos) {
-                        flag = Flags.NON_FINAL;
+                    Token tokenSealed = S.token(2);
+                    if (token.endPos == tokenSub.pos && tokenSub.endPos == tokenSealed.pos && tokenSealed.name() == names.sealed) {
+                        flag = Flags.NON_SEALED;
                         nextToken();
                         nextToken();
                         break;
                     }
                 }
-                if (isSealedClassDeclaration()) {
+                if (token.name() == names.sealed) {
                     flag = Flags.SEALED;
                     break;
                 }
@@ -3749,11 +3751,7 @@
             implementing = typeList();
         }
         List<JCTree> defs = List.nil();
-        if (token.kind == LBRACE) {
-            defs = classInterfaceOrRecordBody(name, false, true);
-        } else {
-            accept(SEMI);
-        }
+        defs = classInterfaceOrRecordBody(name, false, true);
         java.util.List<JCVariableDecl> fields = new ArrayList<>();
         Set<Name> seenNames = new HashSet<>();
         for (JCVariableDecl field : headerFields) {
@@ -3860,12 +3858,7 @@
             permitting = typeList();
         }
         List<JCTree> defs;
-        if (token.kind == LBRACE) {
-            defs = classInterfaceOrRecordBody(name, true, false);
-        } else {
-            accept(SEMI);
-            defs = List.nil();
-        }
+        defs = classInterfaceOrRecordBody(name, true, false);
         JCClassDecl result = toP(F.at(pos).ClassDef(
             mods, name, typarams, null, extending, permitting, defs));
         attach(result, dc);
@@ -4039,6 +4032,9 @@
             Comment dc = token.comment(CommentStyle.JAVADOC);
             int pos = token.pos;
             JCModifiers mods = modifiersOpt();
+            if (debug) {
+                System.out.println("read flags " + Flags.toString(mods.flags));
+            }
             if (token.kind == CLASS ||
                 isRecordToken() ||
                 token.kind == INTERFACE ||
@@ -4131,15 +4127,6 @@
         return token.kind == IDENTIFIER && token.name() == names.record;
     }
 
-    boolean isSealedClassDeclaration() {
-        Token next = S.token(1);
-        return token.kind == IDENTIFIER && token.name() == names.sealed &&
-                (peekToken(TokenKind.CLASS) ||
-                        peekToken(TokenKind.INTERFACE) ||
-                        peekToken(TokenKind.ABSTRACT) ||
-                        next.kind == IDENTIFIER && next.name() == names.record);
-    }
-
     /** MethodDeclaratorRest =
      *      FormalParameters BracketsOpt [THROWS TypeList] ( MethodBody | [DEFAULT AnnotationValue] ";")
      *  VoidMethodDeclaratorRest =
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Jun 27 20:51:33 2019 +0200
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Tue Jul 09 14:36:41 2019 -0400
@@ -3410,6 +3410,9 @@
 compiler.err.cant.inherit.from.sealed=\
     cannot inherit from sealed class: {0}
 
+compiler.err.non.sealed.with.no.sealed.supertype=\
+    non-sealed modifier applied to a class with no sealed supertype
+
 ###
 # errors related to records
 
@@ -3470,8 +3473,11 @@
 compiler.err.constructor.with.same.erasure.as.canonical=\
     constructor with same erasure as canonical constructor
 
+# 0: type, 1: type
 compiler.err.accessor.return.type.doesnt.match=\
-    type returned by the accessor is not the same as the type of the corresponding record component
+    type returned by the accessor is not the same as the type of the corresponding record component\n\
+    required: {0}\n\
+    found:    {1}\n\
 
 ############################################
 # messages previouly at javac.properties
--- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java	Thu Jun 27 20:51:33 2019 +0200
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java	Tue Jul 09 14:36:41 2019 -0400
@@ -644,19 +644,11 @@
         @Override
         public Void visitRecord(Record_attribute attr, ClassOutputStream out) {
             out.writeShort(attr.num_params);
-            for (Record_attribute.Param_data e: attr.params)
-                writeParamData(e, out);
-            new AttributeWriter().write(attr.attributes, out);
+            for (int e: attr.accessors)
+                out.writeShort(e);
             return null;
         }
 
-        protected void writeParamData(Record_attribute.Param_data pd, ClassOutputStream out) {
-            out.writeShort(pd.param_name_index);
-            out.writeShort(pd.param_flags);
-            out.writeShort(pd.param_descriptor);
-            out.writeShort(pd.param_signature);
-        }
-
         @Override
         public Void visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr, ClassOutputStream out) {
             annotationWriter.write(attr.annotations, out);
--- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Record_attribute.java	Thu Jun 27 20:51:33 2019 +0200
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Record_attribute.java	Tue Jul 09 14:36:41 2019 -0400
@@ -38,11 +38,10 @@
     Record_attribute(ClassReader cr, int name_index, int length) throws IOException {
         super(name_index, length);
         num_params = cr.readUnsignedShort();
-        params = new Param_data[num_params];
+        accessors = new int[num_params];
         for (int i = 0; i < num_params; i++) {
-            params[i] = new Param_data(cr);
+            accessors[i] = cr.readUnsignedShort();
         }
-        attributes = new Attributes(cr);
     }
 
     @Override
@@ -51,24 +50,5 @@
     }
 
     public final int num_params;
-    public final Param_data[] params;
-    public final Attributes attributes;
-
-    public static class Param_data {
-        Param_data(ClassReader cr) throws IOException {
-            param_name_index = cr.readUnsignedShort();
-            param_flags = cr.readUnsignedShort();
-            param_descriptor = cr.readUnsignedShort();
-            param_signature = cr.readUnsignedShort();
-        }
-
-        public String getName(ConstantPool constant_pool) throws ConstantPoolException {
-            return constant_pool.getUTF8Value(param_name_index);
-        }
-
-        public final int param_name_index;
-        public final int param_flags;
-        public final int param_descriptor;
-        public final int param_signature;
-    }
+    public final int[] accessors;
 }
--- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java	Thu Jun 27 20:51:33 2019 +0200
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java	Tue Jul 09 14:36:41 2019 -0400
@@ -61,7 +61,6 @@
 import com.sun.tools.classfile.NestHost_attribute;
 import com.sun.tools.classfile.NestMembers_attribute;
 import com.sun.tools.classfile.Record_attribute;
-import com.sun.tools.classfile.Record_attribute.Param_data;
 import com.sun.tools.classfile.RuntimeInvisibleAnnotations_attribute;
 import com.sun.tools.classfile.RuntimeInvisibleParameterAnnotations_attribute;
 import com.sun.tools.classfile.RuntimeInvisibleTypeAnnotations_attribute;
@@ -731,39 +730,12 @@
         println("Record:");
         indent(+1);
         for (int i = 0; i < attr.num_params; i++) {
-            writeParamData(attr.params[i]);
+            println("#" + attr.accessors[i]);
         }
-        write(attr, attr.attributes, constant_pool);
         indent(-1);
         return null;
     }
 
-    void writeParamData(Param_data pd) {
-        AccessFlags flags = new AccessFlags(pd.param_flags);
-        writeModifiers(flags.getFieldModifiers());
-        Descriptor descriptor = new Descriptor(pd.param_descriptor);
-        print(getJavaFieldType(descriptor));
-        print(" ");
-        try {
-            print(pd.getName(constant_pool));
-        } catch (ConstantPoolException cpe) {
-            // ignore
-        }
-        println(";");
-        try {
-            indent(+1);
-            println("descriptor: " + descriptor.getValue(constant_pool));
-            writeList(String.format("flags: (0x%04x) ", flags.flags), flags.getFieldFlags(), "\n");
-            Signature signature = new Signature(pd.param_signature);
-            Type t = signature.getType(constant_pool);
-            println("signature: " + getJavaName(t.toString()));
-            indent(-1);
-        } catch (ConstantPoolException cpe) {
-            // ignore
-        }
-        println();
-    }
-
     void writeList(String prefix, Collection<?> items, String suffix) {
         print(prefix);
         String sep = "";
--- a/test/langtools/lib/annotations/annotations/classfile/ClassfileInspector.java	Thu Jun 27 20:51:33 2019 +0200
+++ b/test/langtools/lib/annotations/annotations/classfile/ClassfileInspector.java	Tue Jul 09 14:36:41 2019 -0400
@@ -1361,6 +1361,16 @@
         public Void visitSynthetic(Synthetic_attribute attr, T p) {
             return null;
         }
+
+        @Override
+        public Void visitPermittedSubtypes(PermittedSubtypes_attribute attr, T p) {
+            return null;
+        }
+
+        @Override
+        public Void visitRecord(Record_attribute attr, T p) {
+            return null;
+        }
     }
 
     private static final Attribute.Visitor<Void, ExpectedTypeAnnotation> typeAnnoMatcher
--- a/test/langtools/tools/javac/MethodParameters/AttributeVisitor.java	Thu Jun 27 20:51:33 2019 +0200
+++ b/test/langtools/tools/javac/MethodParameters/AttributeVisitor.java	Tue Jul 09 14:36:41 2019 -0400
@@ -64,4 +64,6 @@
     public R visitStackMap(StackMap_attribute attr, P p) { return null; }
     public R visitStackMapTable(StackMapTable_attribute attr, P p) { return null; }
     public R visitSynthetic(Synthetic_attribute attr, P p) { return null; }
+    public R visitPermittedSubtypes(PermittedSubtypes_attribute attr, P p) { return null; }
+    public R visitRecord(Record_attribute attr, P p) { return null; }
 }
--- a/test/langtools/tools/javac/records/BadRecord.java	Thu Jun 27 20:51:33 2019 +0200
+++ b/test/langtools/tools/javac/records/BadRecord.java	Tue Jul 09 14:36:41 2019 -0400
@@ -3,50 +3,70 @@
  * @summary Verifying error recovery for broken record classes
  * @compile/fail/ref=BadRecord.out -XDrawDiagnostics BadRecord.java
  */
-record BadRecordb1 {}
+record BadRecord001 {}
 
-record BadRecordb2( {}
+record BadRecord0022( {}
 
-record BadRecordb3(int {}
+record BadRecord0033(int {}
 
-record BadRecordb4(int) {}
+record BadRecord0044(int) {}
 
-record BadRecordb5(int i {}
+record BadRecord005(int i {}
 
-record BadRecordb6(int i, {}
+record BadRecord006(int i, {}
 
-record BadRecordb7(int i,) {}
+record BadRecord007(int i,) {}
 
-record BadRecordb8(int i, int {}
+record BadRecord008(int i, int {}
 
-record BadRecordb9(int i, int) {}
+record BadRecord009(int i, int) {}
 
-record BadRecordba(int i, int j {}
+record BadRecord010(int i, int j {}
 
-record BadRecordbb(int i, int j, {}
+record BadRecord011(int i, int j, {}
 
-record BadRecordbc(int i, int j,) {}
+record BadRecord012(int i, int j,) {}
 
-record BadRecords1;
+record BadRecord013;
 
-record BadRecords2(;
+record BadRecord014(;
 
-record BadRecords3(int;
+record BadRecord015(int;
 
-record BadRecords4(int);
+record BadRecord016(int);
 
-record BadRecords5(int i;
+record BadRecord017(int i;
 
-record BadRecords6(int i,;
+record BadRecord018(int i,;
 
-record BadRecords7(int i,);
+record BadRecord019(int i,);
 
-record BadRecords8(int i, int;
+record BadRecord020(int i, int;
 
-record BadRecords9(int i, int);
+record BadRecord021(int i, int);
 
-record BadRecordsa(int i, int j;
+record BadRecord022(int i, int j;
 
-record BadRecordsb(int i, int j,;
+record BadRecord023(int i, int j,;
 
-record BadRecordsc(int i, int j,);
+record BadRecord024(int i, int j,);
+
+record BadRecord025(int x)
+
+record BadRecord026 {}
+
+record BadRecord027(final int x) { }
+
+record BadRecord028(private int x) { }
+
+record BadRecord029(public int x) { }
+
+record BadRecord030(volatile int x) { }
+
+record BadRecord030(int x) {
+    private int x() { return x; }
+}
+
+record R(int x) {
+    public int x;
+}
--- a/test/langtools/tools/javac/records/BadRecord.out	Thu Jun 27 20:51:33 2019 +0200
+++ b/test/langtools/tools/javac/records/BadRecord.out	Tue Jul 09 14:36:41 2019 -0400
@@ -1,25 +1,36 @@
-BadRecord.java:6:19: compiler.err.expected: '('
-BadRecord.java:8:21: compiler.err.illegal.start.of.type
-BadRecord.java:10:23: compiler.err.expected: token.identifier
-BadRecord.java:12:23: compiler.err.expected: token.identifier
-BadRecord.java:14:25: compiler.err.expected: ')'
-BadRecord.java:16:27: compiler.err.illegal.start.of.type
-BadRecord.java:18:26: compiler.err.illegal.start.of.type
-BadRecord.java:20:30: compiler.err.expected: token.identifier
-BadRecord.java:22:30: compiler.err.expected: token.identifier
-BadRecord.java:24:32: compiler.err.expected: ')'
-BadRecord.java:26:34: compiler.err.illegal.start.of.type
-BadRecord.java:28:33: compiler.err.illegal.start.of.type
-BadRecord.java:30:19: compiler.err.expected: '('
-BadRecord.java:32:20: compiler.err.illegal.start.of.type
-BadRecord.java:34:23: compiler.err.expected: token.identifier
-BadRecord.java:36:23: compiler.err.expected: token.identifier
-BadRecord.java:38:25: compiler.err.expected: ')'
-BadRecord.java:40:26: compiler.err.illegal.start.of.type
-BadRecord.java:42:26: compiler.err.illegal.start.of.type
-BadRecord.java:44:30: compiler.err.expected: token.identifier
-BadRecord.java:46:30: compiler.err.expected: token.identifier
-BadRecord.java:48:32: compiler.err.expected: ')'
-BadRecord.java:50:33: compiler.err.illegal.start.of.type
-BadRecord.java:52:33: compiler.err.illegal.start.of.type
-24 errors
+BadRecord.java:6:20: compiler.err.expected: '('
+BadRecord.java:8:23: compiler.err.illegal.start.of.type
+BadRecord.java:10:25: compiler.err.expected: token.identifier
+BadRecord.java:12:25: compiler.err.expected: token.identifier
+BadRecord.java:14:26: compiler.err.expected: ')'
+BadRecord.java:16:28: compiler.err.illegal.start.of.type
+BadRecord.java:18:27: compiler.err.illegal.start.of.type
+BadRecord.java:20:31: compiler.err.expected: token.identifier
+BadRecord.java:22:31: compiler.err.expected: token.identifier
+BadRecord.java:24:33: compiler.err.expected: ')'
+BadRecord.java:26:35: compiler.err.illegal.start.of.type
+BadRecord.java:28:34: compiler.err.illegal.start.of.type
+BadRecord.java:30:20: compiler.err.expected: '('
+BadRecord.java:32:21: compiler.err.illegal.start.of.type
+BadRecord.java:34:24: compiler.err.expected: token.identifier
+BadRecord.java:36:24: compiler.err.expected: token.identifier
+BadRecord.java:36:25: compiler.err.expected: '{'
+BadRecord.java:38:26: compiler.err.expected: ')'
+BadRecord.java:40:27: compiler.err.illegal.start.of.type
+BadRecord.java:42:27: compiler.err.illegal.start.of.type
+BadRecord.java:42:28: compiler.err.expected: '{'
+BadRecord.java:44:31: compiler.err.expected: token.identifier
+BadRecord.java:46:31: compiler.err.expected: token.identifier
+BadRecord.java:46:32: compiler.err.expected: '{'
+BadRecord.java:48:33: compiler.err.expected: ')'
+BadRecord.java:50:34: compiler.err.illegal.start.of.type
+BadRecord.java:52:34: compiler.err.illegal.start.of.type
+BadRecord.java:52:35: compiler.err.expected: '{'
+BadRecord.java:54:27: compiler.err.expected: '{'
+BadRecord.java:58:21: compiler.err.record.cant.declare.field.modifiers
+BadRecord.java:60:21: compiler.err.record.cant.declare.field.modifiers
+BadRecord.java:62:21: compiler.err.record.cant.declare.field.modifiers
+BadRecord.java:64:21: compiler.err.record.cant.declare.field.modifiers
+BadRecord.java:71:16: compiler.err.record.fields.must.be.in.header
+BadRecord.java:72:2: compiler.err.premature.eof
+35 errors
--- a/test/langtools/tools/javac/records/BadUseOfRecordKeywordTest.out	Thu Jun 27 20:51:33 2019 +0200
+++ b/test/langtools/tools/javac/records/BadUseOfRecordKeywordTest.out	Tue Jul 09 14:36:41 2019 -0400
@@ -2,4 +2,6 @@
 BadUseOfRecordKeywordTest.java:13:11: compiler.err.record.not.allowed: record
 BadUseOfRecordKeywordTest.java:15:10: compiler.err.record.not.allowed: record
 BadUseOfRecordKeywordTest.java:17:12: compiler.err.record.not.allowed: record
-4 errors
+BadUseOfRecordKeywordTest.java:17:25: compiler.err.expected: '{'
+BadUseOfRecordKeywordTest.java:18:2: compiler.err.premature.eof
+6 errors
--- a/test/langtools/tools/javac/records/bodyless_interfaces/AllowBodyLessInterfacesTest.java	Thu Jun 27 20:51:33 2019 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @summary allow for bodyless interfaces
- * @compile AllowBodyLessInterfacesTest.java
- */
-public class AllowBodyLessInterfacesTest {
-    interface Super;
-
-    interface Child extends Super;
-}
--- a/test/langtools/tools/javac/records/fields/RecordsCantDeclareFieldModifiersTest.java	Thu Jun 27 20:51:33 2019 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-/*
- * @test /nodynamiccopyright/
- * @summary smoke negative test for datum classes
- * @compile/fail/ref=RecordsCantDeclareFieldModifiersTest.out -XDrawDiagnostics RecordsCantDeclareFieldModifiersTest.java
- */
-
-public class RecordsCantDeclareFieldModifiersTest {
-    record R(public int i);
-}
--- a/test/langtools/tools/javac/records/fields/RecordsCantDeclareFieldModifiersTest.out	Thu Jun 27 20:51:33 2019 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-RecordsCantDeclareFieldModifiersTest.java:8:14: compiler.err.record.cant.declare.field.modifiers
-1 error
--- a/test/langtools/tools/javac/records/mandated_members/accessors/BadAccessorsTest.out	Thu Jun 27 20:51:33 2019 +0200
+++ b/test/langtools/tools/javac/records/mandated_members/accessors/BadAccessorsTest.out	Tue Jul 09 14:36:41 2019 -0400
@@ -1,5 +1,5 @@
 BadAccessorsTest.java:12:13: compiler.err.method.must.be.public: i
 BadAccessorsTest.java:13:21: compiler.err.method.must.be.public: j
 BadAccessorsTest.java:14:23: compiler.err.method.must.be.public: k
-BadAccessorsTest.java:16:21: compiler.err.accessor.return.type.doesnt.match
+BadAccessorsTest.java:16:21: compiler.err.accessor.return.type.doesnt.match: java.util.List<java.lang.String>, java.util.List
 4 errors
--- a/test/langtools/tools/javac/records/mandated_members/canonical_constructor/CanonicalConstructorTest.java	Thu Jun 27 20:51:33 2019 +0200
+++ b/test/langtools/tools/javac/records/mandated_members/canonical_constructor/CanonicalConstructorTest.java	Tue Jul 09 14:36:41 2019 -0400
@@ -32,7 +32,7 @@
 import com.sun.tools.javac.util.Assert;
 
 public class CanonicalConstructorTest {
-    record R1(int i, int j);
+    record R1(int i, int j) {}
     record R2(int i, int j) {
         public R2 {}
     }
--- a/test/langtools/tools/javac/records/mandated_members/canonical_constructor/MethodParametersForCanonicalConstructorTest.java	Thu Jun 27 20:51:33 2019 +0200
+++ b/test/langtools/tools/javac/records/mandated_members/canonical_constructor/MethodParametersForCanonicalConstructorTest.java	Tue Jul 09 14:36:41 2019 -0400
@@ -36,7 +36,7 @@
 
 public class MethodParametersForCanonicalConstructorTest {
 
-    record R1(int i, int j);
+    record R1(int i, int j) {}
 
     record R2(int i, int j) {
         public R2 {}
--- a/test/langtools/tools/javac/records/mandated_members/read_resolve_method/CheckReadResolveMethodTest.java	Thu Jun 27 20:51:33 2019 +0200
+++ b/test/langtools/tools/javac/records/mandated_members/read_resolve_method/CheckReadResolveMethodTest.java	Tue Jul 09 14:36:41 2019 -0400
@@ -45,10 +45,10 @@
     }
 
     // readResolve should be generated the record implements Serializable
-    record Point2(int i, int j) implements Serializable;
+    record Point2(int i, int j) implements Serializable {}
 
     // no readResolve should be generated as the record doesnt implement Serializable
-    record Point3(int i, int j);
+    record Point3(int i, int j) {}
 
     // no readResolve should be generated as an implementation is already provided
     record Point4(int i, int j) {
--- a/test/langtools/tools/javac/records/records_cant_be_abstract/RecordsCantBeAbstractTest.java	Thu Jun 27 20:51:33 2019 +0200
+++ b/test/langtools/tools/javac/records/records_cant_be_abstract/RecordsCantBeAbstractTest.java	Tue Jul 09 14:36:41 2019 -0400
@@ -4,4 +4,4 @@
  * @compile/fail/ref=RecordsCantBeAbstractTest.out -XDrawDiagnostics RecordsCantBeAbstractTest.java
  */
 
-abstract record RecordsCantBeAbstractTest(int i);
+abstract record RecordsCantBeAbstractTest(int i) {}
--- a/test/langtools/tools/javac/records/records_cant_have_extends_clause/RecordsCantHaveExtendsClause.java	Thu Jun 27 20:51:33 2019 +0200
+++ b/test/langtools/tools/javac/records/records_cant_have_extends_clause/RecordsCantHaveExtendsClause.java	Tue Jul 09 14:36:41 2019 -0400
@@ -11,10 +11,10 @@
     // even Object which is the implicit super class for records
     record R1(int x) extends Object {}
 
-    record R2(int y);
+    record R2(int y) {}
 
     // can't extend other records either
-    record R3(int y, int x) extends R2(y);
+    record R3(int y, int x) extends R2(y) {}
 
     // records can implement interfaces
     record R4() implements Serializable, Runnable {
--- a/test/langtools/tools/javac/records/records_cant_have_extends_clause/RecordsCantHaveExtendsClause.out	Thu Jun 27 20:51:33 2019 +0200
+++ b/test/langtools/tools/javac/records/records_cant_have_extends_clause/RecordsCantHaveExtendsClause.out	Tue Jul 09 14:36:41 2019 -0400
@@ -1,6 +1,3 @@
-RecordsCantHaveExtendsClause.java:12:21: compiler.err.expected: ';'
-RecordsCantHaveExtendsClause.java:12:36: compiler.err.expected: token.identifier
-RecordsCantHaveExtendsClause.java:17:28: compiler.err.expected: ';'
-RecordsCantHaveExtendsClause.java:17:37: compiler.err.invalid.meth.decl.ret.type.req
-RecordsCantHaveExtendsClause.java:17:41: compiler.err.expected: token.identifier
-5 errors
+RecordsCantHaveExtendsClause.java:12:21: compiler.err.expected: '{'
+RecordsCantHaveExtendsClause.java:17:28: compiler.err.expected: '{'
+2 errors
--- a/test/langtools/tools/javac/records/reflection/RecordReflectionTest.java	Thu Jun 27 20:51:33 2019 +0200
+++ b/test/langtools/tools/javac/records/reflection/RecordReflectionTest.java	Tue Jul 09 14:36:41 2019 -0400
@@ -37,11 +37,11 @@
 
     class NoRecord {}
 
-    record R1();
+    record R1() {}
 
-    record R2(int i, int j);
+    record R2(int i, int j) {}
 
-    record R3(List<String> ls);
+    record R3(List<String> ls) {}
 
     public static void main(String... args) throws Throwable {
         Class<?> noRecordClass = NoRecord.class;
--- a/test/langtools/tools/javac/records/writeread/Record.java	Thu Jun 27 20:51:33 2019 +0200
+++ b/test/langtools/tools/javac/records/writeread/Record.java	Tue Jul 09 14:36:41 2019 -0400
@@ -25,4 +25,4 @@
 
 import java.util.List;
 
-record Record1<T>(int i, int j, List<String> ls, List<T> lt);
+record Record1<T>(int i, int j, List<String> ls, List<T> lt) {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/sealed/AnonymousAndLambdaCantExtendSealed.java	Tue Jul 09 14:36:41 2019 -0400
@@ -0,0 +1,15 @@
+/*
+ * @test /nodynamiccopyright/
+ * @summary smoke test for sealed classes
+ * @compile/fail/ref=AnonymousAndLambdaCantExtendSealed.out -XDrawDiagnostics AnonymousAndLambdaCantExtendSealed.java
+ */
+
+class AnonymousAndLambdaCantExtendSealed {
+    sealed interface I1 extends Runnable {
+        public static I1 i = () -> {};
+    }
+
+    sealed interface I2 extends Runnable {
+        public static void foo() { new I2() { public void run() { } }; }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/sealed/AnonymousAndLambdaCantExtendSealed.out	Tue Jul 09 14:36:41 2019 -0400
@@ -0,0 +1,3 @@
+AnonymousAndLambdaCantExtendSealed.java:9:30: compiler.err.cant.inherit.from.sealed: AnonymousAndLambdaCantExtendSealed.I1
+AnonymousAndLambdaCantExtendSealed.java:13:40: compiler.err.cant.inherit.from.sealed: AnonymousAndLambdaCantExtendSealed.I2
+2 errors
--- a/test/langtools/tools/javac/sealed/NotSealedTest.java	Thu Jun 27 20:51:33 2019 +0200
+++ b/test/langtools/tools/javac/sealed/NotSealedTest.java	Tue Jul 09 14:36:41 2019 -0400
@@ -2,15 +2,19 @@
  * @test /nodynamiccopyright/
  * @summary smoke test for sealed classes
  * @compile/fail/ref=NotSealedTest.out -XDrawDiagnostics NotSealedTest.java
- * @ignore
  */
 
 import java.lang.annotation.*;
 
 class NotSealedTest {
-    @Sealed @NotSealed class AB {}
-    class NS {}
-    interface NSI {}
-    @NotSealed class SNS extends NS {}
-    @NotSealed class SNSI implements NSI {}
+    sealed class Super {}
+    sealed non-sealed class Sub extends Super {}
+
+    final sealed class Super2 {}
+
+    final non-sealed class Super3 {}
+
+    non-sealed class NoSealedSuper {}
+
+    sealed public void m() {}
 }
--- a/test/langtools/tools/javac/sealed/NotSealedTest.out	Thu Jun 27 20:51:33 2019 +0200
+++ b/test/langtools/tools/javac/sealed/NotSealedTest.out	Tue Jul 09 14:36:41 2019 -0400
@@ -1,6 +1,6 @@
-NotSealedTest.java:10:24: compiler.err.cant.applied.sealed.and.not.sealed.ann: NotSealedTest.AB
-NotSealedTest.java:10:24: compiler.warn.incorrect.application.of.not.sealed.ann: NotSealedTest.AB
-NotSealedTest.java:13:16: compiler.warn.incorrect.application.of.not.sealed.ann: NotSealedTest.SNS
-NotSealedTest.java:14:16: compiler.warn.incorrect.application.of.not.sealed.ann: NotSealedTest.SNSI
-1 error
-3 warnings
+NotSealedTest.java:11:23: compiler.err.illegal.combination.of.modifiers: sealed, non_sealed
+NotSealedTest.java:13:18: compiler.err.illegal.combination.of.modifiers: final, sealed
+NotSealedTest.java:15:22: compiler.err.illegal.combination.of.modifiers: final, non_sealed
+NotSealedTest.java:19:24: compiler.err.mod.not.allowed.here: sealed
+NotSealedTest.java:17:16: compiler.err.non.sealed.with.no.sealed.supertype
+5 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/sealed/PermitsInNoSealedClass.java	Tue Jul 09 14:36:41 2019 -0400
@@ -0,0 +1,13 @@
+/*
+ * @test /nodynamiccopyright/
+ * @summary smoke test for sealed classes
+ * @compile/fail/ref=PermitsInNoSealedClass.out -XDrawDiagnostics PermitsInNoSealedClass.java
+ */
+
+import java.lang.annotation.*;
+
+class PermitsInNoSealedClass {
+    class NotSealed permits Sub3 {}
+
+    class Sub3 extends NotSealed {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/sealed/PermitsInNoSealedClass.out	Tue Jul 09 14:36:41 2019 -0400
@@ -0,0 +1,2 @@
+PermitsInNoSealedClass.java:10:21: compiler.err.permits.in.no.sealed.class
+1 error