OpenJDK / type-annotations / type-annotations / langtools
changeset 3093:4d6bcc50a30a
Automated merge with http://hg.openjdk.java.net/jdk8/tl/langtools
author | wmdietl |
---|---|
date | Thu, 05 Dec 2013 16:51:09 -0500 |
parents | 4a2ed1900428 882808d3b51f |
children | 3705299024dc |
files | |
diffstat | 25 files changed, 71 insertions(+), 69 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Wed Dec 04 15:39:36 2013 -0800 +++ b/.hgtags Thu Dec 05 16:51:09 2013 -0500 @@ -140,6 +140,7 @@ 1cbe86c11ba69521875c0b0357d7540781eb334d jdk8-b17 ec2c0973cc31e143cffc05ceb63d98fae76f97d4 jdk8-b16 ab1b1cc7857716914f2bb20b3128e5a8978290f7 jdk8-b18 +2a2d6ac056cfde7326f309ab73b8cddf518cc729 308-jdk8-sync 77b2c066084cbc75150efc6603a713c558329813 jdk8-b19 ffd294128a48cbb90ce8f0569f82b61f1f164a18 jdk8-b20 bcb21abf1c4177baf4574f99709513dcd4474727 jdk8-b21
--- a/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Wed Dec 04 15:39:36 2013 -0800 +++ b/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Thu Dec 05 16:51:09 2013 -0500 @@ -72,7 +72,6 @@ import com.sun.tools.javac.util.ListBuffer; import com.sun.tools.javac.util.Log; import com.sun.tools.javac.util.Names; -import com.sun.tools.javac.util.Options; /** * Contains operations specific to processing type annotations. @@ -105,7 +104,6 @@ syms = Symtab.instance(context); annotate = Annotate.instance(context); attr = Attr.instance(context); - Options options = Options.instance(context); } /**
--- a/src/share/classes/com/sun/tools/javac/comp/Check.java Wed Dec 04 15:39:36 2013 -0800 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Dec 05 16:51:09 2013 -0500 @@ -2740,7 +2740,7 @@ } public void validateTypeAnnotation(JCAnnotation a, boolean isTypeParameter) { - Assert.checkNonNull(a.type, "annotation tree hasn't been attributed yet: " + a); + Assert.checkNonNull(a.type); // , "annotation tree hasn't been attributed yet: " + a); validateAnnotationTree(a); if (a.hasTag(TYPE_ANNOTATION) &&
--- a/src/share/classes/com/sun/tools/javac/model/JavacTypes.java Wed Dec 04 15:39:36 2013 -0800 +++ b/src/share/classes/com/sun/tools/javac/model/JavacTypes.java Thu Dec 05 16:51:09 2013 -0500 @@ -134,8 +134,8 @@ throw new IllegalArgumentException(t.toString()); Type unboxed = types.unboxedType((Type) t); if (! unboxed.isPrimitive()) // only true primitives, not void - throw new IllegalArgumentException(t.toString()); - return (PrimitiveType)unboxed; + throw new IllegalArgumentException(String.format("unboxed (%s) is not primitive: t=%s, this=%s, this.types=%s", unboxed, t, this, this.types)); + return (PrimitiveType) unboxed; } public TypeMirror capture(TypeMirror t) {
--- a/src/share/classes/com/sun/tools/javac/parser/Scanner.java Wed Dec 04 15:39:36 2013 -0800 +++ b/src/share/classes/com/sun/tools/javac/parser/Scanner.java Thu Dec 05 16:51:09 2013 -0500 @@ -30,7 +30,6 @@ import java.util.ArrayList; import com.sun.tools.javac.util.Position.LineMap; -import com.sun.tools.javac.parser.JavaTokenizer.*; import static com.sun.tools.javac.parser.Tokens.*;
--- a/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java Wed Dec 04 15:39:36 2013 -0800 +++ b/src/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java Thu Dec 05 16:51:09 2013 -0500 @@ -47,7 +47,7 @@ /** * A rich diagnostic formatter is a formatter that provides better integration - * with javac's type system. A diagostic is first preprocessed in order to keep + * with javac's type system. A diagnostic is first preprocessed in order to keep * track of each types/symbols in it; after these informations are collected, * the diagnostic is rendered using a standard formatter, whose type/symbol printer * has been replaced by a more refined version provided by this rich formatter.
--- a/src/share/classes/javax/annotation/processing/Messager.java Wed Dec 04 15:39:36 2013 -0800 +++ b/src/share/classes/javax/annotation/processing/Messager.java Thu Dec 05 16:51:09 2013 -0500 @@ -25,9 +25,10 @@ package javax.annotation.processing; -import javax.annotation.*; +import javax.lang.model.element.AnnotationMirror; +import javax.lang.model.element.AnnotationValue; +import javax.lang.model.element.Element; import javax.tools.Diagnostic; -import javax.lang.model.element.*; /** * A {@code Messager} provides the way for an annotation processor to
--- a/src/share/classes/javax/lang/model/element/Element.java Wed Dec 04 15:39:36 2013 -0800 +++ b/src/share/classes/javax/lang/model/element/Element.java Thu Dec 05 16:51:09 2013 -0500 @@ -25,16 +25,11 @@ package javax.lang.model.element; - import java.lang.annotation.Annotation; -import java.lang.annotation.AnnotationTypeMismatchException; -import java.lang.annotation.IncompleteAnnotationException; import java.util.List; import java.util.Set; -import javax.lang.model.type.*; -import javax.lang.model.util.*; - +import javax.lang.model.type.TypeMirror; /** * Represents a program element such as a package, class, or method.
--- a/src/share/classes/javax/lang/model/type/TypeMirror.java Wed Dec 04 15:39:36 2013 -0800 +++ b/src/share/classes/javax/lang/model/type/TypeMirror.java Thu Dec 05 16:51:09 2013 -0500 @@ -25,8 +25,6 @@ package javax.lang.model.type; -import java.lang.annotation.Annotation; -import java.util.List; import javax.lang.model.element.*; import javax.lang.model.util.Types;
--- a/src/share/classes/javax/lang/model/type/TypeVariable.java Wed Dec 04 15:39:36 2013 -0800 +++ b/src/share/classes/javax/lang/model/type/TypeVariable.java Thu Dec 05 16:51:09 2013 -0500 @@ -25,11 +25,8 @@ package javax.lang.model.type; - import javax.lang.model.element.Element; import javax.lang.model.element.TypeParameterElement; -import javax.lang.model.util.Types; - /** * Represents a type variable.
--- a/src/share/classes/javax/lang/model/type/TypeVisitor.java Wed Dec 04 15:39:36 2013 -0800 +++ b/src/share/classes/javax/lang/model/type/TypeVisitor.java Thu Dec 05 16:51:09 2013 -0500 @@ -25,8 +25,6 @@ package javax.lang.model.type; -import javax.lang.model.element.*; - /** * A visitor of types, in the style of the * visitor design pattern. Classes implementing this
--- a/src/share/classes/javax/lang/model/util/Elements.java Wed Dec 04 15:39:36 2013 -0800 +++ b/src/share/classes/javax/lang/model/util/Elements.java Thu Dec 05 16:51:09 2013 -0500 @@ -25,13 +25,16 @@ package javax.lang.model.util; - import java.util.List; import java.util.Map; -import javax.lang.model.element.*; -import javax.lang.model.type.*; - +import javax.lang.model.element.AnnotationMirror; +import javax.lang.model.element.AnnotationValue; +import javax.lang.model.element.Element; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.Name; +import javax.lang.model.element.PackageElement; +import javax.lang.model.element.TypeElement; /** * Utility methods for operating on program elements.
--- a/src/share/classes/javax/lang/model/util/Types.java Wed Dec 04 15:39:36 2013 -0800 +++ b/src/share/classes/javax/lang/model/util/Types.java Thu Dec 05 16:51:09 2013 -0500 @@ -25,12 +25,19 @@ package javax.lang.model.util; -import java.lang.annotation.Annotation; -import java.lang.annotation.AnnotationTypeMismatchException; -import java.lang.annotation.IncompleteAnnotationException; import java.util.List; -import javax.lang.model.element.*; -import javax.lang.model.type.*; + +import javax.lang.model.element.Element; +import javax.lang.model.element.TypeElement; +import javax.lang.model.type.ArrayType; +import javax.lang.model.type.DeclaredType; +import javax.lang.model.type.ExecutableType; +import javax.lang.model.type.NoType; +import javax.lang.model.type.NullType; +import javax.lang.model.type.PrimitiveType; +import javax.lang.model.type.TypeMirror; +import javax.lang.model.type.TypeKind; +import javax.lang.model.type.WildcardType; /** * Utility methods for operating on types.
--- a/src/share/classes/javax/tools/JavaCompiler.java Wed Dec 04 15:39:36 2013 -0800 +++ b/src/share/classes/javax/tools/JavaCompiler.java Thu Dec 05 16:51:09 2013 -0500 @@ -25,7 +25,6 @@ package javax.tools; -import java.io.File; import java.io.Writer; import java.nio.charset.Charset; import java.util.Locale;
--- a/src/share/classes/javax/tools/SimpleJavaFileObject.java Wed Dec 04 15:39:36 2013 -0800 +++ b/src/share/classes/javax/tools/SimpleJavaFileObject.java Thu Dec 05 16:51:09 2013 -0500 @@ -25,12 +25,19 @@ package javax.tools; -import java.io.*; +import java.io.CharArrayReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Reader; +import java.io.StringReader; +import java.io.Writer; import java.net.URI; import java.nio.CharBuffer; + import javax.lang.model.element.Modifier; import javax.lang.model.element.NestingKind; -import javax.tools.JavaFileObject.Kind; /** * Provides simple implementations for most methods in JavaFileObject.
--- a/src/share/classes/javax/tools/StandardJavaFileManager.java Wed Dec 04 15:39:36 2013 -0800 +++ b/src/share/classes/javax/tools/StandardJavaFileManager.java Thu Dec 05 16:51:09 2013 -0500 @@ -27,7 +27,6 @@ import java.io.File; import java.io.IOException; -import java.util.*; /** * File manager based on {@linkplain File java.io.File}. A common way
--- a/test/com/sun/javadoc/typeAnnotations/smoke/TestSmoke.java Wed Dec 04 15:39:36 2013 -0800 +++ b/test/com/sun/javadoc/typeAnnotations/smoke/TestSmoke.java Thu Dec 05 16:51:09 2013 -0500 @@ -52,24 +52,12 @@ {BUG_ID + FS + "pkg" + FS + "T0x06.html", "@DA"}, {BUG_ID + FS + "pkg" + FS + "T0x0B.html", "@DA"}, {BUG_ID + FS + "pkg" + FS + "T0x0F.html", "@DA"}, - /* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java {BUG_ID + FS + "pkg" + FS + "T0x20.html", "@DA"}, - */ - /* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java {BUG_ID + FS + "pkg" + FS + "T0x20A.html", "@DTPA"}, - */ - /* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java {BUG_ID + FS + "pkg" + FS + "T0x20B.html", "@DA"}, - */ - /* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java {BUG_ID + FS + "pkg" + FS + "T0x22.html", "@DA"}, - */ - /* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java {BUG_ID + FS + "pkg" + FS + "T0x22A.html", "@DTPA"}, - */ - /* @ignore 8013406: Test cases fail in javadoc test TestSmoke.java {BUG_ID + FS + "pkg" + FS + "T0x22B.html", "@DA"}, - */ {BUG_ID + FS + "pkg" + FS + "T0x10.html", "@DA"}, {BUG_ID + FS + "pkg" + FS + "T0x10A.html", "@DA"}, {BUG_ID + FS + "pkg" + FS + "T0x12.html", "@DA"},
--- a/test/tools/javac/annotations/typeAnnotations/classfile/T8008762.java Wed Dec 04 15:39:36 2013 -0800 +++ b/test/tools/javac/annotations/typeAnnotations/classfile/T8008762.java Thu Dec 05 16:51:09 2013 -0500 @@ -61,12 +61,12 @@ static class Test { Object mtest( Test t){ return null; } public void test() { - mtest( new Test() { + mtest( new Test() { class InnerAnon { // Test1$1$InnerAnon.class - @A @B String ai_data = null; - @A @B String ai_m(){ return null; }; + @A @B String ai_data = null; + @A @B String ai_m(){ return null; }; } - InnerAnon IA = new InnerAnon(); + InnerAnon IA = new InnerAnon(); }); } @Retention(RUNTIME) @Target(TYPE_USE) @interface A { }
--- a/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedImport.java Wed Dec 04 15:39:36 2013 -0800 +++ b/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedImport.java Thu Dec 05 16:51:09 2013 -0500 @@ -3,11 +3,11 @@ * @bug 8006775 * @summary Import clauses cannot use annotations. * @author Werner Dietl - * @ignore * @compile/fail/ref=AnnotatedImport.out -XDrawDiagnostics AnnotatedImport.java */ import java.lang.annotation.*; + import java.@A util.List; import @A java.util.Map; import java.util.@A HashMap;
--- a/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedImport.out Wed Dec 04 15:39:36 2013 -0800 +++ b/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedImport.out Thu Dec 05 16:51:09 2013 -0500 @@ -1,7 +1,7 @@ -AnnotatedImport.java:9:13: compiler.err.expected: token.identifier -AnnotatedImport.java:9:14: compiler.err.expected3: class, interface, enum -AnnotatedImport.java:10:7: compiler.err.expected: token.identifier -AnnotatedImport.java:10:10: compiler.err.expected: ';' -AnnotatedImport.java:11:18: compiler.err.expected: token.identifier -AnnotatedImport.java:11:19: compiler.err.expected3: class, interface, enum +AnnotatedImport.java:11:13: compiler.err.expected: token.identifier +AnnotatedImport.java:11:14: compiler.err.expected3: class, interface, enum +AnnotatedImport.java:12:7: compiler.err.expected: token.identifier +AnnotatedImport.java:12:10: compiler.err.expected: ';' +AnnotatedImport.java:13:18: compiler.err.expected: token.identifier +AnnotatedImport.java:13:19: compiler.err.expected3: class, interface, enum 6 errors
--- a/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage1.java Wed Dec 04 15:39:36 2013 -0800 +++ b/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage1.java Thu Dec 05 16:51:09 2013 -0500 @@ -3,11 +3,12 @@ * @bug 8006775 * @summary Package declarations cannot use annotations. * @author Werner Dietl - * @ignore * @compile/fail/ref=AnnotatedPackage1.out -XDrawDiagnostics AnnotatedPackage1.java */ -package name.@A p1.p2; +package name. @A p1.p2; + +import java.lang.annotation.*; import java.lang.annotation.*;
--- a/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass3.java Wed Dec 04 15:39:36 2013 -0800 +++ b/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass3.java Thu Dec 05 16:51:09 2013 -0500 @@ -3,7 +3,6 @@ * @bug 8006733 8006775 * @summary Ensure behavior for nested types is correct. * @author Werner Dietl - * @ignore * @compile/fail/ref=CantAnnotateStaticClass3.out -XDrawDiagnostics CantAnnotateStaticClass3.java */
--- a/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass3.out Wed Dec 04 15:39:36 2013 -0800 +++ b/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass3.out Thu Dec 05 16:51:09 2013 -0500 @@ -32,12 +32,6 @@ CantAnnotateStaticClass3.java:65:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB CantAnnotateStaticClass3.java:66:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB CantAnnotateStaticClass3.java:67:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB -CantAnnotateStaticClass3.java:99:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB -CantAnnotateStaticClass3.java:101:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB -CantAnnotateStaticClass3.java:106:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB -CantAnnotateStaticClass3.java:108:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB -CantAnnotateStaticClass3.java:113:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB -CantAnnotateStaticClass3.java:115:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB CantAnnotateStaticClass3.java:120:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB CantAnnotateStaticClass3.java:121:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB CantAnnotateStaticClass3.java:122:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB @@ -66,6 +60,12 @@ CantAnnotateStaticClass3.java:168:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB CantAnnotateStaticClass3.java:170:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB CantAnnotateStaticClass3.java:172:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB +CantAnnotateStaticClass3.java:99:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB +CantAnnotateStaticClass3.java:101:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB +CantAnnotateStaticClass3.java:106:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB +CantAnnotateStaticClass3.java:108:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB +CantAnnotateStaticClass3.java:113:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB +CantAnnotateStaticClass3.java:115:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB CantAnnotateStaticClass3.java:177:35: compiler.err.cant.type.annotate.scoping.1: @Top.TB CantAnnotateStaticClass3.java:179:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB CantAnnotateStaticClass3.java:180:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB
--- a/test/tools/javac/lib/DPrinter.java Wed Dec 04 15:39:36 2013 -0800 +++ b/test/tools/javac/lib/DPrinter.java Thu Dec 05 16:51:09 2013 -0500 @@ -403,7 +403,7 @@ printType("type", sym.type, Details.SUMMARY); printType("erasure", sym.erasure_field, Details.SUMMARY); sym.accept(symVisitor, null); - printAnnotations("annotations", sym.getAnnotations(), Details.SUMMARY); + printAnnotations("annotations", sym.getMetadata(), Details.SUMMARY); indent(-1); } }
--- a/test/tools/javac/processing/model/type/BasicAnnoTests.java Wed Dec 04 15:39:36 2013 -0800 +++ b/test/tools/javac/processing/model/type/BasicAnnoTests.java Thu Dec 05 16:51:09 2013 -0500 @@ -26,7 +26,6 @@ * @bug 1234567 * @summary Annotations on types * @library /tools/javac/lib - * @ignore * @build JavacTestingAbstractProcessor DPrinter BasicAnnoTests * @compile/process -processor BasicAnnoTests -proc:only BasicAnnoTests.java */ @@ -47,6 +46,7 @@ import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.type.ArrayType; +import javax.lang.model.type.DeclaredType; import javax.lang.model.type.ExecutableType; import javax.lang.model.type.TypeMirror; import javax.lang.model.type.TypeVariable; @@ -234,6 +234,12 @@ return super.visitWildcard(t, p); } + @Override + public R visitDeclared(DeclaredType t, P p) { + scan(t.getTypeArguments(), p); + return super.visitDeclared(t, p); + } + R scan(TypeMirror t) { return scan(t, null); } @@ -285,4 +291,10 @@ @Test(posn=3, annoType=TA.class, expect="6") public int m3(float a) throws @TA(6) Exception { return 0; } + + @Test(posn=1, annoType=TA.class, expect="7") + public java.util.List<@TA(7) String> f7; + + @Test(posn=2, annoType=TA.class, expect="8") + public void m8(java.util.List<@TA(8) String> a) { } }