changeset 48127:f2e367b90111 datum

change keyword __datum to record and make record a context dependend keyword
author vromero
date Wed, 29 Nov 2017 14:29:08 -0500
parents eb4133a48ca2
children f39471b530ca
files src/java.base/share/classes/java/lang/AbstractRecord.java src/java.base/share/classes/java/lang/DataClass.java src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java src/jdk.compiler/share/classes/com/sun/tools/javac/parser/Tokens.java src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java src/jdk.jshell/share/classes/jdk/jshell/ReplParser.java test/langtools/jdk/jshell/CompletenessTest.java test/langtools/tools/javac/datum/CheckDatumMembersAccess.java test/langtools/tools/javac/datum/DataClassAsSuper.java test/langtools/tools/javac/datum/DataClassAsSuper.out test/langtools/tools/javac/datum/DataClassTest.java test/langtools/tools/javac/datum/DatumCanNotDeclaredFieldsWithSameName.java test/langtools/tools/javac/datum/DatumCanNotDeclaredFieldsWithSameName.out test/langtools/tools/javac/datum/DatumShouldDeclareAtLeastOneFieldTest.java test/langtools/tools/javac/datum/DatumShouldDeclareAtLeastOneFieldTest.out test/langtools/tools/javac/datum/Neg01.java test/langtools/tools/javac/datum/Neg01.out test/langtools/tools/javac/datum/NoAddFieldsCanBeDeclaredInDatumTest.java test/langtools/tools/javac/datum/NoAddFieldsCanBeDeclaredInDatumTest.out test/langtools/tools/javac/datum/Pos01.java test/langtools/tools/javac/datum/Pos02.java test/langtools/tools/javac/datum/SubDatumCannotPassDuplicateArgsToSuperTest.java test/langtools/tools/javac/datum/SubDatumCannotPassDuplicateArgsToSuperTest.out test/langtools/tools/javac/datum/SubDatumFieldsMustBeAPrefixOfParentTest.java test/langtools/tools/javac/datum/SubDatumFieldsMustBeAPrefixOfParentTest.out test/langtools/tools/javac/datum/UserDefinedMethodsTest.java
diffstat 40 files changed, 216 insertions(+), 190 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/java/lang/AbstractRecord.java	Wed Nov 29 14:29:08 2017 -0500
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, 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.
+ */
+
+package java.lang;
+
+import java.lang.annotation.Data;
+
+/**
+ * AbstractRecord
+ *
+ * @author Brian Goetz
+ */
+@Data
+public abstract class AbstractRecord {
+
+    @Override
+    public abstract int hashCode();
+
+    @Override
+    public abstract boolean equals(Object obj);
+
+    @Override
+    public abstract String toString();
+}
+
--- a/src/java.base/share/classes/java/lang/DataClass.java	Thu Nov 23 22:06:11 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2017, 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.
- */
-
-package java.lang;
-
-import java.lang.annotation.Data;
-
-/**
- * DataClass
- *
- * @author Brian Goetz
- */
-@Data
-public abstract class DataClass {
-
-    @Override
-    public abstract int hashCode();
-
-    @Override
-    public abstract boolean equals(Object obj);
-
-    @Override
-    public abstract String toString();
-}
-
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java	Wed Nov 29 14:29:08 2017 -0500
@@ -317,7 +317,7 @@
      * Flag to indicate that a class is a datum. The flag is also used to mark fields that are
      * part of the state vector of a datum class.
      */
-    public static final long DATUM = 1L<<58;
+    public static final long RECORD = 1L<<58;
 
     /**
      * Flag to indicate that a datum field is non-final.
@@ -439,7 +439,7 @@
         DEPRECATED_ANNOTATION(Flags.DEPRECATED_ANNOTATION),
         DEPRECATED_REMOVAL(Flags.DEPRECATED_REMOVAL),
         HAS_RESOURCE(Flags.HAS_RESOURCE),
-        DATUM(Flags.DATUM),
+        DATUM(Flags.RECORD),
         NON_FINAL(Flags.NON_FINAL);
 
         Flag(long flag) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java	Wed Nov 29 14:29:08 2017 -0500
@@ -228,6 +228,7 @@
     }
     public boolean allowPrivateInterfaceMethods() { return compareTo(JDK1_9) >= 0; }
     public boolean allowLocalVariableTypeInference() { return compareTo(JDK1_10) >= 0; }
+    public boolean allowRecord() { return compareTo(JDK1_10) >= 0; }
     public static SourceVersion toSourceVersion(Source source) {
         switch(source) {
         case JDK1_2:
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Wed Nov 29 14:29:08 2017 -0500
@@ -362,7 +362,7 @@
     }
 
     public boolean isDatum() {
-        return (flags_field & DATUM) != 0;
+        return (flags_field & RECORD) != 0;
     }
 
     public boolean hasDeprecatedAnnotation() {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java	Wed Nov 29 14:29:08 2017 -0500
@@ -158,7 +158,7 @@
     /** Predefined types.
      */
     public final Type objectType;
-    public final Type dataClassType;
+    public final Type abstractRecordType;
     public final Type dataAnnotationType;
     public final Type objectMethodBuildersType;
     public final Type objectsType;
@@ -485,7 +485,7 @@
 
         // Enter predefined classes. All are assumed to be in the java.base module.
         objectType = enterClass("java.lang.Object");
