langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
changeset 31212 edf65e25e066
parent 31113 646511cb5873
child 31560 3a71b9271010
equal deleted inserted replaced
31119:d69c968463f0 31212:edf65e25e066
  4138         Assert.error("should be handled in annotate");
  4138         Assert.error("should be handled in annotate");
  4139     }
  4139     }
  4140 
  4140 
  4141     public void visitAnnotatedType(JCAnnotatedType tree) {
  4141     public void visitAnnotatedType(JCAnnotatedType tree) {
  4142         attribAnnotationTypes(tree.annotations, env);
  4142         attribAnnotationTypes(tree.annotations, env);
  4143         Type underlyingType = attribType(tree.underlyingType, env);
  4143         JCExpression underlyingTypeTree = tree.getUnderlyingType();
       
  4144         Type underlyingType = attribTree(underlyingTypeTree, env,
       
  4145                                                new ResultInfo(KindSelector.TYP_PCK, Type.noType));
       
  4146         if (!chk.checkAnnotableType(underlyingType, tree.annotations, underlyingTypeTree.pos())) {
       
  4147             underlyingType = underlyingTypeTree.type = syms.errType;
       
  4148         }
  4144         Type annotatedType = underlyingType.annotatedType(Annotations.TO_BE_SET);
  4149         Type annotatedType = underlyingType.annotatedType(Annotations.TO_BE_SET);
  4145 
  4150 
  4146         if (!env.info.isNewClass)
  4151         if (!env.info.isNewClass)
  4147             annotate.annotateTypeSecondStage(tree, tree.annotations, annotatedType);
  4152             annotate.annotateTypeSecondStage(tree, tree.annotations, annotatedType);
  4148         result = tree.type = annotatedType;
  4153         result = tree.type = annotatedType;
  4629                             !enclTy.hasTag(NONE)) {
  4634                             !enclTy.hasTag(NONE)) {
  4630                         enclTy = enclTy.getEnclosingType();
  4635                         enclTy = enclTy.getEnclosingType();
  4631                     }
  4636                     }
  4632                 } else if (enclTr.hasTag(ANNOTATED_TYPE)) {
  4637                 } else if (enclTr.hasTag(ANNOTATED_TYPE)) {
  4633                     JCAnnotatedType at = (JCTree.JCAnnotatedType) enclTr;
  4638                     JCAnnotatedType at = (JCTree.JCAnnotatedType) enclTr;
  4634                     if (enclTy == null || enclTy.hasTag(NONE)) {
  4639                     if (!chk.checkAnnotableType(enclTy, at.getAnnotations(), at.underlyingType.pos())) {
  4635                         if (at.getAnnotations().size() == 1) {
       
  4636                             log.error(at.underlyingType.pos(), "cant.type.annotate.scoping.1", at.getAnnotations().head.attribute);
       
  4637                         } else {
       
  4638                             ListBuffer<Attribute.Compound> comps = new ListBuffer<>();
       
  4639                             for (JCAnnotation an : at.getAnnotations()) {
       
  4640                                 comps.add(an.attribute);
       
  4641                             }
       
  4642                             log.error(at.underlyingType.pos(), "cant.type.annotate.scoping", comps.toList());
       
  4643                         }
       
  4644                         repeat = false;
  4640                         repeat = false;
  4645                     }
  4641                     }
  4646                     enclTr = at.underlyingType;
  4642                     enclTr = at.underlyingType;
  4647                     // enclTy doesn't need to be changed
  4643                     // enclTy doesn't need to be changed
  4648                 } else if (enclTr.hasTag(IDENT)) {
  4644                 } else if (enclTr.hasTag(IDENT)) {