changeset 56895:76ea6cf6e40a records-and-sealed

compiler failing with unexpected kind: record
author vromero
date Fri, 21 Jun 2019 16:51:43 -0400
parents fe2ae6f104db
children 6f4f37689df0 4b162290687a
files src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java test/langtools/tools/javac/records/miscellaneous/UnexpectedKindRecordTest.java test/langtools/tools/javac/records/miscellaneous/UnexpectedKindRecordTest.out
diffstat 3 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java	Fri Jun 21 16:25:21 2019 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java	Fri Jun 21 16:51:43 2019 -0400
@@ -277,6 +277,7 @@
 
         case ANNOTATION_TYPE:
         case CLASS:
+        case RECORD:
             return KindName.CLASS;
 
         case INTERFACE:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/records/miscellaneous/UnexpectedKindRecordTest.java	Fri Jun 21 16:51:43 2019 -0400
@@ -0,0 +1,13 @@
+/*
+ * @test /nodynamiccopyright/
+ * @summary check that record is not used as a type name
+ * @compile/fail/ref=UnexpectedKindRecordTest.out -XDrawDiagnostics UnexpectedKindRecordTest.java
+ */
+
+class UnexpectedKindRecordTest {
+
+    record R(int i) {
+        public int i() { return i; }
+        public int i() { return i; }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/records/miscellaneous/UnexpectedKindRecordTest.out	Fri Jun 21 16:51:43 2019 -0400
@@ -0,0 +1,2 @@
+UnexpectedKindRecordTest.java:11:20: compiler.err.already.defined: kindname.method, i(), kindname.class, UnexpectedKindRecordTest.R
+1 error