changeset 57892:fd9176455f5e amber-demo-II

Automatic merge with records-and-sealed
author mcimadamore
date Tue, 08 Oct 2019 21:05:54 +0000
parents d37da910a3b6 af83845c7b3e
children 2a8a54468aae
files src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
diffstat 3 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Tue Oct 08 15:30:57 2019 +0000
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java	Tue Oct 08 21:05:54 2019 +0000
@@ -1765,6 +1765,11 @@
             }
             throw new AssertionError("record component without accessor");
         }
+
+        @Override @DefinedBy(Api.LANGUAGE_MODEL)
+        public <R, P> R accept(ElementVisitor<R, P> v, P p) {
+            return v.visitRecordComponent(this, p);
+        }
     }
 
     public static class ParamSymbol extends VarSymbol {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Tue Oct 08 15:30:57 2019 +0000
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Tue Oct 08 21:05:54 2019 +0000
@@ -2894,6 +2894,10 @@
                 rc.appendAttributes(s.getRawAttributes().stream().filter(anno ->
                     Arrays.stream(getTargetNames(anno.type.tsym)).anyMatch(name -> name == names.RECORD_COMPONENT)
                 ).collect(List.collector()));
+                rc.appendUniqueTypeAttributes(s.getRawTypeAttributes());
+                if (s.type.isAnnotated()) {
+                    rc.type = s.type.cloneWithMetadata(s.type.getMetadata());
+                }
             }
         }
 
--- a/test/langtools/tools/javac/records/annotations/CheckingTypeAnnotationsOnRecords.java	Tue Oct 08 15:30:57 2019 +0000
+++ b/test/langtools/tools/javac/records/annotations/CheckingTypeAnnotationsOnRecords.java	Tue Oct 08 21:05:54 2019 +0000
@@ -114,6 +114,12 @@
                 verifyAnnotations(e.getAnnotationMirrors(), expectedAnnotationName);
                 return null;
             }
+            @Override public Void visitRecordComponent(RecordComponentElement e, Void p) {
+                verifyTypeAcceptable(e.asType(), expectedAnnotationName);
+                scan(e.getEnclosedElements(), p);
+                verifyAnnotations(e.getAnnotationMirrors(), expectedAnnotationName);
+                return null;
+            }
         }.scan(rootElement, null);
     }