changeset 52925:89969d71c998 datum

allow records with no parameters
author vromero
date Mon, 29 Oct 2018 16:25:13 -0400
parents cb7760bcb5b5
children b1d6664ce434
files 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/datum/DatumShouldDeclareAtLeastOneFieldTest.java test/langtools/tools/javac/datum/DatumShouldDeclareAtLeastOneFieldTest.out
diffstat 4 files changed, 0 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Mon Oct 29 15:12:20 2018 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java	Mon Oct 29 16:25:13 2018 -0400
@@ -3657,10 +3657,6 @@
 
         Map<Name, JCVariableDecl> optHeaderFields = headerFields(mods);
 
-        if (optHeaderFields.isEmpty()) {
-            log.error(token.pos, Errors.RecordMustDeclareAtLeastOneField);
-        }
-
         List<JCExpression> implementing = List.nil();
         if (token.kind == IMPLEMENTS) {
             nextToken();
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Oct 29 15:12:20 2018 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Oct 29 16:25:13 2018 -0400
@@ -3343,9 +3343,6 @@
 compiler.err.record.cant.be.abstract=\
     records cannot be abstract
 
-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
 
--- a/test/langtools/tools/javac/datum/DatumShouldDeclareAtLeastOneFieldTest.java	Mon Oct 29 15:12:20 2018 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-/*
- * @test /nodynamiccopyright/
- * @summary smoke negative test for datum classes
- * @compile/fail/ref=DatumShouldDeclareAtLeastOneFieldTest.out -XDrawDiagnostics DatumShouldDeclareAtLeastOneFieldTest.java
- */
-
-public class DatumShouldDeclareAtLeastOneFieldTest {
-    record D1() { }
-
-    static record D2() { }
-}
--- a/test/langtools/tools/javac/datum/DatumShouldDeclareAtLeastOneFieldTest.out	Mon Oct 29 15:12:20 2018 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-DatumShouldDeclareAtLeastOneFieldTest.java:8:17: compiler.err.record.must.declare.at.least.one.field
-DatumShouldDeclareAtLeastOneFieldTest.java:10:24: compiler.err.record.must.declare.at.least.one.field
-2 errors