Tue, 15 Oct 2013 15:57:13 -0700
8026564: import changes from type-annotations forest
Reviewed-by: jjg
Contributed-by: wdietl@gmail.com, steve.sides@oracle.com
1.1 --- a/make/build.properties Tue Oct 15 22:15:35 2013 +0200 1.2 +++ b/make/build.properties Tue Oct 15 15:57:13 2013 -0700 1.3 @@ -163,11 +163,11 @@ 1.4 # 1.5 1.6 sjavac.includes = \ 1.7 - com/sun/tools/sjavac/ 1.8 + com/sun/tools/sjavac/ 1.9 1.10 sjavac.tests = \ 1.11 tools/sjavac 1.12 - 1.13 + 1.14 # 1.15 1.16 # The following files require the latest JDK to be available.
2.1 --- a/make/build.xml Tue Oct 15 22:15:35 2013 +0200 2.2 +++ b/make/build.xml Tue Oct 15 15:57:13 2013 -0700 2.3 @@ -89,7 +89,7 @@ 2.4 build-classes-TOOL build the classes for the tool 2.5 build-TOOL build the jar file and script for the tool 2.6 jtreg-TOOL build the tool and run the appropriate tests 2.7 - findbugs-TOOL run findbugs on the tool's source oode 2.8 + findbugs-TOOL run findbugs on the tool's source code 2.9 TOOL build the tool, run the tests, and run findbugs 2.10 - utility definitions 2.11 -->
3.1 --- a/src/share/classes/com/sun/tools/javac/code/Attribute.java Tue Oct 15 22:15:35 2013 +0200 3.2 +++ b/src/share/classes/com/sun/tools/javac/code/Attribute.java Tue Oct 15 15:57:13 2013 -0700 3.3 @@ -236,6 +236,7 @@ 3.4 3.5 public static class TypeCompound extends Compound { 3.6 public TypeAnnotationPosition position; 3.7 + 3.8 public TypeCompound(Compound compound, 3.9 TypeAnnotationPosition position) { 3.10 this(compound.type, compound.values, position); 3.11 @@ -256,7 +257,7 @@ 3.12 } 3.13 3.14 public boolean hasUnknownPosition() { 3.15 - return position == null || position.type == TargetType.UNKNOWN; 3.16 + return position.type == TargetType.UNKNOWN; 3.17 } 3.18 3.19 public boolean isContainerTypeCompound() {
4.1 --- a/src/share/classes/com/sun/tools/javac/code/Printer.java Tue Oct 15 22:15:35 2013 +0200 4.2 +++ b/src/share/classes/com/sun/tools/javac/code/Printer.java Tue Oct 15 15:57:13 2013 -0700 4.3 @@ -260,24 +260,23 @@ 4.4 4.5 @Override 4.6 public String visitAnnotatedType(AnnotatedType t, Locale locale) { 4.7 - if (t.typeAnnotations != null && 4.8 - t.typeAnnotations.nonEmpty()) { 4.9 - if (t.underlyingType.hasTag(TypeTag.ARRAY)) { 4.10 + if (t.getAnnotationMirrors().nonEmpty()) { 4.11 + if (t.unannotatedType().hasTag(TypeTag.ARRAY)) { 4.12 StringBuilder res = new StringBuilder(); 4.13 printBaseElementType(t, res, locale); 4.14 printBrackets(t, res, locale); 4.15 return res.toString(); 4.16 - } else if (t.underlyingType.hasTag(TypeTag.CLASS) && 4.17 - t.underlyingType.getEnclosingType() != Type.noType) { 4.18 - return visit(t.underlyingType.getEnclosingType(), locale) + 4.19 + } else if (t.unannotatedType().hasTag(TypeTag.CLASS) && 4.20 + t.unannotatedType().getEnclosingType() != Type.noType) { 4.21 + return visit(t.unannotatedType().getEnclosingType(), locale) + 4.22 ". " + 4.23 - t.typeAnnotations + 4.24 - " " + className((ClassType)t.underlyingType, false, locale); 4.25 + t.getAnnotationMirrors() + 4.26 + " " + className((ClassType)t.unannotatedType(), false, locale); 4.27 } else { 4.28 - return t.typeAnnotations + " " + visit(t.underlyingType, locale); 4.29 + return t.getAnnotationMirrors() + " " + visit(t.unannotatedType(), locale); 4.30 } 4.31 } else { 4.32 - return visit(t.underlyingType, locale); 4.33 + return visit(t.unannotatedType(), locale); 4.34 } 4.35 } 4.36
5.1 --- a/src/share/classes/com/sun/tools/javac/code/SymbolMetadata.java Tue Oct 15 22:15:35 2013 +0200 5.2 +++ b/src/share/classes/com/sun/tools/javac/code/SymbolMetadata.java Tue Oct 15 15:57:13 2013 -0700 5.3 @@ -429,7 +429,7 @@ 5.4 super(on.type, List.<Pair<Symbol.MethodSymbol, Attribute>>nil(), 5.5 ctx.isTypeCompound ? 5.6 ((Attribute.TypeCompound)placeholderFor.head).position : 5.7 - null); 5.8 + new TypeAnnotationPosition()); 5.9 this.ctx = ctx; 5.10 this.placeholderFor = placeholderFor; 5.11 this.on = on;
6.1 --- a/src/share/classes/com/sun/tools/javac/code/Type.java Tue Oct 15 22:15:35 2013 +0200 6.2 +++ b/src/share/classes/com/sun/tools/javac/code/Type.java Tue Oct 15 15:57:13 2013 -0700 6.3 @@ -225,6 +225,10 @@ 6.4 return this; 6.5 } 6.6 6.7 + public Type annotatedType(List<Attribute.TypeCompound> annos) { 6.8 + return new AnnotatedType(annos, this); 6.9 + } 6.10 + 6.11 public boolean isAnnotated() { 6.12 return false; 6.13 } 6.14 @@ -1818,25 +1822,19 @@ 6.15 javax.lang.model.type.WildcardType { 6.16 /** The type annotations on this type. 6.17 */ 6.18 - public List<Attribute.TypeCompound> typeAnnotations; 6.19 + private List<Attribute.TypeCompound> typeAnnotations; 6.20 6.21 /** The underlying type that is annotated. 6.22 */ 6.23 - public Type underlyingType; 6.24 + private Type underlyingType; 6.25 6.26 - public AnnotatedType(Type underlyingType) { 6.27 - super(underlyingType.tsym); 6.28 - this.typeAnnotations = List.nil(); 6.29 - this.underlyingType = underlyingType; 6.30 - Assert.check(!underlyingType.isAnnotated(), 6.31 - "Can't annotate already annotated type: " + underlyingType); 6.32 - } 6.33 - 6.34 - public AnnotatedType(List<Attribute.TypeCompound> typeAnnotations, 6.35 + protected AnnotatedType(List<Attribute.TypeCompound> typeAnnotations, 6.36 Type underlyingType) { 6.37 super(underlyingType.tsym); 6.38 this.typeAnnotations = typeAnnotations; 6.39 this.underlyingType = underlyingType; 6.40 + Assert.check(typeAnnotations != null && typeAnnotations.nonEmpty(), 6.41 + "Can't create AnnotatedType without annotations: " + underlyingType); 6.42 Assert.check(!underlyingType.isAnnotated(), 6.43 "Can't annotate already annotated type: " + underlyingType + 6.44 "; adding: " + typeAnnotations); 6.45 @@ -1977,10 +1975,8 @@ 6.46 public TypeMirror getComponentType() { return ((ArrayType)underlyingType).getComponentType(); } 6.47 6.48 // The result is an ArrayType, but only in the model sense, not the Type sense. 6.49 - public AnnotatedType makeVarargs() { 6.50 - AnnotatedType atype = new AnnotatedType(((ArrayType)underlyingType).makeVarargs()); 6.51 - atype.typeAnnotations = this.typeAnnotations; 6.52 - return atype; 6.53 + public Type makeVarargs() { 6.54 + return ((ArrayType) underlyingType).makeVarargs().annotatedType(typeAnnotations); 6.55 } 6.56 6.57 @Override
7.1 --- a/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Tue Oct 15 22:15:35 2013 +0200 7.2 +++ b/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Tue Oct 15 15:57:13 2013 -0700 7.3 @@ -290,6 +290,7 @@ 7.4 List<Attribute.Compound> annotations = sym.getRawAttributes(); 7.5 ListBuffer<Attribute.Compound> declAnnos = new ListBuffer<Attribute.Compound>(); 7.6 ListBuffer<Attribute.TypeCompound> typeAnnos = new ListBuffer<Attribute.TypeCompound>(); 7.7 + ListBuffer<Attribute.TypeCompound> onlyTypeAnnos = new ListBuffer<Attribute.TypeCompound>(); 7.8 7.9 for (Attribute.Compound a : annotations) { 7.10 switch (annotationType(a, sym)) { 7.11 @@ -305,6 +306,8 @@ 7.12 case TYPE: { 7.13 Attribute.TypeCompound ta = toTypeCompound(a, pos); 7.14 typeAnnos.append(ta); 7.15 + // Also keep track which annotations are only type annotations 7.16 + onlyTypeAnnos.append(ta); 7.17 break; 7.18 } 7.19 } 7.20 @@ -328,7 +331,7 @@ 7.21 } 7.22 7.23 // type is non-null and annotations are added to that type 7.24 - type = typeWithAnnotations(typetree, type, typeAnnotations); 7.25 + type = typeWithAnnotations(typetree, type, typeAnnotations, onlyTypeAnnos.toList()); 7.26 7.27 if (sym.getKind() == ElementKind.METHOD) { 7.28 sym.type.asMethodType().restype = type; 7.29 @@ -380,32 +383,23 @@ 7.30 // As a side effect the method sets the type annotation position of "annotations". 7.31 // Note that it is assumed that all annotations share the same position. 7.32 private Type typeWithAnnotations(final JCTree typetree, final Type type, 7.33 - final List<Attribute.TypeCompound> annotations) { 7.34 - // System.out.printf("typeWithAnnotations(typetree: %s, type: %s, annotations: %s)%n", 7.35 - // typetree, type, annotations); 7.36 + final List<Attribute.TypeCompound> annotations, 7.37 + final List<Attribute.TypeCompound> onlyTypeAnnotations) { 7.38 + // System.out.printf("typeWithAnnotations(typetree: %s, type: %s, annotations: %s, onlyTypeAnnotations: %s)%n", 7.39 + // typetree, type, annotations, onlyTypeAnnotations); 7.40 if (annotations.isEmpty()) { 7.41 return type; 7.42 } 7.43 if (type.hasTag(TypeTag.ARRAY)) { 7.44 + Type.ArrayType arType = (Type.ArrayType) type.unannotatedType(); 7.45 + Type.ArrayType tomodify = new Type.ArrayType(null, arType.tsym); 7.46 Type toreturn; 7.47 - Type.ArrayType tomodify; 7.48 - Type.ArrayType arType; 7.49 - { 7.50 - Type touse = type; 7.51 - if (type.isAnnotated()) { 7.52 - Type.AnnotatedType atype = (Type.AnnotatedType)type; 7.53 - toreturn = new Type.AnnotatedType(atype.underlyingType); 7.54 - ((Type.AnnotatedType)toreturn).typeAnnotations = atype.typeAnnotations; 7.55 - touse = atype.underlyingType; 7.56 - arType = (Type.ArrayType) touse; 7.57 - tomodify = new Type.ArrayType(null, arType.tsym); 7.58 - ((Type.AnnotatedType)toreturn).underlyingType = tomodify; 7.59 - } else { 7.60 - arType = (Type.ArrayType) touse; 7.61 - tomodify = new Type.ArrayType(null, arType.tsym); 7.62 - toreturn = tomodify; 7.63 - } 7.64 + if (type.isAnnotated()) { 7.65 + toreturn = tomodify.annotatedType(type.getAnnotationMirrors()); 7.66 + } else { 7.67 + toreturn = tomodify; 7.68 } 7.69 + 7.70 JCArrayTypeTree arTree = arrayTypeTree(typetree); 7.71 7.72 ListBuffer<TypePathEntry> depth = new ListBuffer<>(); 7.73 @@ -413,12 +407,10 @@ 7.74 while (arType.elemtype.hasTag(TypeTag.ARRAY)) { 7.75 if (arType.elemtype.isAnnotated()) { 7.76 Type.AnnotatedType aelemtype = (Type.AnnotatedType) arType.elemtype; 7.77 - Type.AnnotatedType newAT = new Type.AnnotatedType(aelemtype.underlyingType); 7.78 - tomodify.elemtype = newAT; 7.79 - newAT.typeAnnotations = aelemtype.typeAnnotations; 7.80 - arType = (Type.ArrayType) aelemtype.underlyingType; 7.81 + arType = (Type.ArrayType) aelemtype.unannotatedType(); 7.82 + ArrayType prevToMod = tomodify; 7.83 tomodify = new Type.ArrayType(null, arType.tsym); 7.84 - newAT.underlyingType = tomodify; 7.85 + prevToMod.elemtype = (Type.AnnotatedType) tomodify.annotatedType(arType.elemtype.getAnnotationMirrors()); 7.86 } else { 7.87 arType = (Type.ArrayType) arType.elemtype; 7.88 tomodify.elemtype = new Type.ArrayType(null, arType.tsym); 7.89 @@ -427,7 +419,7 @@ 7.90 arTree = arrayTypeTree(arTree.elemtype); 7.91 depth = depth.append(TypePathEntry.ARRAY); 7.92 } 7.93 - Type arelemType = typeWithAnnotations(arTree.elemtype, arType.elemtype, annotations); 7.94 + Type arelemType = typeWithAnnotations(arTree.elemtype, arType.elemtype, annotations, onlyTypeAnnotations); 7.95 tomodify.elemtype = arelemType; 7.96 { 7.97 // All annotations share the same position; modify the first one. 7.98 @@ -444,7 +436,7 @@ 7.99 // There is a TypeKind, but no TypeTag. 7.100 JCTypeUnion tutree = (JCTypeUnion) typetree; 7.101 JCExpression fst = tutree.alternatives.get(0); 7.102 - Type res = typeWithAnnotations(fst, fst.type, annotations); 7.103 + Type res = typeWithAnnotations(fst, fst.type, annotations, onlyTypeAnnotations); 7.104 fst.type = res; 7.105 // TODO: do we want to set res as first element in uct.alternatives? 7.106 // UnionClassType uct = (com.sun.tools.javac.code.Type.UnionClassType)type; 7.107 @@ -483,14 +475,23 @@ 7.108 * but nothing more exists. 7.109 */ 7.110 if (enclTy != null && 7.111 - enclTy.getKind() == TypeKind.NONE && 7.112 - (enclTr.getKind() == JCTree.Kind.IDENTIFIER || 7.113 - enclTr.getKind() == JCTree.Kind.MEMBER_SELECT || 7.114 - enclTr.getKind() == JCTree.Kind.PARAMETERIZED_TYPE || 7.115 - enclTr.getKind() == JCTree.Kind.ANNOTATED_TYPE)) { 7.116 - // TODO: also if it's "java. @A lang.Object", that is, 7.117 - // if it's on a package? 7.118 - log.error(enclTr.pos(), "cant.annotate.nested.type", enclTr.toString()); 7.119 + enclTy.hasTag(TypeTag.NONE)) { 7.120 + switch (onlyTypeAnnotations.size()) { 7.121 + case 0: 7.122 + // Don't issue an error if all type annotations are 7.123 + // also declaration annotations. 7.124 + // If the annotations are also declaration annotations, they are 7.125 + // illegal as type annotations but might be legal as declaration annotations. 7.126 + // The normal declaration annotation checks make sure that the use is valid. 7.127 + break; 7.128 + case 1: 7.129 + log.error(typetree.pos(), "cant.type.annotate.scoping.1", 7.130 + onlyTypeAnnotations); 7.131 + break; 7.132 + default: 7.133 + log.error(typetree.pos(), "cant.type.annotate.scoping", 7.134 + onlyTypeAnnotations); 7.135 + } 7.136 return type; 7.137 } 7.138 7.139 @@ -569,7 +570,7 @@ 7.140 // assert that t.constValue() == null? 7.141 if (t == stopAt || 7.142 t.getEnclosingType() == Type.noType) { 7.143 - return new AnnotatedType(s, t); 7.144 + return t.annotatedType(s); 7.145 } else { 7.146 ClassType ret = new ClassType(t.getEnclosingType().accept(this, s), 7.147 t.typarams_field, t.tsym); 7.148 @@ -584,12 +585,12 @@ 7.149 7.150 @Override 7.151 public Type visitAnnotatedType(AnnotatedType t, List<TypeCompound> s) { 7.152 - return new AnnotatedType(t.typeAnnotations, t.underlyingType.accept(this, s)); 7.153 + return t.unannotatedType().accept(this, s).annotatedType(t.getAnnotationMirrors()); 7.154 } 7.155 7.156 @Override 7.157 public Type visitWildcardType(WildcardType t, List<TypeCompound> s) { 7.158 - return new AnnotatedType(s, t); 7.159 + return t.annotatedType(s); 7.160 } 7.161 7.162 @Override 7.163 @@ -612,12 +613,12 @@ 7.164 7.165 @Override 7.166 public Type visitTypeVar(TypeVar t, List<TypeCompound> s) { 7.167 - return new AnnotatedType(s, t); 7.168 + return t.annotatedType(s); 7.169 } 7.170 7.171 @Override 7.172 public Type visitCapturedType(CapturedType t, List<TypeCompound> s) { 7.173 - return new AnnotatedType(s, t); 7.174 + return t.annotatedType(s); 7.175 } 7.176 7.177 @Override 7.178 @@ -634,12 +635,12 @@ 7.179 7.180 @Override 7.181 public Type visitErrorType(ErrorType t, List<TypeCompound> s) { 7.182 - return new AnnotatedType(s, t); 7.183 + return t.annotatedType(s); 7.184 } 7.185 7.186 @Override 7.187 public Type visitType(Type t, List<TypeCompound> s) { 7.188 - return new AnnotatedType(s, t); 7.189 + return t.annotatedType(s); 7.190 } 7.191 }; 7.192
8.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java Tue Oct 15 22:15:35 2013 +0200 8.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java Tue Oct 15 15:57:13 2013 -0700 8.3 @@ -1273,7 +1273,7 @@ 8.4 return false; 8.5 if (!s.getAnnotationMirrors().containsAll(t.getAnnotationMirrors())) 8.6 return false; 8.7 - return visit(t.underlyingType, s); 8.8 + return visit(t.unannotatedType(), s); 8.9 } 8.10 }; 8.11 // </editor-fold> 8.12 @@ -2217,15 +2217,15 @@ 8.13 8.14 @Override 8.15 public Type visitAnnotatedType(AnnotatedType t, Boolean recurse) { 8.16 - Type erased = erasure(t.underlyingType, recurse); 8.17 + Type erased = erasure(t.unannotatedType(), recurse); 8.18 if (erased.isAnnotated()) { 8.19 // This can only happen when the underlying type is a 8.20 // type variable and the upper bound of it is annotated. 8.21 // The annotation on the type variable overrides the one 8.22 // on the bound. 8.23 - erased = ((AnnotatedType)erased).underlyingType; 8.24 + erased = ((AnnotatedType)erased).unannotatedType(); 8.25 } 8.26 - return new AnnotatedType(t.typeAnnotations, erased); 8.27 + return erased.annotatedType(t.getAnnotationMirrors()); 8.28 } 8.29 }; 8.30 8.31 @@ -4419,7 +4419,7 @@ 8.32 public R visitUndetVar(UndetVar t, S s) { return visitType(t, s); } 8.33 public R visitErrorType(ErrorType t, S s) { return visitType(t, s); } 8.34 // Pretend annotations don't exist 8.35 - public R visitAnnotatedType(AnnotatedType t, S s) { return visit(t.underlyingType, s); } 8.36 + public R visitAnnotatedType(AnnotatedType t, S s) { return visit(t.unannotatedType(), s); } 8.37 } 8.38 8.39 /**
9.1 --- a/src/share/classes/com/sun/tools/javac/comp/Annotate.java Tue Oct 15 22:15:35 2013 +0200 9.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Annotate.java Tue Oct 15 15:57:13 2013 -0700 9.3 @@ -250,7 +250,8 @@ 9.4 a.type = chk.checkType(a.annotationType.pos(), at, expected); 9.5 if (a.type.isErroneous()) { 9.6 if (typeAnnotation) { 9.7 - return new Attribute.TypeCompound(a.type, List.<Pair<MethodSymbol,Attribute>>nil(), null); 9.8 + return new Attribute.TypeCompound(a.type, List.<Pair<MethodSymbol,Attribute>>nil(), 9.9 + new TypeAnnotationPosition()); 9.10 } else { 9.11 return new Attribute.Compound(a.type, List.<Pair<MethodSymbol,Attribute>>nil()); 9.12 }
10.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Tue Oct 15 22:15:35 2013 +0200 10.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Tue Oct 15 15:57:13 2013 -0700 10.3 @@ -3534,15 +3534,6 @@ 10.4 Type normOuter = site; 10.5 if (normOuter.hasTag(CLASS)) { 10.6 normOuter = types.asEnclosingSuper(site, ownOuter.tsym); 10.7 - if (site.isAnnotated()) { 10.8 - // Propagate any type annotations. 10.9 - // TODO: should asEnclosingSuper do this? 10.10 - // Note that the type annotations in site will be updated 10.11 - // by annotateType. Therefore, modify site instead 10.12 - // of creating a new AnnotatedType. 10.13 - ((AnnotatedType)site).underlyingType = normOuter; 10.14 - normOuter = site; 10.15 - } 10.16 } 10.17 if (normOuter == null) // perhaps from an import 10.18 normOuter = types.erasure(ownOuter); 10.19 @@ -3901,12 +3892,6 @@ 10.20 } 10.21 } 10.22 owntype = new ClassType(clazzOuter, actuals, clazztype.tsym); 10.23 - if (clazztype.isAnnotated()) { 10.24 - // Use the same AnnotatedType, because it will have 10.25 - // its annotations set later. 10.26 - ((AnnotatedType)clazztype).underlyingType = owntype; 10.27 - owntype = clazztype; 10.28 - } 10.29 } else { 10.30 if (formals.length() != 0) { 10.31 log.error(tree.pos(), "wrong.number.type.args", 10.32 @@ -3972,9 +3957,7 @@ 10.33 TypeVar typeVar = (TypeVar) tree.type; 10.34 10.35 if (tree.annotations != null && tree.annotations.nonEmpty()) { 10.36 - AnnotatedType antype = new AnnotatedType(typeVar); 10.37 - annotateType(antype, tree.annotations); 10.38 - tree.type = antype; 10.39 + annotateType(tree, tree.annotations); 10.40 } 10.41 10.42 if (!typeVar.bound.isErroneous()) { 10.43 @@ -4074,26 +4057,28 @@ 10.44 public void visitAnnotatedType(JCAnnotatedType tree) { 10.45 Type underlyingType = attribType(tree.getUnderlyingType(), env); 10.46 this.attribAnnotationTypes(tree.annotations, env); 10.47 - AnnotatedType antype = new AnnotatedType(underlyingType); 10.48 - annotateType(antype, tree.annotations); 10.49 - result = tree.type = antype; 10.50 + annotateType(tree, tree.annotations); 10.51 + result = tree.type = underlyingType; 10.52 } 10.53 10.54 /** 10.55 * Apply the annotations to the particular type. 10.56 */ 10.57 - public void annotateType(final AnnotatedType type, final List<JCAnnotation> annotations) { 10.58 - if (annotations.isEmpty()) 10.59 - return; 10.60 + public void annotateType(final JCTree tree, final List<JCAnnotation> annotations) { 10.61 + // Callers ensure this. 10.62 + // Assert.check(annotations != null && annotations.nonEmpty()); 10.63 annotate.typeAnnotation(new Annotate.Worker() { 10.64 @Override 10.65 public String toString() { 10.66 - return "annotate " + annotations + " onto " + type; 10.67 + return "annotate " + annotations + " onto " + tree; 10.68 } 10.69 @Override 10.70 public void run() { 10.71 List<Attribute.TypeCompound> compounds = fromAnnotations(annotations); 10.72 - type.typeAnnotations = compounds; 10.73 + if (annotations.size() == compounds.size()) { 10.74 + // All annotations were successfully converted into compounds 10.75 + tree.type = tree.type.unannotatedType().annotatedType(compounds); 10.76 + } 10.77 } 10.78 }); 10.79 } 10.80 @@ -4432,17 +4417,18 @@ 10.81 private final class TypeAnnotationsValidator extends TreeScanner { 10.82 10.83 private final boolean sigOnly; 10.84 - private boolean checkAllAnnotations = false; 10.85 - 10.86 public TypeAnnotationsValidator(boolean sigOnly) { 10.87 this.sigOnly = sigOnly; 10.88 } 10.89 10.90 public void visitAnnotation(JCAnnotation tree) { 10.91 - if (tree.hasTag(TYPE_ANNOTATION) || checkAllAnnotations) { 10.92 - chk.validateTypeAnnotation(tree, false); 10.93 + chk.validateTypeAnnotation(tree, false); 10.94 + super.visitAnnotation(tree); 10.95 + } 10.96 + public void visitAnnotatedType(JCAnnotatedType tree) { 10.97 + if (!tree.underlyingType.type.isErroneous()) { 10.98 + super.visitAnnotatedType(tree); 10.99 } 10.100 - super.visitAnnotation(tree); 10.101 } 10.102 public void visitTypeParameter(JCTypeParameter tree) { 10.103 chk.validateTypeAnnotations(tree.annotations, true); 10.104 @@ -4475,7 +4461,7 @@ 10.105 } 10.106 public void visitVarDef(final JCVariableDecl tree) { 10.107 if (tree.sym != null && tree.sym.type != null) 10.108 - validateAnnotatedType(tree, tree.sym.type); 10.109 + validateAnnotatedType(tree.vartype, tree.sym.type); 10.110 scan(tree.mods); 10.111 scan(tree.vartype); 10.112 if (!sigOnly) { 10.113 @@ -4493,27 +4479,13 @@ 10.114 super.visitTypeTest(tree); 10.115 } 10.116 public void visitNewClass(JCNewClass tree) { 10.117 - if (tree.clazz.hasTag(ANNOTATED_TYPE)) { 10.118 - boolean prevCheck = this.checkAllAnnotations; 10.119 - try { 10.120 - this.checkAllAnnotations = true; 10.121 - scan(((JCAnnotatedType)tree.clazz).annotations); 10.122 - } finally { 10.123 - this.checkAllAnnotations = prevCheck; 10.124 - } 10.125 - } 10.126 + if (tree.clazz.type != null) 10.127 + validateAnnotatedType(tree.clazz, tree.clazz.type); 10.128 super.visitNewClass(tree); 10.129 } 10.130 public void visitNewArray(JCNewArray tree) { 10.131 - if (tree.elemtype != null && tree.elemtype.hasTag(ANNOTATED_TYPE)) { 10.132 - boolean prevCheck = this.checkAllAnnotations; 10.133 - try { 10.134 - this.checkAllAnnotations = true; 10.135 - scan(((JCAnnotatedType)tree.elemtype).annotations); 10.136 - } finally { 10.137 - this.checkAllAnnotations = prevCheck; 10.138 - } 10.139 - } 10.140 + if (tree.elemtype != null && tree.elemtype.type != null) 10.141 + validateAnnotatedType(tree.elemtype, tree.elemtype.type); 10.142 super.visitNewArray(tree); 10.143 } 10.144 10.145 @@ -4549,21 +4521,95 @@ 10.146 * can occur. 10.147 */ 10.148 private void validateAnnotatedType(final JCTree errtree, final Type type) { 10.149 - if (type.getEnclosingType() != null && 10.150 - type != type.getEnclosingType()) { 10.151 - validateEnclosingAnnotatedType(errtree, type.getEnclosingType()); 10.152 + // System.out.println("Attr.validateAnnotatedType: " + errtree + " type: " + type); 10.153 + 10.154 + if (type.isPrimitiveOrVoid()) { 10.155 + return; 10.156 } 10.157 - for (Type targ : type.getTypeArguments()) { 10.158 - validateAnnotatedType(errtree, targ); 10.159 - } 10.160 - } 10.161 - private void validateEnclosingAnnotatedType(final JCTree errtree, final Type type) { 10.162 - validateAnnotatedType(errtree, type); 10.163 - if (type.tsym != null && 10.164 - type.tsym.isStatic() && 10.165 - type.getAnnotationMirrors().nonEmpty()) { 10.166 - // Enclosing static classes cannot have type annotations. 10.167 - log.error(errtree.pos(), "cant.annotate.static.class"); 10.168 + 10.169 + JCTree enclTr = errtree; 10.170 + Type enclTy = type; 10.171 + 10.172 + boolean repeat = true; 10.173 + while (repeat) { 10.174 + if (enclTr.hasTag(TYPEAPPLY)) { 10.175 + List<Type> tyargs = enclTy.getTypeArguments(); 10.176 + List<JCExpression> trargs = ((JCTypeApply)enclTr).getTypeArguments(); 10.177 + if (trargs.length() > 0) { 10.178 + // Nothing to do for diamonds 10.179 + if (tyargs.length() == trargs.length()) { 10.180 + for (int i = 0; i < tyargs.length(); ++i) { 10.181 + validateAnnotatedType(trargs.get(i), tyargs.get(i)); 10.182 + } 10.183 + } 10.184 + // If the lengths don't match, it's either a diamond 10.185 + // or some nested type that redundantly provides 10.186 + // type arguments in the tree. 10.187 + } 10.188 + 10.189 + // Look at the clazz part of a generic type 10.190 + enclTr = ((JCTree.JCTypeApply)enclTr).clazz; 10.191 + } 10.192 + 10.193 + if (enclTr.hasTag(SELECT)) { 10.194 + enclTr = ((JCTree.JCFieldAccess)enclTr).getExpression(); 10.195 + if (enclTy != null && 10.196 + !enclTy.hasTag(NONE)) { 10.197 + enclTy = enclTy.getEnclosingType(); 10.198 + } 10.199 + } else if (enclTr.hasTag(ANNOTATED_TYPE)) { 10.200 + JCAnnotatedType at = (JCTree.JCAnnotatedType) enclTr; 10.201 + if (enclTy == null || 10.202 + enclTy.hasTag(NONE)) { 10.203 + if (at.getAnnotations().size() == 1) { 10.204 + log.error(at.underlyingType.pos(), "cant.type.annotate.scoping.1", at.getAnnotations().head.attribute); 10.205 + } else { 10.206 + ListBuffer<Attribute.Compound> comps = new ListBuffer<Attribute.Compound>(); 10.207 + for (JCAnnotation an : at.getAnnotations()) { 10.208 + comps.add(an.attribute); 10.209 + } 10.210 + log.error(at.underlyingType.pos(), "cant.type.annotate.scoping", comps.toList()); 10.211 + } 10.212 + repeat = false; 10.213 + } 10.214 + enclTr = at.underlyingType; 10.215 + // enclTy doesn't need to be changed 10.216 + } else if (enclTr.hasTag(IDENT)) { 10.217 + repeat = false; 10.218 + } else if (enclTr.hasTag(JCTree.Tag.WILDCARD)) { 10.219 + JCWildcard wc = (JCWildcard) enclTr; 10.220 + if (wc.getKind() == JCTree.Kind.EXTENDS_WILDCARD) { 10.221 + validateAnnotatedType(wc.getBound(), ((WildcardType)enclTy.unannotatedType()).getExtendsBound()); 10.222 + } else if (wc.getKind() == JCTree.Kind.SUPER_WILDCARD) { 10.223 + validateAnnotatedType(wc.getBound(), ((WildcardType)enclTy.unannotatedType()).getSuperBound()); 10.224 + } else { 10.225 + // Nothing to do for UNBOUND 10.226 + } 10.227 + repeat = false; 10.228 + } else if (enclTr.hasTag(TYPEARRAY)) { 10.229 + JCArrayTypeTree art = (JCArrayTypeTree) enclTr; 10.230 + validateAnnotatedType(art.getType(), ((ArrayType)enclTy.unannotatedType()).getComponentType()); 10.231 + repeat = false; 10.232 + } else if (enclTr.hasTag(TYPEUNION)) { 10.233 + JCTypeUnion ut = (JCTypeUnion) enclTr; 10.234 + for (JCTree t : ut.getTypeAlternatives()) { 10.235 + validateAnnotatedType(t, t.type); 10.236 + } 10.237 + repeat = false; 10.238 + } else if (enclTr.hasTag(TYPEINTERSECTION)) { 10.239 + JCTypeIntersection it = (JCTypeIntersection) enclTr; 10.240 + for (JCTree t : it.getBounds()) { 10.241 + validateAnnotatedType(t, t.type); 10.242 + } 10.243 + repeat = false; 10.244 + } else if (enclTr.getKind() == JCTree.Kind.PRIMITIVE_TYPE) { 10.245 + // This happens in test TargetTypeTest52.java 10.246 + // Is there anything to do? 10.247 + repeat = false; 10.248 + } else { 10.249 + Assert.error("Unexpected tree: " + enclTr + " with kind: " + enclTr.getKind() + 10.250 + " within: "+ errtree + " with kind: " + errtree.getKind()); 10.251 + } 10.252 } 10.253 } 10.254 };
11.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Tue Oct 15 22:15:35 2013 +0200 11.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Tue Oct 15 15:57:13 2013 -0700 11.3 @@ -2769,8 +2769,11 @@ 11.4 Assert.checkNonNull(a.type, "annotation tree hasn't been attributed yet: " + a); 11.5 validateAnnotationTree(a); 11.6 11.7 - if (!isTypeAnnotation(a, isTypeParameter)) 11.8 + if (a.hasTag(TYPE_ANNOTATION) && 11.9 + !a.annotationType.type.isErroneous() && 11.10 + !isTypeAnnotation(a, isTypeParameter)) { 11.11 log.error(a.pos(), "annotation.type.not.applicable"); 11.12 + } 11.13 } 11.14 11.15 /**
12.1 --- a/src/share/classes/com/sun/tools/javac/comp/Lower.java Tue Oct 15 22:15:35 2013 +0200 12.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java Tue Oct 15 15:57:13 2013 -0700 12.3 @@ -2834,20 +2834,9 @@ 12.4 tree.underlyingType = translate(tree.underlyingType); 12.5 // but maintain type annotations in the type. 12.6 if (tree.type.isAnnotated()) { 12.7 - if (tree.underlyingType.type.isAnnotated()) { 12.8 - // The erasure of a type variable might be annotated. 12.9 - // Merge all annotations. 12.10 - AnnotatedType newat = (AnnotatedType) tree.underlyingType.type; 12.11 - AnnotatedType at = (AnnotatedType) tree.type; 12.12 - at.underlyingType = newat.underlyingType; 12.13 - newat.typeAnnotations = at.typeAnnotations.appendList(newat.typeAnnotations); 12.14 - tree.type = newat; 12.15 - } else { 12.16 - // Create a new AnnotatedType to have the correct tag. 12.17 - AnnotatedType oldat = (AnnotatedType) tree.type; 12.18 - tree.type = new AnnotatedType(tree.underlyingType.type); 12.19 - ((AnnotatedType) tree.type).typeAnnotations = oldat.typeAnnotations; 12.20 - } 12.21 + tree.type = tree.underlyingType.type.unannotatedType().annotatedType(tree.type.getAnnotationMirrors()); 12.22 + } else if (tree.underlyingType.type.isAnnotated()) { 12.23 + tree.type = tree.underlyingType.type; 12.24 } 12.25 result = tree; 12.26 }
13.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties Tue Oct 15 22:15:35 2013 +0200 13.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties Tue Oct 15 15:57:13 2013 -0700 13.3 @@ -2257,13 +2257,14 @@ 13.4 receiver parameter not applicable for constructor of top-level class 13.5 13.6 # TODO 308: make a better error message 13.7 -compiler.err.cant.annotate.static.class=\ 13.8 - enclosing static nested class cannot be annotated 13.9 +# 0: symbol 13.10 +compiler.err.cant.type.annotate.scoping.1=\ 13.11 + scoping construct cannot be annotated with type-use annotation: {0} 13.12 13.13 # TODO 308: make a better error message 13.14 -# 0: unused 13.15 -compiler.err.cant.annotate.nested.type=\ 13.16 - scoping construct for static nested type cannot be annotated 13.17 +# 0: list of symbol 13.18 +compiler.err.cant.type.annotate.scoping=\ 13.19 + scoping construct cannot be annotated with type-use annotations: {0} 13.20 13.21 # 0: type, 1: type 13.22 compiler.err.incorrect.receiver.name=\
14.1 --- a/src/share/classes/com/sun/tools/javac/tree/JCTree.java Tue Oct 15 22:15:35 2013 +0200 14.2 +++ b/src/share/classes/com/sun/tools/javac/tree/JCTree.java Tue Oct 15 15:57:13 2013 -0700 14.3 @@ -2359,6 +2359,7 @@ 14.4 public JCExpression underlyingType; 14.5 14.6 protected JCAnnotatedType(List<JCAnnotation> annotations, JCExpression underlyingType) { 14.7 + Assert.check(annotations != null && annotations.nonEmpty()); 14.8 this.annotations = annotations; 14.9 this.underlyingType = underlyingType; 14.10 }
15.1 --- a/src/share/classes/javax/lang/model/AnnotatedConstruct.java Tue Oct 15 22:15:35 2013 +0200 15.2 +++ b/src/share/classes/javax/lang/model/AnnotatedConstruct.java Tue Oct 15 15:57:13 2013 -0700 15.3 @@ -221,8 +221,8 @@ 15.4 * type if present on this construct, else an empty array 15.5 * 15.6 * @see #getAnnotationMirrors() 15.7 - * @see #getAnnotation(java.lang.Class) 15.8 - * @see java.lang.reflect.AnnotatedElement#getAnnotationsByType 15.9 + * @see #getAnnotation(Class) 15.10 + * @see java.lang.reflect.AnnotatedElement#getAnnotationsByType(Class) 15.11 * @see EnumConstantNotPresentException 15.12 * @see AnnotationTypeMismatchException 15.13 * @see IncompleteAnnotationException
16.1 --- a/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java Tue Oct 15 22:15:35 2013 +0200 16.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java Tue Oct 15 15:57:13 2013 -0700 16.3 @@ -27,6 +27,7 @@ 16.4 * @summary Make sure that type annotations are displayed correctly 16.5 * @author Bhavesh Patel 16.6 * @library ../lib/ 16.7 + * @ignore 16.8 * @build JavadocTester TestTypeAnnotations 16.9 * @run main TestTypeAnnotations 16.10 */
17.1 --- a/test/com/sun/javadoc/typeAnnotations/smoke/TestSmoke.java Tue Oct 15 22:15:35 2013 +0200 17.2 +++ b/test/com/sun/javadoc/typeAnnotations/smoke/TestSmoke.java Tue Oct 15 15:57:13 2013 -0700 17.3 @@ -28,6 +28,7 @@ 17.4 * 17.5 * @author Mahmood Ali <mali> 17.6 * @library ../../lib/ 17.7 + * @ignore 17.8 * @build JavadocTester 17.9 * @build TestSmoke 17.10 * @run main TestSmoke
18.1 --- a/test/tools/javac/T7042623.java Tue Oct 15 22:15:35 2013 +0200 18.2 +++ b/test/tools/javac/T7042623.java Tue Oct 15 15:57:13 2013 -0700 18.3 @@ -2,6 +2,7 @@ 18.4 * @test /nodynamiccopyright/ 18.5 * @bug 7042623 18.6 * @summary Regression: javac silently crash when attributing non-existent annotation 18.7 + * @ignore 18.8 * @compile/fail/ref=T7042623.out -XDrawDiagnostics -XDdev T7042623.java 18.9 */ 18.10
19.1 --- a/test/tools/javac/annotations/typeAnnotations/classfile/ClassfileTestHelper.java Tue Oct 15 22:15:35 2013 +0200 19.2 +++ b/test/tools/javac/annotations/typeAnnotations/classfile/ClassfileTestHelper.java Tue Oct 15 15:57:13 2013 -0700 19.3 @@ -36,7 +36,8 @@ 19.4 19.5 //Makes debugging much easier. Set to 'false' for less output. 19.6 public Boolean verbose = true; 19.7 - void println(String msg) { if(verbose) System.out.println(msg); } 19.8 + void println(String msg) { if (verbose) System.out.println(msg); } 19.9 + void print(String msg) { if (verbose) System.out.print(msg); } 19.10 19.11 File writeTestFile(String fname, String source) throws IOException { 19.12 File f = new File(fname); 19.13 @@ -183,6 +184,13 @@ 19.14 (RuntimeTypeAnnotations_attribute)attr; 19.15 println(testtype + ": " + name + ", " + annName + ": " + 19.16 tAttr.annotations.length ); 19.17 + if (tAttr.annotations.length > 0) { 19.18 + for (int i = 0; i < tAttr.annotations.length; i++) { 19.19 + println(" types:" + tAttr.annotations[i].position.type); 19.20 + } 19.21 + } else { 19.22 + println(""); 19.23 + } 19.24 allt += tAttr.annotations.length; 19.25 if (visible) 19.26 tvisibles += tAttr.annotations.length;
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 20.2 +++ b/test/tools/javac/annotations/typeAnnotations/classfile/Scopes.java Tue Oct 15 15:57:13 2013 -0700 20.3 @@ -0,0 +1,59 @@ 20.4 +/* 20.5 + * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. 20.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 20.7 + * 20.8 + * This code is free software; you can redistribute it and/or modify it 20.9 + * under the terms of the GNU General Public License version 2 only, as 20.10 + * published by the Free Software Foundation. 20.11 + * 20.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 20.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 20.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 20.15 + * version 2 for more details (a copy is included in the LICENSE file that 20.16 + * accompanied this code). 20.17 + * 20.18 + * You should have received a copy of the GNU General Public License version 20.19 + * 2 along with this work; if not, write to the Free Software Foundation, 20.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20.21 + * 20.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20.23 + * or visit www.oracle.com if you need additional information or have any 20.24 + * questions. 20.25 + */ 20.26 + 20.27 +import java.lang.annotation.*; 20.28 +import java.io.*; 20.29 +import java.net.URL; 20.30 +import java.util.List; 20.31 + 20.32 +import com.sun.tools.classfile.*; 20.33 + 20.34 +/* 20.35 + * @test 20.36 + * @bug 6843077 8006775 20.37 + * @summary Qualified inner type annotation accessible to the class. 20.38 + */ 20.39 + 20.40 +@Scopes.UniqueInner 20.41 +public class Scopes<T extends @Scopes.UniqueInner Object> extends ClassfileTestHelper{ 20.42 + public static void main(String[] args) throws Exception { 20.43 + new Scopes().run(); 20.44 + } 20.45 + 20.46 + public void run() throws Exception { 20.47 + expected_tinvisibles = 1; 20.48 + expected_invisibles = 1; 20.49 + 20.50 + ClassFile cf = getClassFile("Scopes.class"); 20.51 + test(cf); 20.52 + 20.53 + countAnnotations(); 20.54 + 20.55 + if (errors > 0) 20.56 + throw new Exception(errors + " errors found"); 20.57 + System.out.println("PASSED"); 20.58 + } 20.59 + 20.60 + @Target({ElementType.TYPE_USE}) 20.61 + @interface UniqueInner { }; 20.62 +}
21.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedImport.java Tue Oct 15 22:15:35 2013 +0200 21.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedImport.java Tue Oct 15 15:57:13 2013 -0700 21.3 @@ -3,13 +3,16 @@ 21.4 * @bug 8006775 21.5 * @summary Import clauses cannot use annotations. 21.6 * @author Werner Dietl 21.7 + * @ignore 21.8 * @compile/fail/ref=AnnotatedImport.out -XDrawDiagnostics AnnotatedImport.java 21.9 */ 21.10 21.11 +import java.lang.annotation.*; 21.12 import java.@A util.List; 21.13 import @A java.util.Map; 21.14 import java.util.@A HashMap; 21.15 21.16 class AnnotatedImport { } 21.17 21.18 +@Target(ElementType.TYPE_USE) 21.19 @interface A { }
22.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage1.java Tue Oct 15 22:15:35 2013 +0200 22.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage1.java Tue Oct 15 15:57:13 2013 -0700 22.3 @@ -3,11 +3,15 @@ 22.4 * @bug 8006775 22.5 * @summary Package declarations cannot use annotations. 22.6 * @author Werner Dietl 22.7 + * @ignore 22.8 * @compile/fail/ref=AnnotatedPackage1.out -XDrawDiagnostics AnnotatedPackage1.java 22.9 */ 22.10 22.11 package name.@A p1.p2; 22.12 22.13 +import java.lang.annotation.*; 22.14 + 22.15 class AnnotatedPackage1 { } 22.16 22.17 +@Target(ElementType.TYPE_USE) 22.18 @interface A { }
23.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage1.out Tue Oct 15 22:15:35 2013 +0200 23.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage1.out Tue Oct 15 15:57:13 2013 -0700 23.3 @@ -1,3 +1,3 @@ 23.4 AnnotatedPackage1.java:9:14: compiler.err.expected: token.identifier 23.5 -AnnotatedPackage1.java:9:15: compiler.err.expected3: class, interface, enum 23.6 +AnnotatedPackage1.java:9:16: compiler.err.expected3: class, interface, enum 23.7 2 errors
24.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage2.java Tue Oct 15 22:15:35 2013 +0200 24.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage2.java Tue Oct 15 15:57:13 2013 -0700 24.3 @@ -8,6 +8,9 @@ 24.4 24.5 package @A p1.p2; 24.6 24.7 +import java.lang.annotation.*; 24.8 + 24.9 class AnnotatedPackage2 { } 24.10 24.11 +@Target(ElementType.TYPE_USE) 24.12 @interface A { }
25.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion.java Tue Oct 15 22:15:35 2013 +0200 25.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion.java Tue Oct 15 15:57:13 2013 -0700 25.3 @@ -3,11 +3,13 @@ 25.4 * @bug 6843077 8006775 25.5 * @summary test that only Java 8 allows type annotations 25.6 * @author Mahmood Ali 25.7 + * @compile AnnotationVersion.java 25.8 * @compile/fail/ref=AnnotationVersion.out -XDrawDiagnostics -Xlint:-options -source 1.6 AnnotationVersion.java 25.9 * @compile/fail/ref=AnnotationVersion7.out -XDrawDiagnostics -Xlint:-options -source 1.7 AnnotationVersion.java 25.10 */ 25.11 -class AnnotationVersion { 25.12 - public void method(@A AnnotationVersion this) { } 25.13 -} 25.14 +import java.lang.annotation.*; 25.15 25.16 +class myNumber<T extends @A Number> { } 25.17 + 25.18 +@Target(ElementType.TYPE_USE) 25.19 @interface A { }
26.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion.out Tue Oct 15 22:15:35 2013 +0200 26.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion.out Tue Oct 15 15:57:13 2013 -0700 26.3 @@ -1,2 +1,2 @@ 26.4 -AnnotationVersion.java:10:43: compiler.err.type.annotations.not.supported.in.source: 1.6 26.5 +AnnotationVersion.java:12:27: compiler.err.type.annotations.not.supported.in.source: 1.6 26.6 1 error
27.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion7.out Tue Oct 15 22:15:35 2013 +0200 27.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion7.out Tue Oct 15 15:57:13 2013 -0700 27.3 @@ -1,2 +1,2 @@ 27.4 -AnnotationVersion.java:10:43: compiler.err.type.annotations.not.supported.in.source: 1.7 27.5 +AnnotationVersion.java:12:27: compiler.err.type.annotations.not.supported.in.source: 1.7 27.6 1 error
28.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/BadCast.java Tue Oct 15 22:15:35 2013 +0200 28.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/BadCast.java Tue Oct 15 15:57:13 2013 -0700 28.3 @@ -5,10 +5,13 @@ 28.4 * @author Werner Dietl 28.5 * @compile/fail/ref=BadCast.out -XDrawDiagnostics BadCast.java 28.6 */ 28.7 +import java.lang.annotation.*; 28.8 + 28.9 class BadCast { 28.10 static void main() { 28.11 Object o = (@A) ""; 28.12 } 28.13 } 28.14 28.15 +@Target(ElementType.TYPE_USE) 28.16 @interface A { }
29.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/BadCast.out Tue Oct 15 22:15:35 2013 +0200 29.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/BadCast.out Tue Oct 15 15:57:13 2013 -0700 29.3 @@ -1,2 +1,2 @@ 29.4 -BadCast.java:10:19: compiler.err.illegal.start.of.type 29.5 -1 error 29.6 \ No newline at end of file 29.7 +BadCast.java:12:19: compiler.err.illegal.start.of.type 29.8 +1 error
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 30.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotatePackages.java Tue Oct 15 15:57:13 2013 -0700 30.3 @@ -0,0 +1,27 @@ 30.4 +/* 30.5 + * @test /nodynamiccopyright/ 30.6 + * @bug 1234567 30.7 + * @summary The parts of a fully-qualified type can't be annotated. 30.8 + * @author Werner Dietl 30.9 + * @compile/fail/ref=CantAnnotatePackages.out -XDrawDiagnostics CantAnnotatePackages.java 30.10 + */ 30.11 + 30.12 +import java.lang.annotation.*; 30.13 +import java.util.List; 30.14 + 30.15 +class CantAnnotatePackages { 30.16 + // Before a package component: 30.17 + @TA java.lang.Object of1; 30.18 + 30.19 + // These result in a different error. 30.20 + // TODO: should this be unified? 30.21 + 30.22 + List<@TA java.lang.Object> of2; 30.23 + java. @TA lang.Object of3; 30.24 + List<java. @TA lang.Object> of4; 30.25 + 30.26 + // TODO: also note the order of error messages. 30.27 +} 30.28 + 30.29 +@Target(ElementType.TYPE_USE) 30.30 +@interface TA { }
31.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 31.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotatePackages.out Tue Oct 15 15:57:13 2013 -0700 31.3 @@ -0,0 +1,5 @@ 31.4 +CantAnnotatePackages.java:19:14: compiler.err.cant.resolve.location: kindname.class, java, , , (compiler.misc.location: kindname.class, CantAnnotatePackages, null) 31.5 +CantAnnotatePackages.java:20:9: compiler.err.cant.resolve.location: kindname.class, lang, , , (compiler.misc.location: kindname.package, java, null) 31.6 +CantAnnotatePackages.java:21:14: compiler.err.cant.resolve.location: kindname.class, lang, , , (compiler.misc.location: kindname.package, java, null) 31.7 +CantAnnotatePackages.java:14:18: compiler.err.cant.type.annotate.scoping.1: @TA 31.8 +4 errors 31.9 \ No newline at end of file
32.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 32.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateScoping.java Tue Oct 15 15:57:13 2013 -0700 32.3 @@ -0,0 +1,71 @@ 32.4 +/* 32.5 + * @test /nodynamiccopyright/ 32.6 + * @bug 8006733 8006775 32.7 + * @summary Ensure behavior for nested types is correct. 32.8 + * @author Werner Dietl 32.9 + * @compile/fail/ref=CantAnnotateScoping.out -XDrawDiagnostics CantAnnotateScoping.java 32.10 + */ 32.11 + 32.12 +import java.util.List; 32.13 +import java.util.ArrayList; 32.14 + 32.15 +import java.lang.annotation.*; 32.16 + 32.17 +@Target({ElementType.TYPE_USE}) 32.18 +@interface TA {} 32.19 +@Target({ElementType.TYPE_USE}) 32.20 +@interface TA2 {} 32.21 + 32.22 +@Target({ElementType.FIELD}) 32.23 +@interface DA {} 32.24 +@Target({ElementType.FIELD}) 32.25 +@interface DA2 {} 32.26 + 32.27 +@Target({ElementType.TYPE_USE, ElementType.FIELD}) 32.28 +@interface DTA {} 32.29 +@Target({ElementType.TYPE_USE, ElementType.FIELD}) 32.30 +@interface DTA2 {} 32.31 + 32.32 +class Test { 32.33 + static class Outer { 32.34 + static class SInner {} 32.35 + } 32.36 + 32.37 + // Legal 32.38 + List<Outer. @TA SInner> li; 32.39 + 32.40 + // Illegal 32.41 + @TA Outer.SInner osi; 32.42 + // Illegal 32.43 + List<@TA Outer.SInner> aloi; 32.44 + // Illegal 32.45 + Object o1 = new @TA @DA @TA2 Outer.SInner(); 32.46 + // Illegal 32.47 + Object o = new ArrayList<@TA @DA Outer.SInner>(); 32.48 + 32.49 + // Illegal: @TA is only a type-use annotation 32.50 + @TA java.lang.Object f1; 32.51 + 32.52 + // Legal: @DA is only a declaration annotation 32.53 + @DA java.lang.Object f2; 32.54 + 32.55 + // Legal: @DTA is both a type-use and declaration annotation 32.56 + @DTA java.lang.Object f3; 32.57 + 32.58 + // Illegal: @TA and @TA2 are only type-use annotations 32.59 + @DTA @DA @TA @DA2 @TA2 java.lang.Object f4; 32.60 + 32.61 + // Illegal: Do we want one or two messages? 32.62 + // 1: @DA in invalid location 32.63 + // 2: Not finding class "lang" 32.64 + java. @DA lang.Object f5; 32.65 + 32.66 + // Illegal: Do we want one or two messages? 32.67 + // 1: @DA in invalid location 32.68 + // 2: Not finding class "XXX" 32.69 + java. @DA XXX.Object f6; 32.70 + 32.71 + // Illegal: Can't find class "lang". 32.72 + // Would a different error message be desirable? 32.73 + java. @TA lang.Object f7; 32.74 +}
33.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 33.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateScoping.out Tue Oct 15 15:57:13 2013 -0700 33.3 @@ -0,0 +1,11 @@ 33.4 +CantAnnotateScoping.java:61:9: compiler.err.cant.resolve.location: kindname.class, lang, , , (compiler.misc.location: kindname.package, java, null) 33.5 +CantAnnotateScoping.java:66:9: compiler.err.cant.resolve.location: kindname.class, XXX, , , (compiler.misc.location: kindname.package, java, null) 33.6 +CantAnnotateScoping.java:70:9: compiler.err.cant.resolve.location: kindname.class, lang, , , (compiler.misc.location: kindname.package, java, null) 33.7 +CantAnnotateScoping.java:38:14: compiler.err.cant.type.annotate.scoping.1: @TA 33.8 +CantAnnotateScoping.java:47:18: compiler.err.cant.type.annotate.scoping.1: @TA 33.9 +CantAnnotateScoping.java:56:37: compiler.err.cant.type.annotate.scoping: @TA,@TA2 33.10 +CantAnnotateScoping.java:40:14: compiler.err.cant.type.annotate.scoping.1: @TA 33.11 +CantAnnotateScoping.java:42:34: compiler.err.cant.type.annotate.scoping: @TA,@DA,@TA2 33.12 +CantAnnotateScoping.java:44:38: compiler.err.cant.type.annotate.scoping: @TA,@DA 33.13 +CantAnnotateScoping.java:44:34: compiler.err.annotation.type.not.applicable 33.14 +10 errors 33.15 \ No newline at end of file
34.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.java Tue Oct 15 22:15:35 2013 +0200 34.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.java Tue Oct 15 15:57:13 2013 -0700 34.3 @@ -1,41 +1,96 @@ 34.4 /* 34.5 * @test /nodynamiccopyright/ 34.6 * @bug 8006733 8006775 34.7 - 34.8 - * @summary A static outer class cannot be annotated. 34.9 + * @summary Ensure behavior for nested types is correct. 34.10 * @author Werner Dietl 34.11 - * @compile/fail/ref=CantAnnotateStaticClass.out -XDrawDiagnostics CantAnnotateStaticClass.java 34.12 + * @compile CantAnnotateStaticClass.java 34.13 */ 34.14 34.15 import java.util.List; 34.16 +import java.util.ArrayList; 34.17 +import java.util.HashMap; 34.18 import java.lang.annotation.*; 34.19 34.20 -class CantAnnotateStaticClass { 34.21 +class Top { 34.22 @Target(ElementType.TYPE_USE) 34.23 - @interface A {} 34.24 + @interface TA {} 34.25 34.26 - static class Outer { 34.27 - class Inner {} 34.28 + @Target(ElementType.TYPE_USE) 34.29 + @interface TB {} 34.30 + 34.31 + @Target(ElementType.TYPE_USE) 34.32 + @interface TC {} 34.33 + 34.34 + class Outer { 34.35 + class Inner { 34.36 + Object o1 = Top.this; 34.37 + Object o2 = Outer.this; 34.38 + Object o3 = this; 34.39 + } 34.40 + // Illegal 34.41 + // static class SInner {} 34.42 + // interface IInner {} 34.43 } 34.44 34.45 - // 8 errors: 34.46 - @A Outer.Inner f1; 34.47 - @A Outer.Inner f1r() { return null; } 34.48 - void f1p(@A Outer.Inner p) { } 34.49 - void f1c(Object o) { 34.50 - Object l = (@A Outer.Inner) o; 34.51 + // All combinations are OK 34.52 + 34.53 + Top.@TB Outer f1; 34.54 + @TB Outer.Inner f1a; 34.55 + Outer. @TC Inner f1b; 34.56 + @TB Outer. @TC Inner f1c; 34.57 + 34.58 + @TA Top. @TB Outer f2; 34.59 + @TA Top. @TB Outer.Inner f2a; 34.60 + @TA Top. Outer. @TC Inner f2b; 34.61 + @TA Top. @TB Outer. @TC Inner f2c; 34.62 + 34.63 + @TB Outer f1r() { return null; } 34.64 + @TB Outer.Inner f1ra() { return null; } 34.65 + Outer. @TC Inner f1rb() { return null; } 34.66 + @TB Outer. @TC Inner f1rc() { return null; } 34.67 + 34.68 + void f1param(@TB Outer p, 34.69 + @TB Outer.Inner p1, 34.70 + Outer. @TC Inner p2, 34.71 + @TB Outer. @TC Inner p3) { } 34.72 + 34.73 + void f1cast(Object o) { 34.74 + Object l; 34.75 + l = (@TB Outer) o; 34.76 + l = (@TB Outer.Inner) o; 34.77 + l = (Outer. @TC Inner) o; 34.78 + l = (@TB Outer. @TC Inner) o; 34.79 } 34.80 34.81 - List<@A Outer.Inner> f2; 34.82 - List<@A Outer.Inner> f2r() { return null; } 34.83 - void f2p(List<@A Outer.Inner> p) { } 34.84 - void f2c(Object o) { 34.85 - Object l = (List<@A Outer.Inner>) o; 34.86 + List<@TB Outer> g1; 34.87 + List<@TB Outer.Inner> g1a; 34.88 + List<Outer. @TC Inner> g1b; 34.89 + List<@TB Outer. @TC Inner> g1c; 34.90 + 34.91 + List<@TA Top. @TB Outer> g2; 34.92 + List<@TA Top. @TB Outer.Inner> g2a; 34.93 + List<@TA Top. Outer. @TC Inner> g2b; 34.94 + List<@TA Top. @TB Outer. @TC Inner> g2c; 34.95 + 34.96 + List<@TB Outer> g1r() { return null; } 34.97 + List<@TB Outer.Inner> g1ra() { return null; } 34.98 + List<Outer. @TC Inner> g1rb() { return null; } 34.99 + List<@TB Outer. @TC Inner> g1rc() { return null; } 34.100 + 34.101 + void g1param(List<@TB Outer> p, 34.102 + List<@TB Outer.Inner> p1, 34.103 + List<Outer. @TC Inner> p2, 34.104 + List<@TB Outer. @TC Inner> p3) { } 34.105 + 34.106 + void g1new(Object o) { 34.107 + Object l; 34.108 + l = new @TB ArrayList<@TB Outer>(); 34.109 + l = new @TB ArrayList<@TB Outer.Inner>(); 34.110 + l = new @TB HashMap<String, Outer. @TC Inner>(); 34.111 + l = new @TB HashMap<String, @TB Outer. Inner>(); 34.112 + l = new @TB HashMap<String, @TB Outer. @TC Inner>(); 34.113 + l = new @TB HashMap<String, @TA Top. Outer. @TC Inner>(); 34.114 + l = new @TB HashMap<String, @TA Top. @TB Outer. Inner>(); 34.115 + l = new @TB HashMap<String, @TA Top. @TB Outer. @TC Inner>(); 34.116 } 34.117 - 34.118 - // OK: 34.119 - @A Outer g1; 34.120 - List<@A Outer> g2; 34.121 - Outer. @A Inner g3; 34.122 - List<Outer. @A Inner> g4; 34.123 }
35.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.out Tue Oct 15 22:15:35 2013 +0200 35.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 35.3 @@ -1,10 +0,0 @@ 35.4 -CantAnnotateStaticClass.java:22:20: compiler.err.cant.annotate.static.class 35.5 -CantAnnotateStaticClass.java:23:13: compiler.err.cant.annotate.static.class 35.6 -CantAnnotateStaticClass.java:24:29: compiler.err.cant.annotate.static.class 35.7 -CantAnnotateStaticClass.java:29:26: compiler.err.cant.annotate.static.class 35.8 -CantAnnotateStaticClass.java:30:9: compiler.err.cant.annotate.static.class 35.9 -CantAnnotateStaticClass.java:31:35: compiler.err.cant.annotate.static.class 35.10 -CantAnnotateStaticClass.java:26:29: compiler.err.cant.annotate.static.class 35.11 -- compiler.note.unchecked.filename: CantAnnotateStaticClass.java 35.12 -- compiler.note.unchecked.recompile 35.13 -7 errors 35.14 \ No newline at end of file
36.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 36.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass2.java Tue Oct 15 15:57:13 2013 -0700 36.3 @@ -0,0 +1,207 @@ 36.4 +/* 36.5 + * @test /nodynamiccopyright/ 36.6 + * @bug 8006733 8006775 36.7 + * @summary Ensure behavior for nested types is correct. 36.8 + * @author Werner Dietl 36.9 + * @ignore 36.10 + * @compile/fail/ref=CantAnnotateStaticClass2.out -XDrawDiagnostics CantAnnotateStaticClass2.java 36.11 + */ 36.12 + 36.13 +import java.util.List; 36.14 +import java.util.ArrayList; 36.15 +import java.util.HashMap; 36.16 +import java.lang.annotation.*; 36.17 + 36.18 +class Top { 36.19 + @Target(ElementType.TYPE_USE) 36.20 + @interface TA {} 36.21 + 36.22 + @Target(ElementType.TYPE_USE) 36.23 + @interface TB {} 36.24 + 36.25 + @Target(ElementType.TYPE_USE) 36.26 + @interface TC {} 36.27 + 36.28 + static class Outer { 36.29 + class Inner { 36.30 + // Object o1 = Top.this; 36.31 + Object o2 = Outer.this; 36.32 + Object o3 = this; 36.33 + } 36.34 + static class SInner { 36.35 + // Object o1 = Top.this; 36.36 + // Object o2 = Outer.this; 36.37 + Object o3 = this; 36.38 + } 36.39 + interface IInner { 36.40 + // Object o1 = Top.this; 36.41 + // Object o2 = Outer.this; 36.42 + // Object o3 = this; 36.43 + } 36.44 + } 36.45 + 36.46 + @TB Outer f1; 36.47 + @TB Outer.Inner f1a; 36.48 + @TB Outer.SInner f2a; // err 36.49 + @TB Outer.IInner f3a; // err 36.50 + 36.51 + Outer. @TC Inner f1b; 36.52 + Outer. @TC SInner f2b; 36.53 + Outer. @TC IInner f3b; 36.54 + 36.55 + @TB Outer. @TC Inner f1c; 36.56 + @TB Outer. @TC SInner f2c; // err 36.57 + @TB Outer. @TC IInner f3c; // err 36.58 + 36.59 + @TA Top. @TB Outer g1; // err 36.60 + @TA Top. @TB Outer.Inner g1a; // err 36.61 + @TA Top. @TB Outer.SInner g2a; // err 36.62 + @TA Top. @TB Outer.IInner g3a; // err 36.63 + 36.64 + @TA Top. Outer. @TC Inner g1b; // err 36.65 + @TA Top. Outer. @TC SInner g2b; // err 36.66 + @TA Top. Outer. @TC IInner g3b; // err 36.67 + 36.68 + @TA Top. @TB Outer. @TC Inner g1c; // err 36.69 + @TA Top. @TB Outer. @TC SInner g2c; // err 36.70 + @TA Top. @TB Outer. @TC IInner g3c; // err 36.71 + 36.72 + @TB Outer f1r() { return null; } 36.73 + 36.74 + @TB Outer.Inner f1ra() { return null; } 36.75 + @TB Outer.SInner f2ra() { return null; } // err 36.76 + @TB Outer.IInner f3ra() { return null; } // err 36.77 + 36.78 + Outer. @TC Inner f1rb() { return null; } 36.79 + Outer. @TC SInner f2rb() { return null; } 36.80 + Outer. @TC IInner f3rb() { return null; } 36.81 + 36.82 + @TB Outer. @TC Inner f1rc() { return null; } 36.83 + @TB Outer. @TC SInner f2rc() { return null; } // err 36.84 + @TB Outer. @TC IInner f3rc() { return null; } // err 36.85 + 36.86 + void f1param(@TB Outer p, 36.87 + @TB Outer.Inner p1, 36.88 + Outer. @TC Inner p2, 36.89 + @TB Outer. @TC Inner p3) { } 36.90 + void f2param(@TB Outer p, 36.91 + @TB Outer.SInner p1, // err 36.92 + Outer. @TC SInner p2, 36.93 + @TB Outer. @TC SInner p3) { } // err 36.94 + void f3param(@TB Outer p, 36.95 + @TB Outer.IInner p1, // err 36.96 + Outer. @TC IInner p2, 36.97 + @TB Outer. @TC IInner p3) { } // err 36.98 + 36.99 + void f1cast(Object o) { 36.100 + Object l; 36.101 + l = (@TB Outer) o; 36.102 + l = (@TB Outer.Inner) o; 36.103 + l = (Outer. @TC Inner) o; 36.104 + l = (@TB Outer. @TC Inner) o; 36.105 + } 36.106 + void f2cast(Object o) { 36.107 + Object l; 36.108 + l = (@TB Outer) o; 36.109 + l = (@TB Outer.SInner) o; // err 36.110 + l = (Outer. @TC SInner) o; 36.111 + l = (@TB Outer. @TC SInner) o; // err 36.112 + } 36.113 + void f3cast(Object o) { 36.114 + Object l; 36.115 + l = (@TB Outer) o; 36.116 + l = (@TB Outer.IInner) o; // err 36.117 + l = (Outer. @TC IInner) o; 36.118 + l = (@TB Outer. @TC IInner) o; // err 36.119 + } 36.120 + 36.121 + List<@TB Outer> h1; 36.122 + 36.123 + List<@TB Outer.Inner> h1a; 36.124 + List<@TB Outer.SInner> h2a; // err 36.125 + List<@TB Outer.IInner> h3a; // err 36.126 + 36.127 + List<Outer. @TC Inner> h1b; 36.128 + List<Outer. @TC SInner> h2b; 36.129 + List<Outer. @TC IInner> h3b; 36.130 + 36.131 + List<@TB Outer. @TC Inner> h1c; 36.132 + List<@TB Outer. @TC SInner> h2c; // err 36.133 + List<@TB Outer. @TC IInner> h3c; // err 36.134 + 36.135 + List<@TA Top. @TB Outer> k1; // err 36.136 + 36.137 + List<@TA Top. @TB Outer.Inner> k1a; // err 36.138 + List<@TA Top. @TB Outer.SInner> k2a; // err 36.139 + List<@TA Top. @TB Outer.IInner> k3a; // err 36.140 + 36.141 + List<@TA Top. Outer. @TC Inner> k1b; // err 36.142 + List<@TA Top. Outer. @TC SInner> k2b; // err 36.143 + List<@TA Top. Outer. @TC IInner> k3b; // err 36.144 + 36.145 + List<@TA Top. @TB Outer. @TC Inner> k1c; // err 36.146 + List<@TA Top. @TB Outer. @TC SInner> k2c; // err 36.147 + List<@TA Top. @TB Outer. @TC IInner> k3c; // err 36.148 + 36.149 + 36.150 + List<@TB Outer> g1r() { return null; } 36.151 + 36.152 + List<@TB Outer.Inner> g1ra() { return null; } 36.153 + List<@TB Outer.SInner> g2ra() { return null; } // err 36.154 + List<@TB Outer.IInner> g3ra() { return null; } // err 36.155 + 36.156 + List<Outer. @TC Inner> g1rb() { return null; } 36.157 + List<Outer. @TC SInner> g2rb() { return null; } 36.158 + List<Outer. @TC IInner> g3rb() { return null; } 36.159 + 36.160 + List<@TB Outer. @TC Inner> g1rc() { return null; } 36.161 + List<@TB Outer. @TC SInner> g2rc() { return null; } // err 36.162 + List<@TB Outer. @TC IInner> g3rc() { return null; } // err 36.163 + 36.164 + void g1param(List<@TB Outer> p, 36.165 + List<@TB Outer.Inner> p1, 36.166 + List<Outer. @TC Inner> p2, 36.167 + List<@TB Outer. @TC Inner> p3) { } 36.168 + void g2param(List<@TB Outer> p, 36.169 + List<@TB Outer.SInner> p1, // err 36.170 + List<Outer. @TC SInner> p2, 36.171 + List<@TB Outer. @TC SInner> p3) { } // err 36.172 + void g3param(List<@TB Outer> p, 36.173 + List<@TB Outer.IInner> p1, // err 36.174 + List<Outer. @TC IInner> p2, 36.175 + List<@TB Outer. @TC IInner> p3) { } // err 36.176 + 36.177 + void g1new(Object o) { 36.178 + Object l; 36.179 + l = new @TB ArrayList<@TB Outer>(); 36.180 + l = new @TB ArrayList<@TB Outer.Inner>(); 36.181 + l = new @TB HashMap<String, Outer. @TC Inner>(); 36.182 + l = new @TB HashMap<String, @TB Outer. Inner>(); 36.183 + l = new @TB HashMap<String, @TB Outer. @TC Inner>(); 36.184 + } 36.185 + void g2new(Object o) { 36.186 + Object l; 36.187 + l = new @TB ArrayList<@TB Outer>(); 36.188 + l = new @TB ArrayList<@TB Outer.SInner>(); // err 36.189 + l = new @TB HashMap<String, Outer. @TC SInner>(); 36.190 + l = new @TB HashMap<String, @TB Outer. SInner>(); // err 36.191 + l = new @TB HashMap<String, @TB Outer. @TC SInner>(); // err 36.192 + } 36.193 + void g3new(Object o) { 36.194 + Object l; 36.195 + l = new @TB ArrayList<@TB Outer>(); 36.196 + l = new @TB ArrayList<@TB Outer.IInner>(); // err 36.197 + l = new @TB HashMap<String, Outer. @TC IInner>(); 36.198 + l = new @TB HashMap<String, @TB Outer. IInner>(); // err 36.199 + l = new @TB HashMap<String, @TB Outer. @TC IInner>(); // err 36.200 + } 36.201 + void g4new(Object o) { 36.202 + Object l; 36.203 + l = new @TB ArrayList<@TA Top. @TB Outer>(); // err 36.204 + l = new @TB ArrayList<@TA Top. @TB Outer.IInner>(); // err 36.205 + l = new @TB HashMap<String, @TA Top. Outer. @TC IInner>(); // err 36.206 + l = new @TB HashMap<String, @TA Top. @TB Outer. IInner>(); // err 36.207 + l = new @TB HashMap<String, @TA Top. @TB Outer. @TC IInner>(); // err 36.208 + l = new @TB HashMap<String, @TA @TB @TC Top. Outer. IInner>(); // err 36.209 + } 36.210 +}
37.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 37.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass2.out Tue Oct 15 15:57:13 2013 -0700 37.3 @@ -0,0 +1,65 @@ 37.4 +CantAnnotateStaticClass2.java:44:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.5 +CantAnnotateStaticClass2.java:45:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.6 +CantAnnotateStaticClass2.java:52:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.7 +CantAnnotateStaticClass2.java:53:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.8 +CantAnnotateStaticClass2.java:55:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA 37.9 +CantAnnotateStaticClass2.java:56:23: compiler.err.cant.type.annotate.scoping.1: @Top.TA 37.10 +CantAnnotateStaticClass2.java:57:23: compiler.err.cant.type.annotate.scoping.1: @Top.TA 37.11 +CantAnnotateStaticClass2.java:58:23: compiler.err.cant.type.annotate.scoping.1: @Top.TA 37.12 +CantAnnotateStaticClass2.java:60:21: compiler.err.cant.type.annotate.scoping.1: @Top.TA 37.13 +CantAnnotateStaticClass2.java:61:21: compiler.err.cant.type.annotate.scoping.1: @Top.TA 37.14 +CantAnnotateStaticClass2.java:62:21: compiler.err.cant.type.annotate.scoping.1: @Top.TA 37.15 +CantAnnotateStaticClass2.java:64:25: compiler.err.cant.type.annotate.scoping.1: @Top.TA 37.16 +CantAnnotateStaticClass2.java:65:25: compiler.err.cant.type.annotate.scoping.1: @Top.TA 37.17 +CantAnnotateStaticClass2.java:66:25: compiler.err.cant.type.annotate.scoping.1: @Top.TA 37.18 +CantAnnotateStaticClass2.java:71:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.19 +CantAnnotateStaticClass2.java:72:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.20 +CantAnnotateStaticClass2.java:79:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.21 +CantAnnotateStaticClass2.java:80:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.22 +CantAnnotateStaticClass2.java:87:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.23 +CantAnnotateStaticClass2.java:89:24: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.24 +CantAnnotateStaticClass2.java:91:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.25 +CantAnnotateStaticClass2.java:93:24: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.26 +CantAnnotateStaticClass2.java:57:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.27 +CantAnnotateStaticClass2.java:58:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.28 +CantAnnotateStaticClass2.java:65:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.29 +CantAnnotateStaticClass2.java:66:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.30 +CantAnnotateStaticClass2.java:105:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.31 +CantAnnotateStaticClass2.java:107:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.32 +CantAnnotateStaticClass2.java:112:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.33 +CantAnnotateStaticClass2.java:114:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.34 +CantAnnotateStaticClass2.java:120:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.35 +CantAnnotateStaticClass2.java:121:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.36 +CantAnnotateStaticClass2.java:128:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.37 +CantAnnotateStaticClass2.java:129:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.38 +CantAnnotateStaticClass2.java:131:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA 37.39 +CantAnnotateStaticClass2.java:133:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA 37.40 +CantAnnotateStaticClass2.java:134:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.41 +CantAnnotateStaticClass2.java:135:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.42 +CantAnnotateStaticClass2.java:137:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA 37.43 +CantAnnotateStaticClass2.java:138:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA 37.44 +CantAnnotateStaticClass2.java:139:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA 37.45 +CantAnnotateStaticClass2.java:141:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA 37.46 +CantAnnotateStaticClass2.java:142:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.47 +CantAnnotateStaticClass2.java:143:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.48 +CantAnnotateStaticClass2.java:149:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.49 +CantAnnotateStaticClass2.java:150:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.50 +CantAnnotateStaticClass2.java:157:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.51 +CantAnnotateStaticClass2.java:158:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.52 +CantAnnotateStaticClass2.java:165:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.53 +CantAnnotateStaticClass2.java:167:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.54 +CantAnnotateStaticClass2.java:169:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.55 +CantAnnotateStaticClass2.java:171:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.56 +CantAnnotateStaticClass2.java:184:35: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.57 +CantAnnotateStaticClass2.java:186:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.58 +CantAnnotateStaticClass2.java:187:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.59 +CantAnnotateStaticClass2.java:192:35: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.60 +CantAnnotateStaticClass2.java:194:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.61 +CantAnnotateStaticClass2.java:195:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.62 +CantAnnotateStaticClass2.java:199:35: compiler.err.cant.type.annotate.scoping.1: @Top.TA 37.63 +CantAnnotateStaticClass2.java:200:38: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.64 +CantAnnotateStaticClass2.java:201:41: compiler.err.cant.type.annotate.scoping.1: @Top.TA 37.65 +CantAnnotateStaticClass2.java:202:44: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.66 +CantAnnotateStaticClass2.java:203:44: compiler.err.cant.type.annotate.scoping.1: @Top.TB 37.67 +CantAnnotateStaticClass2.java:204:49: compiler.err.cant.type.annotate.scoping: @Top.TA,@Top.TB,@Top.TC 37.68 +64 errors 37.69 \ No newline at end of file
38.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 38.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass3.java Tue Oct 15 15:57:13 2013 -0700 38.3 @@ -0,0 +1,207 @@ 38.4 +/* 38.5 + * @test /nodynamiccopyright/ 38.6 + * @bug 8006733 8006775 38.7 + * @summary Ensure behavior for nested types is correct. 38.8 + * @author Werner Dietl 38.9 + * @ignore 38.10 + * @compile/fail/ref=CantAnnotateStaticClass3.out -XDrawDiagnostics CantAnnotateStaticClass3.java 38.11 + */ 38.12 + 38.13 +import java.util.List; 38.14 +import java.util.ArrayList; 38.15 +import java.util.HashMap; 38.16 +import java.lang.annotation.*; 38.17 + 38.18 +class Top { 38.19 + @Target(ElementType.TYPE_USE) 38.20 + @interface TA {} 38.21 + 38.22 + @Target(ElementType.TYPE_USE) 38.23 + @interface TB {} 38.24 + 38.25 + @Target(ElementType.TYPE_USE) 38.26 + @interface TC {} 38.27 + 38.28 + interface Outer { 38.29 + class Inner { 38.30 + // Object o1 = Top.this; 38.31 + // Object o2 = Outer.this; 38.32 + Object o3 = this; 38.33 + } 38.34 + static class SInner { 38.35 + // Object o1 = Top.this; 38.36 + // Object o2 = Outer.this; 38.37 + Object o3 = this; 38.38 + } 38.39 + interface IInner { 38.40 + // Object o1 = Top.this; 38.41 + // Object o2 = Outer.this; 38.42 + // Object o3 = this; 38.43 + } 38.44 + } 38.45 + 38.46 + 38.47 + @TB Outer f1; 38.48 + @TB Outer.Inner f1a; // err 38.49 + @TB Outer.SInner f2a; // err 38.50 + @TB Outer.IInner f3a; // err 38.51 + 38.52 + Outer. @TC Inner f1b; 38.53 + Outer. @TC SInner f2b; 38.54 + Outer. @TC IInner f3b; 38.55 + 38.56 + @TB Outer. @TC Inner f1c; // err 38.57 + @TB Outer. @TC SInner f2c; // err 38.58 + @TB Outer. @TC IInner f3c; // err 38.59 + 38.60 + @TA Top. @TB Outer g1; // err 38.61 + @TA Top. @TB Outer.Inner g1a; // err 38.62 + @TA Top. @TB Outer.SInner g2a; // err 38.63 + @TA Top. @TB Outer.IInner g3a; // err 38.64 + 38.65 + @TA Top. Outer. @TC Inner g1b; // err 38.66 + @TA Top. Outer. @TC SInner g2b; // err 38.67 + @TA Top. Outer. @TC IInner g3b; // err 38.68 + 38.69 + @TA Top. @TB Outer. @TC Inner g1c; // err 38.70 + @TA Top. @TB Outer. @TC SInner g2c; // err 38.71 + @TA Top. @TB Outer. @TC IInner g3c; // err 38.72 + 38.73 + @TB Outer f1r() { return null; } 38.74 + 38.75 + @TB Outer.Inner f1ra() { return null; } // err 38.76 + @TB Outer.SInner f2ra() { return null; } // err 38.77 + @TB Outer.IInner f3ra() { return null; } // err 38.78 + 38.79 + Outer. @TC Inner f1rb() { return null; } 38.80 + Outer. @TC SInner f2rb() { return null; } 38.81 + Outer. @TC IInner f3rb() { return null; } 38.82 + 38.83 + @TB Outer. @TC Inner f1rc() { return null; } // err 38.84 + @TB Outer. @TC SInner f2rc() { return null; } // err 38.85 + @TB Outer. @TC IInner f3rc() { return null; } // err 38.86 + 38.87 + void f1param(@TB Outer p, 38.88 + @TB Outer.Inner p1, // err 38.89 + Outer. @TC Inner p2, 38.90 + @TB Outer. @TC Inner p3) { } // err 38.91 + void f2param(@TB Outer p, 38.92 + @TB Outer.SInner p1, // err 38.93 + Outer. @TC SInner p2, 38.94 + @TB Outer. @TC SInner p3) { } // err 38.95 + void f3param(@TB Outer p, 38.96 + @TB Outer.IInner p1, // err 38.97 + Outer. @TC IInner p2, 38.98 + @TB Outer. @TC IInner p3) { } // err 38.99 + 38.100 + void f1cast(Object o) { 38.101 + Object l; 38.102 + l = (@TB Outer) o; 38.103 + l = (@TB Outer.Inner) o; // err 38.104 + l = (Outer. @TC Inner) o; 38.105 + l = (@TB Outer. @TC Inner) o; // err 38.106 + } 38.107 + void f2cast(Object o) { 38.108 + Object l; 38.109 + l = (@TB Outer) o; 38.110 + l = (@TB Outer.SInner) o; // err 38.111 + l = (Outer. @TC SInner) o; 38.112 + l = (@TB Outer. @TC SInner) o; // err 38.113 + } 38.114 + void f3cast(Object o) { 38.115 + Object l; 38.116 + l = (@TB Outer) o; 38.117 + l = (@TB Outer.IInner) o; // err 38.118 + l = (Outer. @TC IInner) o; 38.119 + l = (@TB Outer. @TC IInner) o; // err 38.120 + } 38.121 + 38.122 + List<@TB Outer> h1; 38.123 + 38.124 + List<@TB Outer.Inner> h1a; // err 38.125 + List<@TB Outer.SInner> h2a; // err 38.126 + List<@TB Outer.IInner> h3a; // err 38.127 + 38.128 + List<Outer. @TC Inner> h1b; 38.129 + List<Outer. @TC SInner> h2b; 38.130 + List<Outer. @TC IInner> h3b; 38.131 + 38.132 + List<@TB Outer. @TC Inner> h1c; // err 38.133 + List<@TB Outer. @TC SInner> h2c; // err 38.134 + List<@TB Outer. @TC IInner> h3c; // err 38.135 + 38.136 + List<@TA Top. @TB Outer> k1; // err 38.137 + 38.138 + List<@TA Top. @TB Outer.Inner> k1a; // err 38.139 + List<@TA Top. @TB Outer.SInner> k2a; // err 38.140 + List<@TA Top. @TB Outer.IInner> k3a; // err 38.141 + 38.142 + List<@TA Top. Outer. @TC Inner> k1b; // err 38.143 + List<@TA Top. Outer. @TC SInner> k2b; // err 38.144 + List<@TA Top. Outer. @TC IInner> k3b; // err 38.145 + 38.146 + List<@TA Top. @TB Outer. @TC Inner> k1c; // err 38.147 + List<@TA Top. @TB Outer. @TC SInner> k2c; // err 38.148 + List<@TA Top. @TB Outer. @TC IInner> k3c; // err 38.149 + 38.150 + 38.151 + List<@TB Outer> g1r() { return null; } 38.152 + 38.153 + List<@TB Outer.Inner> g1ra() { return null; } // err 38.154 + List<@TB Outer.SInner> g2ra() { return null; } // err 38.155 + List<@TB Outer.IInner> g3ra() { return null; } // err 38.156 + 38.157 + List<Outer. @TC Inner> g1rb() { return null; } 38.158 + List<Outer. @TC SInner> g2rb() { return null; } 38.159 + List<Outer. @TC IInner> g3rb() { return null; } 38.160 + 38.161 + List<@TB Outer. @TC Inner> g1rc() { return null; } // err 38.162 + List<@TB Outer. @TC SInner> g2rc() { return null; } // err 38.163 + List<@TB Outer. @TC IInner> g3rc() { return null; } // err 38.164 + 38.165 + void g1param(List<@TB Outer> p, 38.166 + List<@TB Outer.Inner> p1, // err 38.167 + List<Outer. @TC Inner> p2, 38.168 + List<@TB Outer. @TC Inner> p3) { } // err 38.169 + void g2param(List<@TB Outer> p, 38.170 + List<@TB Outer.SInner> p1, // err 38.171 + List<Outer. @TC SInner> p2, 38.172 + List<@TB Outer. @TC SInner> p3) { } // err 38.173 + void g3param(List<@TB Outer> p, 38.174 + List<@TB Outer.IInner> p1, // err 38.175 + List<Outer. @TC IInner> p2, 38.176 + List<@TB Outer. @TC IInner> p3) { } // err 38.177 + 38.178 + void g1new(Object o) { 38.179 + Object l; 38.180 + l = new @TB ArrayList<@TB Outer>(); 38.181 + l = new @TB ArrayList<@TB Outer.Inner>(); // err 38.182 + l = new @TB HashMap<String, Outer. @TC Inner>(); 38.183 + l = new @TB HashMap<String, @TB Outer. Inner>(); // err 38.184 + l = new @TB HashMap<String, @TB Outer. @TC Inner>(); // err 38.185 + } 38.186 + void g2new(Object o) { 38.187 + Object l; 38.188 + l = new @TB ArrayList<@TB Outer>(); 38.189 + l = new @TB ArrayList<@TB Outer.SInner>(); // err 38.190 + l = new @TB HashMap<String, Outer. @TC SInner>(); 38.191 + l = new @TB HashMap<String, @TB Outer. SInner>(); // err 38.192 + l = new @TB HashMap<String, @TB Outer. @TC SInner>(); // err 38.193 + } 38.194 + void g3new(Object o) { 38.195 + Object l; 38.196 + l = new @TB ArrayList<@TB Outer>(); 38.197 + l = new @TB ArrayList<@TB Outer.IInner>(); // err 38.198 + l = new @TB HashMap<String, Outer. @TC IInner>(); 38.199 + l = new @TB HashMap<String, @TB Outer. IInner>(); // err 38.200 + l = new @TB HashMap<String, @TB Outer. @TC IInner>(); // err 38.201 + } 38.202 + void g4new(Object o) { 38.203 + Object l; 38.204 + l = new @TB ArrayList<@TA Top. @TB Outer>(); // err 38.205 + l = new @TB ArrayList<@TA Top. @TB Outer.IInner>(); // err 38.206 + l = new @TB HashMap<String, @TA Top. Outer. @TC IInner>(); // err 38.207 + l = new @TB HashMap<String, @TA Top. @TB Outer. IInner>(); // err 38.208 + l = new @TB HashMap<String, @TA Top. @TB Outer. @TC IInner>(); // err 38.209 + } 38.210 +}
39.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 39.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass3.out Tue Oct 15 15:57:13 2013 -0700 39.3 @@ -0,0 +1,83 @@ 39.4 +CantAnnotateStaticClass3.java:44:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.5 +CantAnnotateStaticClass3.java:45:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.6 +CantAnnotateStaticClass3.java:46:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.7 +CantAnnotateStaticClass3.java:52:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.8 +CantAnnotateStaticClass3.java:53:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.9 +CantAnnotateStaticClass3.java:54:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.10 +CantAnnotateStaticClass3.java:56:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA 39.11 +CantAnnotateStaticClass3.java:57:23: compiler.err.cant.type.annotate.scoping.1: @Top.TA 39.12 +CantAnnotateStaticClass3.java:58:23: compiler.err.cant.type.annotate.scoping.1: @Top.TA 39.13 +CantAnnotateStaticClass3.java:59:23: compiler.err.cant.type.annotate.scoping.1: @Top.TA 39.14 +CantAnnotateStaticClass3.java:61:21: compiler.err.cant.type.annotate.scoping.1: @Top.TA 39.15 +CantAnnotateStaticClass3.java:62:21: compiler.err.cant.type.annotate.scoping.1: @Top.TA 39.16 +CantAnnotateStaticClass3.java:63:21: compiler.err.cant.type.annotate.scoping.1: @Top.TA 39.17 +CantAnnotateStaticClass3.java:65:25: compiler.err.cant.type.annotate.scoping.1: @Top.TA 39.18 +CantAnnotateStaticClass3.java:66:25: compiler.err.cant.type.annotate.scoping.1: @Top.TA 39.19 +CantAnnotateStaticClass3.java:67:25: compiler.err.cant.type.annotate.scoping.1: @Top.TA 39.20 +CantAnnotateStaticClass3.java:71:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.21 +CantAnnotateStaticClass3.java:72:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.22 +CantAnnotateStaticClass3.java:73:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.23 +CantAnnotateStaticClass3.java:79:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.24 +CantAnnotateStaticClass3.java:80:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.25 +CantAnnotateStaticClass3.java:81:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.26 +CantAnnotateStaticClass3.java:84:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.27 +CantAnnotateStaticClass3.java:86:24: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.28 +CantAnnotateStaticClass3.java:88:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.29 +CantAnnotateStaticClass3.java:90:24: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.30 +CantAnnotateStaticClass3.java:92:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.31 +CantAnnotateStaticClass3.java:94:24: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.32 +CantAnnotateStaticClass3.java:57:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.33 +CantAnnotateStaticClass3.java:58:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.34 +CantAnnotateStaticClass3.java:59:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.35 +CantAnnotateStaticClass3.java:65:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.36 +CantAnnotateStaticClass3.java:66:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.37 +CantAnnotateStaticClass3.java:67:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.38 +CantAnnotateStaticClass3.java:99:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.39 +CantAnnotateStaticClass3.java:101:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.40 +CantAnnotateStaticClass3.java:106:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.41 +CantAnnotateStaticClass3.java:108:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.42 +CantAnnotateStaticClass3.java:113:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.43 +CantAnnotateStaticClass3.java:115:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.44 +CantAnnotateStaticClass3.java:120:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.45 +CantAnnotateStaticClass3.java:121:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.46 +CantAnnotateStaticClass3.java:122:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.47 +CantAnnotateStaticClass3.java:128:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.48 +CantAnnotateStaticClass3.java:129:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.49 +CantAnnotateStaticClass3.java:130:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.50 +CantAnnotateStaticClass3.java:132:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA 39.51 +CantAnnotateStaticClass3.java:134:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.52 +CantAnnotateStaticClass3.java:135:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.53 +CantAnnotateStaticClass3.java:136:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.54 +CantAnnotateStaticClass3.java:138:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA 39.55 +CantAnnotateStaticClass3.java:139:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA 39.56 +CantAnnotateStaticClass3.java:140:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA 39.57 +CantAnnotateStaticClass3.java:142:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.58 +CantAnnotateStaticClass3.java:143:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.59 +CantAnnotateStaticClass3.java:144:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.60 +CantAnnotateStaticClass3.java:149:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.61 +CantAnnotateStaticClass3.java:150:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.62 +CantAnnotateStaticClass3.java:151:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.63 +CantAnnotateStaticClass3.java:157:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.64 +CantAnnotateStaticClass3.java:158:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.65 +CantAnnotateStaticClass3.java:159:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.66 +CantAnnotateStaticClass3.java:162:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.67 +CantAnnotateStaticClass3.java:164:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.68 +CantAnnotateStaticClass3.java:166:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.69 +CantAnnotateStaticClass3.java:168:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.70 +CantAnnotateStaticClass3.java:170:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.71 +CantAnnotateStaticClass3.java:172:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.72 +CantAnnotateStaticClass3.java:177:35: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.73 +CantAnnotateStaticClass3.java:179:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.74 +CantAnnotateStaticClass3.java:180:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.75 +CantAnnotateStaticClass3.java:185:35: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.76 +CantAnnotateStaticClass3.java:187:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.77 +CantAnnotateStaticClass3.java:188:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.78 +CantAnnotateStaticClass3.java:193:35: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.79 +CantAnnotateStaticClass3.java:195:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.80 +CantAnnotateStaticClass3.java:196:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.81 +CantAnnotateStaticClass3.java:200:35: compiler.err.cant.type.annotate.scoping.1: @Top.TA 39.82 +CantAnnotateStaticClass3.java:201:38: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.83 +CantAnnotateStaticClass3.java:202:41: compiler.err.cant.type.annotate.scoping.1: @Top.TA 39.84 +CantAnnotateStaticClass3.java:203:44: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.85 +CantAnnotateStaticClass3.java:204:44: compiler.err.cant.type.annotate.scoping.1: @Top.TB 39.86 +82 errors 39.87 \ No newline at end of file
40.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/IncompleteArray.java Tue Oct 15 22:15:35 2013 +0200 40.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/IncompleteArray.java Tue Oct 15 15:57:13 2013 -0700 40.3 @@ -5,8 +5,11 @@ 40.4 * @author Mahmood Ali 40.5 * @compile/fail/ref=IncompleteArray.out -XDrawDiagnostics IncompleteArray.java 40.6 */ 40.7 +import java.lang.annotation.*; 40.8 + 40.9 class IncompleteArray { 40.10 int @A [] @A var; 40.11 } 40.12 40.13 +@Target(ElementType.TYPE_USE) 40.14 @interface A { }
41.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/IncompleteArray.out Tue Oct 15 22:15:35 2013 +0200 41.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/IncompleteArray.out Tue Oct 15 15:57:13 2013 -0700 41.3 @@ -1,2 +1,2 @@ 41.4 -IncompleteArray.java:9:13: compiler.err.illegal.start.of.type 41.5 +IncompleteArray.java:11:13: compiler.err.illegal.start.of.type 41.6 1 error
42.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/IncompleteVararg.java Tue Oct 15 22:15:35 2013 +0200 42.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 42.3 @@ -1,13 +0,0 @@ 42.4 -/* 42.5 - * @test /nodynamiccopyright/ 42.6 - * @bug 6843077 8006775 42.7 - * @summary test incomplete vararg declaration 42.8 - * @author Mahmood Ali 42.9 - * @compile/fail/ref=IncompleteVararg.out -XDrawDiagnostics IncompleteVararg.java 42.10 - */ 42.11 -class IncompleteArray { 42.12 - // the last variable may be vararg 42.13 - void method(int @A test) { } 42.14 -} 42.15 - 42.16 -@interface A { }
43.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/IncompleteVararg.out Tue Oct 15 22:15:35 2013 +0200 43.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 43.3 @@ -1,2 +0,0 @@ 43.4 -IncompleteVararg.java:10:19: compiler.err.illegal.start.of.type 43.5 -1 error
44.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/IndexArray.java Tue Oct 15 22:15:35 2013 +0200 44.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/IndexArray.java Tue Oct 15 15:57:13 2013 -0700 44.3 @@ -5,9 +5,12 @@ 44.4 * @author Mahmood Ali 44.5 * @compile/fail/ref=IndexArray.out -XDrawDiagnostics IndexArray.java 44.6 */ 44.7 +import java.lang.annotation.*; 44.8 + 44.9 class IndexArray { 44.10 int[] var; 44.11 int a = var @A [1]; 44.12 } 44.13 44.14 +@Target(ElementType.TYPE_USE) 44.15 @interface A { }
45.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/IndexArray.out Tue Oct 15 22:15:35 2013 +0200 45.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/IndexArray.out Tue Oct 15 15:57:13 2013 -0700 45.3 @@ -1,2 +1,2 @@ 45.4 -IndexArray.java:10:15: compiler.err.illegal.start.of.expr 45.5 +IndexArray.java:12:15: compiler.err.illegal.start.of.expr 45.6 1 error
46.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/LintCast.out Tue Oct 15 22:15:35 2013 +0200 46.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/LintCast.out Tue Oct 15 15:57:13 2013 -0700 46.3 @@ -1,11 +1,11 @@ 46.4 LintCast.java:15:21: compiler.warn.redundant.cast: java.lang.String 46.5 LintCast.java:21:27: compiler.warn.redundant.cast: java.util.List<java.lang.String> 46.6 -LintCast.java:27:20: compiler.warn.redundant.cast: int @A [] 46.7 +LintCast.java:27:20: compiler.warn.redundant.cast: int[] 46.8 LintCast.java:39:24: compiler.warn.redundant.cast: java.lang.String 46.9 LintCast.java:40:26: compiler.warn.redundant.cast: java.lang.String 46.10 -LintCast.java:45:23: compiler.warn.redundant.cast: java.lang.Object @A [] 46.11 +LintCast.java:45:23: compiler.warn.redundant.cast: java.lang.Object[] 46.12 LintCast.java:49:27: compiler.warn.redundant.cast: java.util.List<java.lang.String> 46.13 -LintCast.java:53:27: compiler.warn.redundant.cast: java.util.List<@A java.lang.String> 46.14 +LintCast.java:53:27: compiler.warn.redundant.cast: java.util.List<java.lang.String> 46.15 LintCast.java:57:21: compiler.warn.redundant.cast: java.lang.Object 46.16 LintCast.java:61:27: compiler.warn.redundant.cast: LintCast.Outer.Inner 46.17 10 warnings 46.18 \ No newline at end of file
47.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/OldArray.java Tue Oct 15 22:15:35 2013 +0200 47.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/OldArray.java Tue Oct 15 15:57:13 2013 -0700 47.3 @@ -1,35 +1,16 @@ 47.4 /* 47.5 - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. 47.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 47.7 - * 47.8 - * This code is free software; you can redistribute it and/or modify it 47.9 - * under the terms of the GNU General Public License version 2 only, as 47.10 - * published by the Free Software Foundation. 47.11 - * 47.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 47.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 47.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 47.15 - * version 2 for more details (a copy is included in the LICENSE file that 47.16 - * accompanied this code). 47.17 - * 47.18 - * You should have received a copy of the GNU General Public License version 47.19 - * 2 along with this work; if not, write to the Free Software Foundation, 47.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 47.21 - * 47.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 47.23 - * or visit www.oracle.com if you need additional information or have any 47.24 - * questions. 47.25 - */ 47.26 - 47.27 -/* 47.28 + * @test /nodynamiccopyright/ 47.29 * @test 47.30 * @bug 6843077 8006775 47.31 * @summary test old array syntax 47.32 * @author Mahmood Ali 47.33 - * @compile/fail -XDrawDiagnostics OldArray.java 47.34 + * @compile/fail/ref=OldArray.out -XDrawDiagnostics OldArray.java 47.35 */ 47.36 +import java.lang.annotation.*; 47.37 + 47.38 class OldArray { 47.39 String [@A] s() { return null; } 47.40 } 47.41 47.42 +@Target(ElementType.TYPE_USE) 47.43 @interface A { }
48.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 48.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/OldArray.out Tue Oct 15 15:57:13 2013 -0700 48.3 @@ -0,0 +1,10 @@ 48.4 +OldArray.java:12:11: compiler.err.expected: ']' 48.5 +OldArray.java:12:13: compiler.err.expected: token.identifier 48.6 +OldArray.java:12:14: compiler.err.expected: ';' 48.7 +OldArray.java:12:17: compiler.err.illegal.start.of.type 48.8 +OldArray.java:12:18: compiler.err.expected: token.identifier 48.9 +OldArray.java:12:19: compiler.err.expected: ';' 48.10 +OldArray.java:12:22: compiler.err.illegal.start.of.type 48.11 +OldArray.java:12:28: compiler.err.expected: token.identifier 48.12 +OldArray.java:13:1: compiler.err.expected3: class, interface, enum 48.13 +9 errors
49.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/Scopes.java Tue Oct 15 22:15:35 2013 +0200 49.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/Scopes.java Tue Oct 15 15:57:13 2013 -0700 49.3 @@ -1,17 +1,16 @@ 49.4 /* 49.5 * @test /nodynamiccopyright/ 49.6 * @bug 6843077 8006775 49.7 - * @summary check that A is accessible in the class type parameters 49.8 + * @summary Unqualified inner type annotation not in scope. 49.9 * @author Mahmood Ali 49.10 * @compile/fail/ref=Scopes.out -XDrawDiagnostics Scopes.java 49.11 */ 49.12 -class Scopes<T extends @UniqueInner Object> { 49.13 - // UniqueInner is not visible in the type parameters. 49.14 - // One has to use Scopes.UniqueInner. 49.15 - // Annotations with the default @Target are not allowed there, 49.16 - // so we also get the second error about the invalid location. 49.17 - // Adding the target here doesn't matter, as we don't resolve 49.18 - // the annotation type. 49.19 - // @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 49.20 - @interface UniqueInner { }; 49.21 +import java.lang.annotation.*; 49.22 + 49.23 +@InnerTA 49.24 +class Scopes<@InnerTA T extends @InnerTA Object> { 49.25 + // The simple name TA is not in scope on header of class. 49.26 + // One has to use @Scopes.TA. 49.27 + @Target(ElementType.TYPE_USE) 49.28 + @interface InnerTA { }; 49.29 }
50.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/Scopes.out Tue Oct 15 22:15:35 2013 +0200 50.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/Scopes.out Tue Oct 15 15:57:13 2013 -0700 50.3 @@ -1,3 +1,4 @@ 50.4 -Scopes.java:8:25: compiler.err.cant.resolve: kindname.class, UniqueInner, , 50.5 -Scopes.java:8:24: compiler.err.annotation.type.not.applicable 50.6 -2 errors 50.7 +Scopes.java:10:2: compiler.err.cant.resolve: kindname.class, InnerTA, , 50.8 +Scopes.java:11:34: compiler.err.cant.resolve: kindname.class, InnerTA, , 50.9 +Scopes.java:11:15: compiler.err.cant.resolve: kindname.class, InnerTA, , 50.10 +3 errors
51.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/StaticFields.java Tue Oct 15 22:15:35 2013 +0200 51.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/StaticFields.java Tue Oct 15 15:57:13 2013 -0700 51.3 @@ -5,9 +5,23 @@ 51.4 * @author Mahmood Ali 51.5 * @compile/fail/ref=StaticFields.out -XDrawDiagnostics StaticFields.java 51.6 */ 51.7 +import java.lang.annotation.*; 51.8 + 51.9 class C { 51.10 - int f; 51.11 + static int f; 51.12 + // static block 51.13 + static { 51.14 + @A C.f = 1; 51.15 + } 51.16 + // static ref 51.17 int a = @A C.f; 51.18 + // static method 51.19 + static int f() { return @A C.f; } 51.20 + // main 51.21 + public static void main(String... args) { 51.22 + int a = @A C.f; 51.23 + } 51.24 } 51.25 51.26 +@Target(ElementType.TYPE_USE) 51.27 @interface A { }
52.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/StaticFields.out Tue Oct 15 22:15:35 2013 +0200 52.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/StaticFields.out Tue Oct 15 15:57:13 2013 -0700 52.3 @@ -1,2 +1,5 @@ 52.4 -StaticFields.java:10:17: compiler.err.illegal.start.of.expr 52.5 -1 error 52.6 +StaticFields.java:14:11: compiler.err.expected: token.identifier 52.7 +StaticFields.java:17:17: compiler.err.illegal.start.of.expr 52.8 +StaticFields.java:19:33: compiler.err.illegal.start.of.expr 52.9 +StaticFields.java:22:19: compiler.err.illegal.start.of.expr 52.10 +4 errors 52.11 \ No newline at end of file
53.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/StaticMethods.java Tue Oct 15 22:15:35 2013 +0200 53.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 53.3 @@ -1,12 +0,0 @@ 53.4 -/* 53.5 - * @test /nodynamiccopyright/ 53.6 - * @bug 6843077 8006775 53.7 - * @summary static methods don't have receivers 53.8 - * @author Mahmood Ali 53.9 - * @compile/fail/ref=StaticMethods.out -XDrawDiagnostics StaticMethods.java 53.10 - */ 53.11 -class StaticMethods { 53.12 - static void main(StaticMethods this) { } 53.13 -} 53.14 - 53.15 -@interface A { }
54.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/StaticMethods.out Tue Oct 15 22:15:35 2013 +0200 54.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 54.3 @@ -1,2 +0,0 @@ 54.4 -StaticMethods.java:9:34: compiler.err.non-static.cant.be.ref: kindname.variable, this 54.5 -1 error
55.1 --- a/test/tools/javac/annotations/typeAnnotations/failures/TypeVariableCycleTest.java Tue Oct 15 22:15:35 2013 +0200 55.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/TypeVariableCycleTest.java Tue Oct 15 15:57:13 2013 -0700 55.3 @@ -35,10 +35,12 @@ 55.4 55.5 class TypeVariableCycleTest<CTV> { 55.6 <MTV extends @TA CTV> MTV cast(CTV p) { 55.7 - return (@TA MTV) p; 55.8 + return (@TB MTV) p; 55.9 } 55.10 } 55.11 55.12 -@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) 55.13 +@Target(ElementType.TYPE_USE) 55.14 @interface TA {} 55.15 55.16 +@Target(ElementType.TYPE_USE) 55.17 +@interface TB {}
56.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 56.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/TypeVariableMissingTA.java Tue Oct 15 15:57:13 2013 -0700 56.3 @@ -0,0 +1,39 @@ 56.4 +/* 56.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 56.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 56.7 + * 56.8 + * This code is free software; you can redistribute it and/or modify it 56.9 + * under the terms of the GNU General Public License version 2 only, as 56.10 + * published by the Free Software Foundation. 56.11 + * 56.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 56.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 56.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 56.15 + * version 2 for more details (a copy is included in the LICENSE file that 56.16 + * accompanied this code). 56.17 + * 56.18 + * You should have received a copy of the GNU General Public License version 56.19 + * 2 along with this work; if not, write to the Free Software Foundation, 56.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 56.21 + * 56.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 56.23 + * or visit www.oracle.com if you need additional information or have any 56.24 + * questions. 56.25 + */ 56.26 + 56.27 +/* 56.28 + * @test 56.29 + * @bug 1234567 56.30 + * @summary A missing annotation type in a type variable bound 56.31 + * should result in the same errors with and without an 56.32 + * annotation processor. 56.33 + * @author Werner Dietl 56.34 + * 56.35 + * @compile DummyProcessor.java 56.36 + * @compile/fail/ref=TypeVariableMissingTA.out -XDrawDiagnostics TypeVariableMissingTA.java 56.37 + * @compile/fail/ref=TypeVariableMissingTA.out -XDrawDiagnostics -cp . -processor DummyProcessor TypeVariableMissingTA.java 56.38 + */ 56.39 + 56.40 +import java.lang.annotation.*; 56.41 + 56.42 +class TypeVariableMissingTA<T extends @MISSING Object> {}
57.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 57.2 +++ b/test/tools/javac/annotations/typeAnnotations/failures/TypeVariableMissingTA.out Tue Oct 15 15:57:13 2013 -0700 57.3 @@ -0,0 +1,2 @@ 57.4 +TypeVariableMissingTA.java:39:40: compiler.err.cant.resolve: kindname.class, MISSING, , 57.5 +1 error 57.6 \ No newline at end of file
58.1 --- a/test/tools/javac/diags/examples/CantAnnotateNestedType.java Tue Oct 15 22:15:35 2013 +0200 58.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 58.3 @@ -1,41 +0,0 @@ 58.4 -/* 58.5 - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 58.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 58.7 - * 58.8 - * This code is free software; you can redistribute it and/or modify it 58.9 - * under the terms of the GNU General Public License version 2 only, as 58.10 - * published by the Free Software Foundation. 58.11 - * 58.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 58.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 58.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 58.15 - * version 2 for more details (a copy is included in the LICENSE file that 58.16 - * accompanied this code). 58.17 - * 58.18 - * You should have received a copy of the GNU General Public License version 58.19 - * 2 along with this work; if not, write to the Free Software Foundation, 58.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 58.21 - * 58.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 58.23 - * or visit www.oracle.com if you need additional information or have any 58.24 - * questions. 58.25 - */ 58.26 - 58.27 -// key: compiler.err.cant.annotate.nested.type 58.28 - 58.29 -import java.lang.annotation.*; 58.30 - 58.31 -class CantAnnotateStaticClass { 58.32 - @Target(ElementType.TYPE_USE) 58.33 - @interface A {} 58.34 - 58.35 - interface Outer { 58.36 - interface Inner {} 58.37 - } 58.38 - 58.39 - // Error: 58.40 - @A Outer.Inner f; 58.41 - 58.42 - // OK: 58.43 - @A Outer g; 58.44 -}
59.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 59.2 +++ b/test/tools/javac/diags/examples/CantAnnotateScoping.java Tue Oct 15 15:57:13 2013 -0700 59.3 @@ -0,0 +1,43 @@ 59.4 +/* 59.5 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 59.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 59.7 + * 59.8 + * This code is free software; you can redistribute it and/or modify it 59.9 + * under the terms of the GNU General Public License version 2 only, as 59.10 + * published by the Free Software Foundation. 59.11 + * 59.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 59.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 59.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 59.15 + * version 2 for more details (a copy is included in the LICENSE file that 59.16 + * accompanied this code). 59.17 + * 59.18 + * You should have received a copy of the GNU General Public License version 59.19 + * 2 along with this work; if not, write to the Free Software Foundation, 59.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 59.21 + * 59.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 59.23 + * or visit www.oracle.com if you need additional information or have any 59.24 + * questions. 59.25 + */ 59.26 + 59.27 +// key: compiler.err.cant.type.annotate.scoping 59.28 + 59.29 +import java.lang.annotation.*; 59.30 + 59.31 +class CantAnnotateScoping { 59.32 + @Target(ElementType.TYPE_USE) 59.33 + @interface TA {} 59.34 + @Target(ElementType.TYPE_USE) 59.35 + @interface TB {} 59.36 + 59.37 + interface Outer { 59.38 + interface Inner {} 59.39 + } 59.40 + 59.41 + // Error: 59.42 + @TA @TB Outer.Inner f; 59.43 + 59.44 + // OK: 59.45 + @TA @TB Outer g; 59.46 +}
60.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 60.2 +++ b/test/tools/javac/diags/examples/CantAnnotateScoping1.java Tue Oct 15 15:57:13 2013 -0700 60.3 @@ -0,0 +1,41 @@ 60.4 +/* 60.5 + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 60.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 60.7 + * 60.8 + * This code is free software; you can redistribute it and/or modify it 60.9 + * under the terms of the GNU General Public License version 2 only, as 60.10 + * published by the Free Software Foundation. 60.11 + * 60.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 60.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 60.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 60.15 + * version 2 for more details (a copy is included in the LICENSE file that 60.16 + * accompanied this code). 60.17 + * 60.18 + * You should have received a copy of the GNU General Public License version 60.19 + * 2 along with this work; if not, write to the Free Software Foundation, 60.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 60.21 + * 60.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 60.23 + * or visit www.oracle.com if you need additional information or have any 60.24 + * questions. 60.25 + */ 60.26 + 60.27 +// key: compiler.err.cant.type.annotate.scoping.1 60.28 + 60.29 +import java.lang.annotation.*; 60.30 + 60.31 +class CantAnnotateNestedType { 60.32 + @Target(ElementType.TYPE_USE) 60.33 + @interface TA {} 60.34 + 60.35 + interface Outer { 60.36 + interface Inner {} 60.37 + } 60.38 + 60.39 + // Error: 60.40 + @TA Outer.Inner f; 60.41 + 60.42 + // OK: 60.43 + @TA Outer g; 60.44 +}
61.1 --- a/test/tools/javac/diags/examples/CantAnnotateStaticClass.java Tue Oct 15 22:15:35 2013 +0200 61.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 61.3 @@ -1,41 +0,0 @@ 61.4 -/* 61.5 - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 61.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 61.7 - * 61.8 - * This code is free software; you can redistribute it and/or modify it 61.9 - * under the terms of the GNU General Public License version 2 only, as 61.10 - * published by the Free Software Foundation. 61.11 - * 61.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 61.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 61.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 61.15 - * version 2 for more details (a copy is included in the LICENSE file that 61.16 - * accompanied this code). 61.17 - * 61.18 - * You should have received a copy of the GNU General Public License version 61.19 - * 2 along with this work; if not, write to the Free Software Foundation, 61.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 61.21 - * 61.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 61.23 - * or visit www.oracle.com if you need additional information or have any 61.24 - * questions. 61.25 - */ 61.26 - 61.27 -// key: compiler.err.cant.annotate.static.class 61.28 - 61.29 -import java.lang.annotation.*; 61.30 - 61.31 -class CantAnnotateStaticClass { 61.32 - @Target(ElementType.TYPE_USE) 61.33 - @interface A {} 61.34 - 61.35 - static class Outer { 61.36 - class Inner {} 61.37 - } 61.38 - 61.39 - // Error: 61.40 - @A Outer.Inner f; 61.41 - 61.42 - // OK: 61.43 - @A Outer g; 61.44 -}
62.1 --- a/test/tools/javac/lib/DPrinter.java Tue Oct 15 22:15:35 2013 +0200 62.2 +++ b/test/tools/javac/lib/DPrinter.java Tue Oct 15 15:57:13 2013 -0700 62.3 @@ -946,8 +946,8 @@ 62.4 */ 62.5 public class TypeVisitor implements Type.Visitor<Void,Void> { 62.6 public Void visitAnnotatedType(AnnotatedType type, Void ignore) { 62.7 - printList("typeAnnotations", type.typeAnnotations); 62.8 - printType("underlyingType", type.underlyingType, Details.FULL); 62.9 + printList("typeAnnotations", type.getAnnotationMirrors()); 62.10 + printType("underlyingType", type.unannotatedType(), Details.FULL); 62.11 return visitType(type, null); 62.12 } 62.13
63.1 --- a/test/tools/javac/processing/model/type/BasicAnnoTests.java Tue Oct 15 22:15:35 2013 +0200 63.2 +++ b/test/tools/javac/processing/model/type/BasicAnnoTests.java Tue Oct 15 15:57:13 2013 -0700 63.3 @@ -26,6 +26,7 @@ 63.4 * @bug 1234567 63.5 * @summary Annotations on types 63.6 * @library /tools/javac/lib 63.7 + * @ignore 63.8 * @build JavacTestingAbstractProcessor DPrinter BasicAnnoTests 63.9 * @compile/process -processor BasicAnnoTests -proc:only BasicAnnoTests.java 63.10 */