langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
changeset 24396 3c36c6afcbca
parent 24296 296e59a84663
child 24400 f05df7f58567
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri May 09 08:52:57 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri May 09 09:28:47 2014 -0400
@@ -1865,8 +1865,10 @@
                 return new ClassType(restype.getEnclosingType(),
                               List.<Type>of(new WildcardType(types.erasure(qualifierType),
                                                                BoundKind.EXTENDS,
-                                                               syms.boundClass)),
-                              restype.tsym);
+                                                             syms.boundClass,
+                                                             Type.noAnnotations)),
+                                     restype.tsym,
+                                     restype.getAnnotationMirrors());
             } else {
                 return restype;
             }
@@ -2036,7 +2038,8 @@
             } else if (TreeInfo.isDiamond(tree)) {
                 ClassType site = new ClassType(clazztype.getEnclosingType(),
                             clazztype.tsym.type.getTypeArguments(),
-                            clazztype.tsym);
+                                               clazztype.tsym,
+                                               clazztype.getAnnotationMirrors());
 
                 Env<AttrContext> diamondEnv = localEnv.dup(tree);
                 diamondEnv.info.selectSuper = cdef != null;
@@ -2255,7 +2258,8 @@
             owntype = elemtype;
             for (List<JCExpression> l = tree.dims; l.nonEmpty(); l = l.tail) {
                 attribExpr(l.head, localEnv, syms.intType);
-                owntype = new ArrayType(owntype, syms.arrayClass);
+                owntype = new ArrayType(owntype, syms.arrayClass,
+                                        Type.noAnnotations);
             }
         } else {
             // we are seeing an untyped aggregate { ... }
@@ -2272,7 +2276,8 @@
         }
         if (tree.elems != null) {
             attribExprs(tree.elems, localEnv, elemtype);
-            owntype = new ArrayType(elemtype, syms.arrayClass);
+            owntype = new ArrayType(elemtype, syms.arrayClass,
+                                    Type.noAnnotations);
         }
         if (!types.isReifiable(elemtype))
             log.error(tree.pos(), "generic.array.creation");
@@ -3244,7 +3249,7 @@
         if (skind == TYP) {
             Type elt = site;
             while (elt.hasTag(ARRAY))
-                elt = ((ArrayType)elt.unannotatedType()).elemtype;
+                elt = ((ArrayType)elt).elemtype;
             if (elt.hasTag(TYPEVAR)) {
                 log.error(tree.pos(), "type.var.cant.be.deref");
                 result = types.createErrorType(tree.type);
@@ -3557,7 +3562,8 @@
                             normOuter = types.erasure(ownOuter);
                         if (normOuter != ownOuter)
                             owntype = new ClassType(
-                                normOuter, List.<Type>nil(), owntype.tsym);
+                                normOuter, List.<Type>nil(), owntype.tsym,
+                                owntype.getAnnotationMirrors());
                     }
                 }
                 break;
@@ -3861,7 +3867,7 @@
 
     public void visitTypeArray(JCArrayTypeTree tree) {
         Type etype = attribType(tree.elemtype, env);
-        Type type = new ArrayType(etype, syms.arrayClass);
+        Type type = new ArrayType(etype, syms.arrayClass, Type.noAnnotations);
         result = check(tree, type, TYP, resultInfo);
     }
 
@@ -3909,7 +3915,8 @@
                         clazzOuter = site;
                     }
                 }
-                owntype = new ClassType(clazzOuter, actuals, clazztype.tsym);
+                owntype = new ClassType(clazzOuter, actuals, clazztype.tsym,
+                                        clazztype.getAnnotationMirrors());
             } else {
                 if (formals.length() != 0) {
                     log.error(tree.pos(), "wrong.number.type.args",
@@ -4060,7 +4067,8 @@
             : attribType(tree.inner, env);
         result = check(tree, new WildcardType(chk.checkRefType(tree.pos(), type),
                                               tree.kind.kind,
-                                              syms.boundClass),
+                                              syms.boundClass,
+                                              Type.noAnnotations),
                        TYP, resultInfo);
     }
 
@@ -4088,7 +4096,7 @@
             public void run() {
                 List<Attribute.TypeCompound> compounds = fromAnnotations(annotations);
                 Assert.check(annotations.size() == compounds.size());
-                    tree.type = tree.type.unannotatedType().annotatedType(compounds);
+                tree.type = tree.type.annotatedType(compounds);
                 }
         });
     }
@@ -4470,6 +4478,7 @@
             }
         }
         public void visitVarDef(final JCVariableDecl tree) {
+            //System.err.println("validateTypeAnnotations.visitVarDef " + tree);
             if (tree.sym != null && tree.sym.type != null)
                 validateAnnotatedType(tree.vartype, tree.sym.type);
             scan(tree.mods);
@@ -4512,6 +4521,7 @@
             super.visitNewArray(tree);
         }
         public void visitClassDef(JCClassDecl tree) {
+            //System.err.println("validateTypeAnnotations.visitClassDef " + tree);
             if (sigOnly) {
                 scan(tree.mods);
                 scan(tree.typarams);
@@ -4540,7 +4550,7 @@
          * can occur.
          */
         private void validateAnnotatedType(final JCTree errtree, final Type type) {
-            // System.out.println("Attr.validateAnnotatedType: " + errtree + " type: " + type);
+            //System.err.println("Attr.validateAnnotatedType: " + errtree + " type: " + type);
 
             if (type.isPrimitiveOrVoid()) {
                 return;
@@ -4578,8 +4588,7 @@
                     }
                 } else if (enclTr.hasTag(ANNOTATED_TYPE)) {
                     JCAnnotatedType at = (JCTree.JCAnnotatedType) enclTr;
-                    if (enclTy == null ||
-                            enclTy.hasTag(NONE)) {
+                    if (enclTy == null || enclTy.hasTag(NONE)) {
                         if (at.getAnnotations().size() == 1) {
                             log.error(at.underlyingType.pos(), "cant.type.annotate.scoping.1", at.getAnnotations().head.attribute);
                         } else {
@@ -4598,16 +4607,16 @@
                 } else if (enclTr.hasTag(JCTree.Tag.WILDCARD)) {
                     JCWildcard wc = (JCWildcard) enclTr;
                     if (wc.getKind() == JCTree.Kind.EXTENDS_WILDCARD) {
-                        validateAnnotatedType(wc.getBound(), ((WildcardType)enclTy.unannotatedType()).getExtendsBound());
+                        validateAnnotatedType(wc.getBound(), ((WildcardType)enclTy).getExtendsBound());
                     } else if (wc.getKind() == JCTree.Kind.SUPER_WILDCARD) {
-                        validateAnnotatedType(wc.getBound(), ((WildcardType)enclTy.unannotatedType()).getSuperBound());
+                        validateAnnotatedType(wc.getBound(), ((WildcardType)enclTy).getSuperBound());
                     } else {
                         // Nothing to do for UNBOUND
                     }
                     repeat = false;
                 } else if (enclTr.hasTag(TYPEARRAY)) {
                     JCArrayTypeTree art = (JCArrayTypeTree) enclTr;
-                    validateAnnotatedType(art.getType(), ((ArrayType)enclTy.unannotatedType()).getComponentType());
+                    validateAnnotatedType(art.getType(), ((ArrayType)enclTy).getComponentType());
                     repeat = false;
                 } else if (enclTr.hasTag(TYPEUNION)) {
                     JCTypeUnion ut = (JCTypeUnion) enclTr;