-        dataClassType = enterClass("java.lang.DataClass");
+        abstractRecordType = enterClass("java.lang.AbstractRecord");
         dataAnnotationType = enterClass("java.lang.annotation.Data");
         objectMethodBuildersType = enterClass("java.lang.invoke.ObjectMethodBuilders");
         objectsType = enterClass("java.util.Objects");
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Wed Nov 29 14:29:08 2017 -0500
@@ -1486,7 +1486,7 @@
         List<VarSymbol> vars = List.nil();
         while (!t.hasTag(NONE)) {
             if (t.hasTag(CLASS)) {
-                for (Symbol s : t.tsym.members().getSymbols(s -> s.kind == VAR && (s.flags() & DATUM) != 0)) {
+                for (Symbol s : t.tsym.members().getSymbols(s -> s.kind == VAR && (s.flags() & RECORD) != 0)) {
                     vars = vars.prepend((VarSymbol)s);
                 }
             }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Wed Nov 29 14:29:08 2017 -0500
@@ -4611,34 +4611,34 @@
                     env.info.isSerializable = true;
                 }
 
-                if ((c.flags() & DATUM) != 0) {
+                if ((c.flags() & RECORD) != 0) {
                     Type sup = types.supertype(c.type);
-                    List<JCVariableDecl> superFields = TreeInfo.superDatumFields(env.enclClass);
-                    if (sup.tsym != syms.dataClassType.tsym &&
-                            (sup.tsym.flags() & (ABSTRACT | DATUM)) != (ABSTRACT | DATUM)) {
-                        log.error(env.enclClass.extending.pos(), Errors.CantExtendDatum(Fragments.BadDatumSuper));
+                    List<JCVariableDecl> superFields = TreeInfo.superRecordFields(env.enclClass);
+                    if (sup.tsym != syms.abstractRecordType.tsym &&
+                            (sup.tsym.flags() & (ABSTRACT | RECORD)) != (ABSTRACT | RECORD)) {
+                        log.error(env.enclClass.extending.pos(), Errors.CantExtendRecord(Fragments.BadRecordSuper));
                     }
 
                     if (superFields.nonEmpty()) {
-                        if (c.members().findFirst(names.init, s -> (s.flags() & DATUM) == 0) != null) {
-                            log.error(env.enclClass.extending.pos(), Errors.CantExtendDatum(Fragments.BadSuperFields));
+                        if (c.members().findFirst(names.init, s -> (s.flags() & RECORD) == 0) != null) {
+                            log.error(env.enclClass.extending.pos(), Errors.CantExtendRecord(Fragments.BadSuperFields));
                         }
                     }
 
-                    List<VarSymbol> supDatumFields = types.datumVars(sup);
+                    List<VarSymbol> supRecordFields = types.datumVars(sup);
                     for (JCTree supField : superFields) {
                         JCVariableDecl supVarDecl = (JCVariableDecl)supField;
-                        if (supDatumFields.isEmpty()) break; //arity mismatches will be checked inside implicit constructor
-                        if (supDatumFields.head.name != supVarDecl.name ||
-                                !types.isSameType(supDatumFields.head.type, supVarDecl.vartype.type)) {
+                        if (supRecordFields.isEmpty()) break; //arity mismatches will be checked inside implicit constructor
+                        if (supRecordFields.head.name != supVarDecl.name ||
+                                !types.isSameType(supRecordFields.head.type, supVarDecl.vartype.type)) {
                             log.error(env.enclClass.extending.pos(),
-                                    Errors.CantExtendDatum(
+                                    Errors.CantExtendRecord(
                                             Fragments.SuperFieldMismatch(
-                                                    supDatumFields.head.type, supDatumFields.head.name,
+                                                    supRecordFields.head.type, supRecordFields.head.name,
                                                     supVarDecl.vartype.type, supVarDecl.name)));
                             break;
                         }
-                        supDatumFields = supDatumFields.tail;
+                        supRecordFields = supRecordFields.tail;
                     }
 
                     List<VarSymbol> vars = types.datumVars(c.type).stream()
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java	Wed Nov 29 14:29:08 2017 -0500
@@ -1886,7 +1886,7 @@
                     if (isInitialConstructor) {
                         boolean isSynthesized = (tree.sym.flags() &
                                                  GENERATEDCONSTR) != 0;
-                        boolean isDatum = (tree.sym.owner.flags() & Flags.DATUM) != 0;
+                        boolean isDatum = (tree.sym.owner.flags() & Flags.RECORD) != 0;
                         // skip datum as they are generated by the compiler and guaranteed to be correct
                         if (!isDatum || !isSynthesized) {
                             for (int i = firstadr; i < nextadr; i++) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java	Wed Nov 29 14:29:08 2017 -0500
@@ -2239,7 +2239,7 @@
             (types.supertype(currentClass.type).tsym.flags() & ENUM) == 0)
             visitEnumDef(tree);
 
-        if ((tree.mods.flags & (DATUM | ABSTRACT)) == DATUM) {
+        if ((tree.mods.flags & (RECORD | ABSTRACT)) == RECORD) {
             visitDatumDef(tree);
         }
 
@@ -2542,7 +2542,7 @@
                          names.toString,
                          tree.sym.type,
                          List.nil());
-        if ((msym.flags() & DATUM) != 0) {
+        if ((msym.flags() & RECORD) != 0) {
             Name bootstrapName = names.makeToString;
             Object[] staticArgsValues = new Object[2 + getterMethHandles.length];
             staticArgsValues[0] = tree.sym;
@@ -2579,7 +2579,7 @@
                          names.hashCode,
                          tree.sym.type,
                          List.nil());
-        if ((msym.flags() & DATUM) != 0) {
+        if ((msym.flags() & RECORD) != 0) {
             Name bootstrapName = names.makeHashCode;
             Object[] staticArgsValues = new Object[1 + getterMethHandles.length];
             staticArgsValues[0] = tree.sym;
@@ -2612,7 +2612,7 @@
                          tree.sym.type,
                          List.of(syms.objectType));
 
-        if ((msym.flags() & DATUM) != 0) {
+        if ((msym.flags() & RECORD) != 0) {
             Name bootstrapName = names.makeEquals;
             Object[] staticArgsValues = new Object[1 + getterMethHandles.length];
             staticArgsValues[0] = tree.sym;
@@ -2679,7 +2679,7 @@
                          names.toString,
                          tree.sym.type,
                          List.nil());
-        if ((toStringSym.flags() & DATUM) != 0) {
+        if ((toStringSym.flags() & RECORD) != 0) {
             String format = vars.stream()
                     .map(v -> v.name + "=%s")
                     .collect(Collectors.joining(", ", tree.name + "[", "]"));
@@ -2707,7 +2707,7 @@
                          names.hashCode,
                          tree.sym.type,
                          List.nil());
-        if ((hashCodeSym.flags() & DATUM) != 0) {
+        if ((hashCodeSym.flags() & RECORD) != 0) {
             JCFieldAccess meth = make.Select(make.Type(syms.objectsType), names.fromString("hash"));
             meth.sym = lookupMethod(tree.pos(),
                     meth.name,
@@ -2731,7 +2731,7 @@
                          tree.sym.type,
                          List.of(syms.objectType));
 
-        if ((oldEqualsSym.flags() & DATUM) != 0) {
+        if ((oldEqualsSym.flags() & RECORD) != 0) {
             ListBuffer<JCStatement> trueStats = new ListBuffer<>();
 
             VarSymbol o = oldEqualsSym.params.head;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Wed Nov 29 14:29:08 2017 -0500
@@ -292,7 +292,7 @@
                 v.setLazyConstValue(initEnv(tree, initEnv), attr, tree);
             }
         }
-        if ((v.flags_field & (HYPOTHETICAL | DATUM)) != (HYPOTHETICAL | DATUM) &&
+        if ((v.flags_field & (HYPOTHETICAL | RECORD)) != (HYPOTHETICAL | RECORD) &&
                 chk.checkUnique(tree.pos(), v, enclScope)) {
             chk.checkTransparentVar(tree.pos(), v, enclScope);
             enclScope.enter(v);
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java	Wed Nov 29 14:29:08 2017 -0500
@@ -685,8 +685,8 @@
                                   true, false, false)
                 : (sym.fullname == names.java_lang_Object)
                 ? Type.noType
-                : ((tree.mods.flags & Flags.DATUM) != 0)
-                ? syms.dataClassType
+                : ((tree.mods.flags & Flags.RECORD) != 0)
+                ? syms.abstractRecordType
                 : syms.objectType;
             }
             ct.supertype_field = modelMissingTypes(baseEnv, supertype, extending, false);
@@ -892,9 +892,9 @@
         protected void runPhase(Env<AttrContext> env) {
             JCClassDecl tree = env.enclClass;
             ClassSymbol sym = tree.sym;
-            if ((sym.flags_field & DATUM) != 0) {
+            if ((sym.flags_field & RECORD) != 0) {
                 memberEnter.memberEnter(TreeInfo.datumFields(tree), env);
-                memberEnter.memberEnter(TreeInfo.superDatumFields(tree), env);
+                memberEnter.memberEnter(TreeInfo.superRecordFields(tree), env);
             }
         }
     }
@@ -926,8 +926,8 @@
                             helper = null;
                         }
                     }
-                } else if ((sym.flags() & DATUM) != 0) {
-                    helper = new DatumConstructorHelper(sym, TreeInfo.datumFields(tree).map(vd -> vd.sym), TreeInfo.superDatumFields(tree));
+                } else if ((sym.flags() & RECORD) != 0) {
+                    helper = new DatumConstructorHelper(sym, TreeInfo.datumFields(tree).map(vd -> vd.sym), TreeInfo.superRecordFields(tree));
                 }
                 if (helper != null) {
                     JCTree constrDef = DefaultConstructor(make.at(tree.pos), helper);
@@ -966,10 +966,10 @@
                 (types.supertype(tree.sym.type).tsym.flags() & Flags.ENUM) == 0) {
                 addEnumMembers(tree, env);
             }
-            List<JCTree> defsToEnter = (tree.sym.flags_field & DATUM) != 0 ?
+            List<JCTree> defsToEnter = (tree.sym.flags_field & RECORD) != 0 ?
                     tree.defs.diff(List.convert(JCTree.class, TreeInfo.datumFields(tree))) : tree.defs;
             memberEnter.memberEnter(defsToEnter, env);
-            if ((tree.mods.flags & (DATUM | ABSTRACT)) == DATUM) {
+            if ((tree.mods.flags & (RECORD | ABSTRACT)) == RECORD) {
                 addDatumMembersIfNeeded(tree, env);
             }
 
@@ -1054,7 +1054,7 @@
 
                 // public String toString() { return ???; }
                 JCMethodDecl toString = make.
-                    MethodDef(make.Modifiers(Flags.PUBLIC | Flags.DATUM),
+                    MethodDef(make.Modifiers(Flags.PUBLIC | Flags.RECORD),
                               names.toString,
                               make.Type(syms.stringType),
                               List.nil(),
@@ -1068,7 +1068,7 @@
             if (lookupMethod(tree.sym, names.hashCode, List.nil()) == null) {
                 // public int hashCode() { return ???; }
                 JCMethodDecl hashCode = make.
-                    MethodDef(make.Modifiers(Flags.PUBLIC | Flags.DATUM),
+                    MethodDef(make.Modifiers(Flags.PUBLIC | Flags.RECORD),
                               names.hashCode,
                               make.Type(syms.intType),
                               List.nil(),
@@ -1082,7 +1082,7 @@
             if (lookupMethod(tree.sym, names.equals, List.of(syms.objectType)) == null) {
                 // public boolean equals(Object o) { return ???; }
                 JCMethodDecl equals = make.
-                    MethodDef(make.Modifiers(Flags.PUBLIC | Flags.DATUM),
+                    MethodDef(make.Modifiers(Flags.PUBLIC | Flags.RECORD),
                               names.equals,
                               make.Type(syms.booleanType),
                               List.nil(),
@@ -1271,7 +1271,7 @@
                 params.add(new VarSymbol(MANDATED | PARAMETER, p.name, p.type, csym));
             }
             csym.params = params.toList();
-            csym.flags_field |= DATUM | PUBLIC;
+            csym.flags_field |= RECORD | PUBLIC;
             return csym;
         }
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Wed Nov 29 14:29:08 2017 -0500
@@ -1579,7 +1579,7 @@
             for (int i = 0; i<numAttributes; i++) {
                 CompoundAnnotationProxy proxy = readCompoundAnnotation();
                 if (proxy.type.tsym == syms.dataAnnotationType.tsym) {
-                    sym.flags_field |= DATUM;
+                    sym.flags_field |= RECORD;
                 } else if (proxy.type.tsym == syms.proprietaryType.tsym)
                     sym.flags_field |= PROPRIETARY;
                 else if (proxy.type.tsym == syms.profileType.tsym) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Wed Nov 29 14:29:08 2017 -0500
@@ -91,7 +91,7 @@
     private Source source;
 
     /** The name table. */
-    private Names names;
+    protected Names names;
 
     /** End position mappings container */
     protected final AbstractEndPosTable endPosTable;
@@ -181,6 +181,7 @@
         this.allowUnderscoreIdentifier = source.allowUnderscoreIdentifier();
         this.allowPrivateInterfaceMethods = source.allowPrivateInterfaceMethods();
         this.allowLocalVariableTypeInference = source.allowLocalVariableTypeInference();
+        this.allowRecord = source.allowRecord();
         this.keepDocComments = keepDocComments;
         this.parseModuleInfo = parseModuleInfo;
         docComments = newDocCommentTable(keepDocComments, fac);
@@ -276,6 +277,10 @@
      */
     boolean allowLocalVariableTypeInference;
 
+    /** Switch: are records allowed?
+     */
+    public boolean allowRecord;
+
     /** The type of the method receiver, as specified by a first "this" parameter.
      */
     JCVariableDecl receiverParam;
@@ -439,13 +444,13 @@
     }
 
     protected JCErroneous syntaxError(int pos, String key, TokenKind... args) {
-        return syntaxError(pos, List.nil(), key, args);
+        return syntaxError(pos, List.nil(), key, (Object[])args);
     }
 
-    protected JCErroneous syntaxError(int pos, List<JCTree> errs, String key, TokenKind... args) {
+    protected JCErroneous syntaxError(int pos, List<JCTree> errs, String key, Object... args) {
         setErrorEndPos(pos);
         JCErroneous err = F.at(pos).Erroneous(errs);
-        reportSyntaxError(err, key, (Object[])args);
+        reportSyntaxError(err, key, args);
         if (errs != null) {
             JCTree last = errs.last();
             if (last != null)
@@ -2289,7 +2294,7 @@
         JCClassDecl body = null;
         if (token.kind == LBRACE) {
             int pos = token.pos;
-            List<JCTree> defs = classInterfaceOrDatumBody(names.empty, false, false);
+            List<JCTree> defs = classInterfaceOrRecordBody(names.empty, false, false);
             JCModifiers mods = F.at(Position.NOPOS).Modifiers(0);
             body = toP(F.at(pos).AnonymousClassDef(mods, defs));
         }
@@ -2448,7 +2453,7 @@
             if (token.kind == INTERFACE ||
                 token.kind == CLASS ||
                 token.kind == ENUM) {
-                return List.of(classOrDatumOrInterfaceOrEnumDeclaration(mods, dc));
+                return List.of(classOrRecordOrInterfaceOrEnumDeclaration(mods, dc));
             } else {
                 JCExpression t = parseType(true);
                 return localVariableDeclarations(mods, t);
@@ -2457,16 +2462,16 @@
         case ABSTRACT: case STRICTFP: {
             Comment dc = token.comment(CommentStyle.JAVADOC);
             JCModifiers mods = modifiersOpt();
-            return List.of(classOrDatumOrInterfaceOrEnumDeclaration(mods, dc));
+            return List.of(classOrRecordOrInterfaceOrEnumDeclaration(mods, dc));
         }
         case INTERFACE:
         case CLASS:
             Comment dc = token.comment(CommentStyle.JAVADOC);
-            return List.of(classOrDatumOrInterfaceOrEnumDeclaration(modifiersOpt(), dc));
+            return List.of(classOrRecordOrInterfaceOrEnumDeclaration(modifiersOpt(), dc));
         case ENUM:
             error(token.pos, "local.enum");
             dc = token.comment(CommentStyle.JAVADOC);
-            return List.of(classOrDatumOrInterfaceOrEnumDeclaration(modifiersOpt(), dc));
+            return List.of(classOrRecordOrInterfaceOrEnumDeclaration(modifiersOpt(), dc));
         default:
             Token prevToken = token;
             JCExpression t = term(EXPR | TYPE);
@@ -3419,7 +3424,7 @@
             nextToken();
             return toP(F.at(pos).Skip());
         } else {
-            return classOrDatumOrInterfaceOrEnumDeclaration(modifiersOpt(mods), docComment);
+            return classOrRecordOrInterfaceOrEnumDeclaration(modifiersOpt(mods), docComment);
         }
     }
 
@@ -3428,11 +3433,11 @@
      *  @param mods     Any modifiers starting the class or interface declaration
      *  @param dc       The documentation comment for the class, or null.
      */
-    protected JCStatement classOrDatumOrInterfaceOrEnumDeclaration(JCModifiers mods, Comment dc) {
+    protected JCStatement classOrRecordOrInterfaceOrEnumDeclaration(JCModifiers mods, Comment dc) {
         if (token.kind == CLASS) {
             return classDeclaration(mods, dc);
-        } if (token.kind == DATUM) {
-            return datumDeclaration(mods, dc);
+        } if (allowRecord && token.kind == IDENTIFIER && token.name() == names.record) {
+            return recordDeclaration(mods, dc);
         } else if (token.kind == INTERFACE) {
             return interfaceDeclaration(mods, dc);
         } else if (token.kind == ENUM) {
@@ -3450,7 +3455,7 @@
             if (parseModuleInfo) {
                 erroneousTree = syntaxError(pos, errs, "expected.module.or.open");
             } else {
-                erroneousTree = syntaxError(pos, errs, "expected4", CLASS, INTERFACE, ENUM, DATUM);
+                erroneousTree = syntaxError(pos, errs, "expected4", CLASS, INTERFACE, ENUM, names.record);
             }
             return toP(F.Exec(erroneousTree));
         }
@@ -3478,17 +3483,17 @@
             nextToken();
             implementing = typeList();
         }
-        List<JCTree> defs = classInterfaceOrDatumBody(name, false, false);
+        List<JCTree> defs = classInterfaceOrRecordBody(name, false, false);
         JCClassDecl result = toP(F.at(pos).ClassDef(
             mods, name, typarams, extending, implementing, defs));
         attach(result, dc);
         return result;
     }
 
-    protected JCClassDecl datumDeclaration(JCModifiers mods, Comment dc) {
+    protected JCClassDecl recordDeclaration(JCModifiers mods, Comment dc) {
         int pos = token.pos;
-        accept(DATUM);
-        mods.flags |= Flags.DATUM;
+        nextToken();
+        mods.flags |= Flags.RECORD;
         Name name = typeName();
 
         List<JCTypeParameter> typarams = typeParametersOpt();
@@ -3496,7 +3501,7 @@
         Map<Name, JCTree> optHeaderFields = headerFields(mods);
 
         if (optHeaderFields.size() == 0) {
-            log.error(token.pos, Errors.DatumMustDeclareAtLeastOneField);
+            log.error(token.pos, Errors.RecordMustDeclareAtLeastOneField);
         }
 
         JCExpression extending = null;
@@ -3527,7 +3532,7 @@
         }
         List<JCTree> defs = List.nil();
         if (token.kind == LBRACE) {
-            defs = classInterfaceOrDatumBody(name, false, true);
+            defs = classInterfaceOrRecordBody(name, false, true);
         } else {
             accept(SEMI);
         }
@@ -3564,7 +3569,7 @@
         Map<Name, JCTree> fields = new LinkedHashMap<>();
         while (token.kind != RPAREN) {
             JCModifiers mods = modifiersOpt();
-            mods.flags |= Flags.DATUM;
+            mods.flags |= Flags.RECORD;
             mods.flags |= (datumClassMods.flags & Flags.ABSTRACT) != 0 ? Flags.PROTECTED : 0;
             if ((mods.flags & Flags.NON_FINAL) == 0) {
                 mods.flags |= Flags.FINAL;
@@ -3576,7 +3581,7 @@
                 List<Pair<Accessors.Kind, Name>> accessors = List.of(new Pair<>(Accessors.Kind.GET, id));
                 fields.put(id, toP(F.at(pos).VarDef(mods, id, type, null, accessors)));
             } else {
-                log.error(pos, Errors.DatumCantDeclareDuplicateFields);
+                log.error(pos, Errors.RecordCantDeclareDuplicateFields);
             }
             if (token.kind == COMMA) {
                 nextToken();
@@ -3604,7 +3609,7 @@
             nextToken();
             extending = typeList();
         }
-        List<JCTree> defs = classInterfaceOrDatumBody(name, true, false);
+        List<JCTree> defs = classInterfaceOrRecordBody(name, true, false);
         JCClassDecl result = toP(F.at(pos).ClassDef(
             mods, name, typarams, null, extending, defs));
         attach(result, dc);
@@ -3692,7 +3697,7 @@
         JCClassDecl body = null;
         if (token.kind == LBRACE) {
             JCModifiers mods1 = F.at(Position.NOPOS).Modifiers(Flags.ENUM);
-            List<JCTree> defs = classInterfaceOrDatumBody(names.empty, false, false);
+            List<JCTree> defs = classInterfaceOrRecordBody(names.empty, false, false);
             body = toP(F.at(identPos).AnonymousClassDef(mods1, defs));
         }
         if (args.isEmpty() && body == null)
@@ -3722,7 +3727,7 @@
     /** ClassBody     = "{" {ClassBodyDeclaration} "}"
      *  InterfaceBody = "{" {InterfaceBodyDeclaration} "}"
      */
-    List<JCTree> classInterfaceOrDatumBody(Name className, boolean isInterface, boolean isDatum) {
+    List<JCTree> classInterfaceOrRecordBody(Name className, boolean isInterface, boolean isRecord) {
         accept(LBRACE);
         if (token.pos <= endPosTable.errorEndPos) {
             // error recovery
@@ -3732,7 +3737,7 @@
         }
         ListBuffer<JCTree> defs = new ListBuffer<>();
         while (token.kind != RBRACE && token.kind != EOF) {
-            if (!isDatum) {
+            if (!isRecord) {
                 defs.appendList(classOrInterfaceBodyDeclaration(className, isInterface));
             } else {
                 defs.appendList(datumBodyDeclaration(className));
@@ -3784,10 +3789,10 @@
             int pos = token.pos;
             JCModifiers mods = modifiersOpt();
             if (token.kind == CLASS ||
-                token.kind == DATUM ||
+                allowRecord && token.kind == IDENTIFIER && token.name() == names.record ||
                 token.kind == INTERFACE ||
                 token.kind == ENUM) {
-                return List.of(classOrDatumOrInterfaceOrEnumDeclaration(mods, dc));
+                return List.of(classOrRecordOrInterfaceOrEnumDeclaration(mods, dc));
             } else if (token.kind == LBRACE &&
                        (mods.flags & Flags.StandardFlags & ~Flags.STATIC) == 0 &&
                        mods.annotations.isEmpty()) {
@@ -3801,7 +3806,7 @@
         }
     }
 
-    private List<JCTree> methodOrFieldMemberDecl(Name className, JCModifiers mods, boolean isInterface, Comment dc, boolean isDatum) {
+    private List<JCTree> methodOrFieldMemberDecl(Name className, JCModifiers mods, boolean isInterface, Comment dc, boolean isRecord) {
         int pos = token.pos;
         List<JCTypeParameter> typarams = typeParametersOpt();
         // if there are type parameters but no modifiers, save the start
@@ -3846,7 +3851,7 @@
                     pos, mods, type, name, typarams,
                     isInterface, isVoid, dc));
             } else if (!isVoid && typarams.isEmpty()) {
-                if (!isDatum) {
+                if (!isRecord) {
                     List<JCTree> defs =
                         variableDeclaratorsRest(pos, mods, type, name, isInterface, dc,
                                                 new ListBuffer<JCTree>(), false).toList();
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/Tokens.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/Tokens.java	Wed Nov 29 14:29:08 2017 -0500
@@ -134,7 +134,7 @@
         ENUM("enum", Tag.NAMED),
         EXTENDS("extends"),
         FINAL("final"),
-        NON_FINAL("__nonfinal"),
+        NON_FINAL("non_final"),
         FINALLY("finally"),
         FLOAT("float", Tag.NAMED),
         FOR("for"),
@@ -152,7 +152,6 @@
         PRIVATE("private"),
         PROTECTED("protected"),
         PUBLIC("public"),
-        DATUM("__datum"),
         RETURN("return"),
         SHORT("short", Tag.NAMED),
         STATIC("static"),
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Nov 23 22:06:11 2017 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Wed Nov 29 14:29:08 2017 -0500
@@ -321,22 +321,22 @@
 compiler.err.duplicate.argument.to.super=\
     duplicate argument {0}, arguments passed to super of a data class must be unique
 
-compiler.err.datum.must.declare.at.least.one.field=\
-    data classes must declare at least one field
-
-compiler.err.datum.cant.declare.duplicate.fields=\
-    data classes cannot declare fields with the same name
-
-compiler.err.datum.can.only.declare.methods.as.members=\
-    data classes can only declare methods as members
+compiler.err.record.must.declare.at.least.one.field=\
+    records must declare at least one field
+
+compiler.err.record.cant.declare.duplicate.fields=\
+    records cannot declare fields with the same name
+
+compiler.err.record.can.only.declare.methods.as.members=\
+    records can only declare methods as members
 
 # 0: fragment
-compiler.err.cant.extend.datum=\
-    Illegal ''extends'' clause for data class\n\
+compiler.err.cant.extend.record=\
+    Illegal ''extends'' clause for record\n\
     {0}
 
-compiler.misc.bad.datum.super=\
-    A data class must extend DataClass or an ''abstract'' data class
+compiler.misc.bad.record.super=\
+    A record must extend class AbstractRecord or an ''abstract'' record
 
 # 0: type, 1: name, 2: type, 3: name
 compiler.misc.super.field.mismatch=\
@@ -2022,7 +2022,7 @@
 compiler.err.expected3=\
     {0}, {1}, or {2} expected
 
-# 0: token, 1: token, 2: token, 3: token
+# 0: token, 1: token, 2: token, 3: name
 compiler.err.expected4=\
     {0}, {1}, {2}, or {3} expected
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Wed Nov 29 14:29:08 2017 -0500
@@ -164,15 +164,15 @@
         return tree.defs.stream()
                 .filter(t -> t.hasTag(VARDEF))
                 .map(t -> (JCVariableDecl)t)
-                .filter(vd -> (vd.getModifiers().flags & (Flags.DATUM | HYPOTHETICAL)) == DATUM)
+                .filter(vd -> (vd.getModifiers().flags & (Flags.RECORD | HYPOTHETICAL)) == RECORD)
                 .collect(List.collector());
     }
 
-    public static List<JCVariableDecl> superDatumFields(JCClassDecl tree) {
+    public static List<JCVariableDecl> superRecordFields(JCClassDecl tree) {
         return tree.defs.stream()
                 .filter(t -> t.hasTag(VARDEF))
                 .map(t -> (JCVariableDecl)t)
-                .filter(vd -> (vd.getModifiers().flags & (Flags.DATUM | HYPOTHETICAL)) == (DATUM | HYPOTHETICAL))
+                .filter(vd -> (vd.getModifiers().flags & (Flags.RECORD | HYPOTHETICAL)) == (RECORD | HYPOTHETICAL))
                 .collect(List.collector());
     }
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java	Wed Nov 29 14:29:08 2017 -0500
@@ -211,6 +211,9 @@
     public final Name makeHashCode;
     public final Name makeToString;
 
+    // record related
+    public final Name record;
+
     public final Name.Table table;
 
     public Names(Context context) {
@@ -379,6 +382,7 @@
         makeEquals = fromString("makeEquals");
         makeHashCode = fromString("makeHashCode");
         makeToString = fromString("makeToString");
+        record = fromString("record");
     }
 
     protected Name.Table createTable(Options options) {
--- a/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java	Wed Nov 29 14:29:08 2017 -0500
@@ -35,21 +35,28 @@
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 import com.sun.tools.javac.util.Log;
+
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.util.ArrayDeque;
 import java.util.Deque;
 import java.util.EnumMap;
 import java.util.Iterator;
+
 import jdk.jshell.SourceCodeAnalysis.Completeness;
 import com.sun.source.tree.Tree;
+
 import static jdk.jshell.CompletenessAnalyzer.TK.*;
+
 import jdk.jshell.TaskFactory.ParseTask;
 import jdk.jshell.TaskFactory.Worker;
+
 import java.util.List;
 import java.util.function.Function;
 import java.util.function.Supplier;
 
+import com.sun.tools.javac.util.Names;
+
 /**
  * Low level scanner to determine completeness of input.
  * @author Robert Field
@@ -58,6 +65,7 @@
 
     private final ScannerFactory scannerFactory;
     private final JShell proc;
+    private final Names names;
 
     private static Completeness error() {
         return Completeness.UNKNOWN;  // For breakpointing
@@ -79,6 +87,7 @@
         Log log = CaLog.createLog(context);
         context.put(Log.class, log);
         context.put(Source.class, Source.JDK1_9);
+        names = Names.instance(context);
         scannerFactory = ScannerFactory.instance(context);
     }
 
@@ -86,6 +95,7 @@
         try {
             Parser parser = new Parser(
                     () -> new Matched(scannerFactory.newScanner(s, false)),
+                    names,
                     worker -> proc.taskFactory.parse(s, worker));
             Completeness stat = parser.parseUnit();
             int endPos = stat == Completeness.UNKNOWN
@@ -194,7 +204,7 @@
         IDENTIFIER(TokenKind.IDENTIFIER, XEXPR1|XDECL1|XTERM),  //
         UNDERSCORE(TokenKind.UNDERSCORE, XERRO),  //  _
         CLASS(TokenKind.CLASS, XEXPR|XDECL1|XBRACESNEEDED),  //  class decl (MAPPED: DOTCLASS)
-        DATUM(TokenKind.DATUM, XEXPR|XDECL1),  //  class decl (MAPPED: DOTCLASS)
+//        DATUM(TokenKind.RECORD, XEXPR|XDECL1),  //  class decl (MAPPED: DOTCLASS)
         MONKEYS_AT(TokenKind.MONKEYS_AT, XEXPR|XDECL1),  //  @
         IMPORT(TokenKind.IMPORT, XDECL1|XSTART),  //  import -- consider declaration
         SEMI(TokenKind.SEMI, XSTMT1|XTERM|XSTART),  //  ;
@@ -428,10 +438,13 @@
         /** The error message **/
         public final String message;
 
+        public final Token tok;
+
         private CT(TK tk, Token tok, String msg) {
             this.kind = tk;
             this.endPos = tok.endPos;
             this.message = msg;
+            this.tok = tok;
             //throw new InternalError(msg); /* for debugging */
         }
 
@@ -439,12 +452,14 @@
             this.kind = tk;
             this.endPos = tok.endPos;
             this.message = null;
+            this.tok = tok;
         }
 
         private CT(TK tk, int endPos) {
             this.kind = tk;
             this.endPos = endPos;
             this.message = null;
+            this.tok = null;
         }
     }
 
@@ -573,11 +588,14 @@
         private Matched in;
         private CT token;
         private Completeness checkResult;
+        private final Names names;
 
         Parser(Supplier<Matched> matchedFactory,
+               Names names,
                Function<Worker<ParseTask, Completeness>, Completeness> parseFactory) {
             this.matchedFactory = matchedFactory;
             this.parseFactory = parseFactory;
+            this.names = names;
             resetInput();
         }
 
@@ -663,7 +681,7 @@
             boolean isBracesNeeded = false;
             while (token.kind.isDeclaration()) {
                 isBracesNeeded |= token.kind.isBracesNeeded();
-                isDatum |= !afterModifiers && token.kind == DATUM;
+                isDatum |= !afterModifiers && token.kind == TK.IDENTIFIER && token.tok.name() == names.record;
                 afterModifiers |= !token.kind.isModifier();
                 nextToken();
             }
--- a/src/jdk.jshell/share/classes/jdk/jshell/ReplParser.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/src/jdk.jshell/share/classes/jdk/jshell/ReplParser.java	Wed Nov 29 14:29:08 2017 -0500
@@ -60,8 +60,7 @@
 import com.sun.tools.javac.util.Name;
 import com.sun.tools.javac.util.Position;
 
-import static com.sun.tools.javac.parser.Tokens.TokenKind.DATUM;
-
+import static com.sun.tools.javac.parser.Tokens.TokenKind.IDENTIFIER;
 /**
  * This is a subclass of JavacParser which overrides one method with a modified
  * verson of that method designed to allow parsing of one "snippet" of Java
@@ -182,10 +181,10 @@
             default:
                 JCModifiers mods = modifiersOpt(pmods);
                 if (token.kind == CLASS
-                        || token.kind == DATUM
+                        || allowRecord && token.kind == IDENTIFIER && token.name() == names.record
                         || token.kind == INTERFACE
                         || token.kind == ENUM) {
-                    return List.<JCTree>of(classOrDatumOrInterfaceOrEnumDeclaration(mods, dc));
+                    return List.<JCTree>of(classOrRecordOrInterfaceOrEnumDeclaration(mods, dc));
                 } else {
                     int pos = token.pos;
                     List<JCTypeParameter> typarams = typeParametersOpt();
--- a/test/langtools/jdk/jshell/CompletenessTest.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/test/langtools/jdk/jshell/CompletenessTest.java	Wed Nov 29 14:29:08 2017 -0500
@@ -122,8 +122,8 @@
         "int[] m = {1, 2}, n = null",
         "int[] m = {1, 2}, n",
         "int[] m = {1, 2}, n = {3, 4}",
-        "__datum D(int i)",
-        "static __datum D(int i)"
+        "record D(int i)",
+        "static record D(int i)"
     };
 
     static final String[] considered_incomplete = new String[] {
--- a/test/langtools/tools/javac/datum/CheckDatumMembersAccess.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/test/langtools/tools/javac/datum/CheckDatumMembersAccess.java	Wed Nov 29 14:29:08 2017 -0500
@@ -41,9 +41,9 @@
 
 public class CheckDatumMembersAccess {
 
-    abstract __datum abtractDatum(int AbstractFieldToSearchFor) {}
+    abstract record abtractDatum(int AbstractFieldToSearchFor) {}
 
-    __datum Datum(int AbstractFieldToSearchFor, int newField, __nonfinal int nonFinalField) {}
+    record Datum(int AbstractFieldToSearchFor, int newField, non_final int nonFinalField) {}
 
     public static void main(String args[]) throws Throwable {
         new CheckDatumMembersAccess().run();
--- a/test/langtools/tools/javac/datum/DataClassAsSuper.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/test/langtools/tools/javac/datum/DataClassAsSuper.java	Wed Nov 29 14:29:08 2017 -0500
@@ -7,10 +7,10 @@
 class DataClassAsSuper {
 
     // should extend DataClass or an abstract datum
-    __datum D1(int x) extends Object { }
+    record D1(int x) extends Object { }
 
-    __datum D2(int y) {}
+    record D2(int y) {}
 
     // D2 is datum but not abstract
-    __datum D3(int y, int x) extends D2(y) {}
+    record D3(int y, int x) extends D2(y) {}
 }
--- a/test/langtools/tools/javac/datum/DataClassAsSuper.out	Thu Nov 23 22:06:11 2017 +0100
+++ b/test/langtools/tools/javac/datum/DataClassAsSuper.out	Wed Nov 29 14:29:08 2017 -0500
@@ -1,3 +1,3 @@
-DataClassAsSuper.java:10:31: compiler.err.cant.extend.datum: (compiler.misc.bad.datum.super)
-DataClassAsSuper.java:15:38: compiler.err.cant.extend.datum: (compiler.misc.bad.datum.super)
+DataClassAsSuper.java:10:30: compiler.err.cant.extend.record: (compiler.misc.bad.record.super)
+DataClassAsSuper.java:15:37: compiler.err.cant.extend.record: (compiler.misc.bad.record.super)
 2 errors
--- a/test/langtools/tools/javac/datum/DataClassTest.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/test/langtools/tools/javac/datum/DataClassTest.java	Wed Nov 29 14:29:08 2017 -0500
@@ -93,7 +93,7 @@
     );
 
     static final String sourceTemplate =
-            "__datum Data(#{FT[0]} f0, #{FT[1]} f1) { }";
+            "record Data(#{FT[0]} f0, #{FT[1]} f1) { }";
 
     public static void main(String... args) throws Exception {
         new combo.ComboTestHelper<DataClassTest>()
--- a/test/langtools/tools/javac/datum/DatumCanNotDeclaredFieldsWithSameName.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/test/langtools/tools/javac/datum/DatumCanNotDeclaredFieldsWithSameName.java	Wed Nov 29 14:29:08 2017 -0500
@@ -5,5 +5,5 @@
  */
 
 public class DatumCanNotDeclaredFieldsWithSameName {
-    __datum D1(int x, int x) { }
+    record D1(int x, int x) { }
 }
--- a/test/langtools/tools/javac/datum/DatumCanNotDeclaredFieldsWithSameName.out	Thu Nov 23 22:06:11 2017 +0100
+++ b/test/langtools/tools/javac/datum/DatumCanNotDeclaredFieldsWithSameName.out	Wed Nov 29 14:29:08 2017 -0500
@@ -1,2 +1,2 @@
-DatumCanNotDeclaredFieldsWithSameName.java:8:27: compiler.err.datum.cant.declare.duplicate.fields
+DatumCanNotDeclaredFieldsWithSameName.java:8:26: compiler.err.record.cant.declare.duplicate.fields
 1 error
--- a/test/langtools/tools/javac/datum/DatumShouldDeclareAtLeastOneFieldTest.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/test/langtools/tools/javac/datum/DatumShouldDeclareAtLeastOneFieldTest.java	Wed Nov 29 14:29:08 2017 -0500
@@ -5,7 +5,7 @@
  */
 
 public class DatumShouldDeclareAtLeastOneFieldTest {
-    static abstract __datum D1() { }
+    static abstract record D1() { }
 
-    static __datum D2() { }
+    static record D2() { }
 }
--- a/test/langtools/tools/javac/datum/DatumShouldDeclareAtLeastOneFieldTest.out	Thu Nov 23 22:06:11 2017 +0100
+++ b/test/langtools/tools/javac/datum/DatumShouldDeclareAtLeastOneFieldTest.out	Wed Nov 29 14:29:08 2017 -0500
@@ -1,3 +1,3 @@
-DatumShouldDeclareAtLeastOneFieldTest.java:8:34: compiler.err.datum.must.declare.at.least.one.field
-DatumShouldDeclareAtLeastOneFieldTest.java:10:25: compiler.err.datum.must.declare.at.least.one.field
+DatumShouldDeclareAtLeastOneFieldTest.java:8:33: compiler.err.record.must.declare.at.least.one.field
+DatumShouldDeclareAtLeastOneFieldTest.java:10:24: compiler.err.record.must.declare.at.least.one.field
 2 errors
--- a/test/langtools/tools/javac/datum/Neg01.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/test/langtools/tools/javac/datum/Neg01.java	Wed Nov 29 14:29:08 2017 -0500
@@ -5,31 +5,31 @@
  */
 
 public class Neg01 {
-    static abstract __datum Sup1(int x, int y) { }
+    static abstract record Sup1(int x, int y) { }
 
-    __datum Bad1(int x, int y, int z) extends Sup1(x, y, z) { } //too many super args
+    record Bad1(int x, int y, int z) extends Sup1(x, y, z) { } //too many super args
 
-    __datum Bad2(int x, int z) extends Sup1(x) { } //too few super args
+    record Bad2(int x, int z) extends Sup1(x) { } //too few super args
 
-    __datum Bad3(int x, int z) extends Sup1(x, z) { } //name mismatch
+    record Bad3(int x, int z) extends Sup1(x, z) { } //name mismatch
 
-    __datum Bad4(int x, double y) extends Sup1(x, y) { } //type mismatch
+    record Bad4(int x, double y) extends Sup1(x, y) { } //type mismatch
 
-    __datum Bad5(int x, int y) extends Sup1(x, y) {
+    record Bad5(int x, int y) extends Sup1(x, y) {
         Bad5(int x, int y) { super(x, y); } //error: explicit constructor and super header
     }
 
     static class Sup2 { }
 
-    __datum Bad6(int x, int y) extends Object(x) { } //bad super header
+    record Bad6(int x, int y) extends Object(x) { } //bad super header
 
-    __datum Bad7(int x, int y) extends Sup2 { } //non-datum superclass
+    record Bad7(int x, int y) extends Sup2 { } //non-datum superclass
 
-    static __datum Sup3(int x, int y) { }
+    static record Sup3(int x, int y) { }
 
-    __datum Bad7(int x, int y) extends Sup2 { } //non-abstract datum superclass
+    record Bad7(int x, int y) extends Sup2 { } //non-abstract datum superclass
 
-    __datum Test(int x) {
+    record Test(int x) {
         Test(int x, int y) {
             default(); //too few
             default(x); //ok
--- a/test/langtools/tools/javac/datum/Neg01.out	Thu Nov 23 22:06:11 2017 +0100
+++ b/test/langtools/tools/javac/datum/Neg01.out	Wed Nov 29 14:29:08 2017 -0500
@@ -1,13 +1,13 @@
 Neg01.java:30:5: compiler.err.already.defined: kindname.class, Neg01.Bad7, kindname.class, Neg01
 Neg01.java:10:5: compiler.err.cant.apply.symbol: kindname.constructor, Sup1, int,int, int,int,int, kindname.class, Neg01.Sup1, (compiler.misc.arg.length.mismatch)
 Neg01.java:12:5: compiler.err.cant.apply.symbol: kindname.constructor, Sup1, int,int, int, kindname.class, Neg01.Sup1, (compiler.misc.arg.length.mismatch)
-Neg01.java:14:40: compiler.err.cant.extend.datum: (compiler.misc.super.field.mismatch: int, y, int, z)
-Neg01.java:16:43: compiler.err.cant.extend.datum: (compiler.misc.super.field.mismatch: int, y, double, y)
+Neg01.java:14:39: compiler.err.cant.extend.record: (compiler.misc.super.field.mismatch: int, y, int, z)
+Neg01.java:16:42: compiler.err.cant.extend.record: (compiler.misc.super.field.mismatch: int, y, double, y)
 Neg01.java:16:5: compiler.err.cant.apply.symbol: kindname.constructor, Sup1, int,int, int,double, kindname.class, Neg01.Sup1, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.possible.loss.of.precision: double, int))
-Neg01.java:18:40: compiler.err.cant.extend.datum: (compiler.misc.bad.super.fields)
-Neg01.java:24:40: compiler.err.cant.extend.datum: (compiler.misc.bad.datum.super)
+Neg01.java:18:39: compiler.err.cant.extend.record: (compiler.misc.bad.super.fields)
+Neg01.java:24:39: compiler.err.cant.extend.record: (compiler.misc.bad.record.super)
 Neg01.java:24:5: compiler.err.cant.apply.symbol: kindname.constructor, Object, compiler.misc.no.args, int, kindname.class, java.lang.Object, (compiler.misc.arg.length.mismatch)
-Neg01.java:26:40: compiler.err.cant.extend.datum: (compiler.misc.bad.datum.super)
+Neg01.java:26:39: compiler.err.cant.extend.record: (compiler.misc.bad.record.super)
 Neg01.java:34:20: compiler.err.cant.apply.symbol: kindname.constructor, Test, int, compiler.misc.no.args, kindname.class, Neg01.Test, (compiler.misc.arg.length.mismatch)
 Neg01.java:36:20: compiler.err.cant.apply.symbol: kindname.constructor, Test, int, int,int, kindname.class, Neg01.Test, (compiler.misc.arg.length.mismatch)
 Neg01.java:40:12: compiler.err.cant.resolve.location.args: kindname.method, default, , , (compiler.misc.location: kindname.class, Neg01.Test, null)
--- a/test/langtools/tools/javac/datum/NoAddFieldsCanBeDeclaredInDatumTest.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/test/langtools/tools/javac/datum/NoAddFieldsCanBeDeclaredInDatumTest.java	Wed Nov 29 14:29:08 2017 -0500
@@ -5,15 +5,15 @@
  */
 
 public class NoAddFieldsCanBeDeclaredInDatumTest {
-    __datum Bad1(int i) {
+    record Bad1(int i) {
         int y;
     }
 
-    __datum Bad2(int i) {
+    record Bad2(int i) {
         interface I {}
     }
 
-    __datum Bad3(int i) {
+    record Bad3(int i) {
         static {}
     }
 }
--- a/test/langtools/tools/javac/datum/NoAddFieldsCanBeDeclaredInDatumTest.out	Thu Nov 23 22:06:11 2017 +0100
+++ b/test/langtools/tools/javac/datum/NoAddFieldsCanBeDeclaredInDatumTest.out	Wed Nov 29 14:29:08 2017 -0500
@@ -3,5 +3,5 @@
 NoAddFieldsCanBeDeclaredInDatumTest.java:13:20: compiler.err.expected: token.identifier
 NoAddFieldsCanBeDeclaredInDatumTest.java:13:21: compiler.err.expected: '('
 NoAddFieldsCanBeDeclaredInDatumTest.java:17:16: compiler.err.illegal.start.of.type
-NoAddFieldsCanBeDeclaredInDatumTest.java:18:5: compiler.err.expected4: class, interface, enum, __datum
+NoAddFieldsCanBeDeclaredInDatumTest.java:18:5: compiler.err.expected4: class, interface, enum, record
 6 errors
--- a/test/langtools/tools/javac/datum/Pos01.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/test/langtools/tools/javac/datum/Pos01.java	Wed Nov 29 14:29:08 2017 -0500
@@ -39,9 +39,9 @@
         }
     }
 
-    static abstract __datum Sup(int x, int y) { }
+    static abstract record Sup(int x, int y) { }
 
-    static __datum Foo(int x, int y, public int z) extends Sup(x, y);
+    static record Foo(int x, int y, public int z) extends Sup(x, y);
 
     public static void main(String[] args) {
         Foo foo = new Foo(1, 2, 3);
--- a/test/langtools/tools/javac/datum/Pos02.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/test/langtools/tools/javac/datum/Pos02.java	Wed Nov 29 14:29:08 2017 -0500
@@ -30,7 +30,7 @@
  */
 
 class Pos02 {
-    static __datum Foo(final int x) {
+    static record Foo(final int x) {
         Foo(int x) {
             default(x);
         }
--- a/test/langtools/tools/javac/datum/SubDatumCannotPassDuplicateArgsToSuperTest.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/test/langtools/tools/javac/datum/SubDatumCannotPassDuplicateArgsToSuperTest.java	Wed Nov 29 14:29:08 2017 -0500
@@ -5,6 +5,6 @@
  */
 
 public class SubDatumCannotPassDuplicateArgsToSuperTest {
-    abstract __datum D1(int x, int y) { }
-    __datum D2(int x, int y, int z) extends D1(x, x) { }
+    abstract record D1(int x, int y) { }
+    record D2(int x, int y, int z) extends D1(x, x) { }
 }
--- a/test/langtools/tools/javac/datum/SubDatumCannotPassDuplicateArgsToSuperTest.out	Thu Nov 23 22:06:11 2017 +0100
+++ b/test/langtools/tools/javac/datum/SubDatumCannotPassDuplicateArgsToSuperTest.out	Wed Nov 29 14:29:08 2017 -0500
@@ -1,2 +1,2 @@
-SubDatumCannotPassDuplicateArgsToSuperTest.java:9:52: compiler.err.duplicate.argument.to.super: x
+SubDatumCannotPassDuplicateArgsToSuperTest.java:9:51: compiler.err.duplicate.argument.to.super: x
 1 error
--- a/test/langtools/tools/javac/datum/SubDatumFieldsMustBeAPrefixOfParentTest.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/test/langtools/tools/javac/datum/SubDatumFieldsMustBeAPrefixOfParentTest.java	Wed Nov 29 14:29:08 2017 -0500
@@ -5,6 +5,6 @@
  */
 
 public class SubDatumFieldsMustBeAPrefixOfParentTest {
-    abstract __datum D1(int x, int y) { }
-    __datum D2(int x, int y, int z) extends D1(y, x) { }
+    abstract record D1(int x, int y) { }
+    record D2(int x, int y, int z) extends D1(y, x) { }
 }
--- a/test/langtools/tools/javac/datum/SubDatumFieldsMustBeAPrefixOfParentTest.out	Thu Nov 23 22:06:11 2017 +0100
+++ b/test/langtools/tools/javac/datum/SubDatumFieldsMustBeAPrefixOfParentTest.out	Wed Nov 29 14:29:08 2017 -0500
@@ -1,2 +1,2 @@
-SubDatumFieldsMustBeAPrefixOfParentTest.java:9:45: compiler.err.cant.extend.datum: (compiler.misc.super.field.mismatch: int, x, int, y)
+SubDatumFieldsMustBeAPrefixOfParentTest.java:9:44: compiler.err.cant.extend.record: (compiler.misc.super.field.mismatch: int, x, int, y)
 1 error
--- a/test/langtools/tools/javac/datum/UserDefinedMethodsTest.java	Thu Nov 23 22:06:11 2017 +0100
+++ b/test/langtools/tools/javac/datum/UserDefinedMethodsTest.java	Wed Nov 29 14:29:08 2017 -0500
@@ -34,13 +34,13 @@
 
 public class UserDefinedMethodsTest {
 
-    static abstract __datum Sup(int x) {
+    static abstract record Sup(int x) {
         String foo() {
             return "Sup.foo";
         }
     }
 
-    static __datum Foo(int x, int y, public int z) extends Sup(x) {
+    static record Foo(int x, int y, public int z) extends Sup(x) {
         @Override
         public String toString() {
             return "Foo(x=#x, y=#y, z=#z)".replaceAll("#x", "" + x).replaceAll("#y", "" + y).replaceAll("#z", "" + z);