8023833: Replace direct use of AnnotatedType in javadoc code
authorjjg
Thu, 29 Aug 2013 19:19:23 -0700
changeset 19906 2698aaacb4b2
parent 19670 197392292aad
child 19907 41ae54351dea
8023833: Replace direct use of AnnotatedType in javadoc code Reviewed-by: darcy
langtools/src/share/classes/com/sun/tools/javadoc/AnnotatedTypeImpl.java
langtools/src/share/classes/com/sun/tools/javadoc/TypeMaker.java
langtools/src/share/classes/com/sun/tools/javadoc/TypeVariableImpl.java
--- a/langtools/src/share/classes/com/sun/tools/javadoc/AnnotatedTypeImpl.java	Thu Aug 29 12:11:36 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/AnnotatedTypeImpl.java	Thu Aug 29 19:19:23 2013 -0700
@@ -40,7 +40,7 @@
 public class AnnotatedTypeImpl
         extends AbstractTypeImpl implements AnnotatedType {
 
-    AnnotatedTypeImpl(DocEnv env, com.sun.tools.javac.code.Type.AnnotatedType type) {
+    AnnotatedTypeImpl(DocEnv env, com.sun.tools.javac.code.Type type) {
         super(env, type);
     }
 
@@ -50,7 +50,7 @@
      */
     @Override
     public AnnotationDesc[] annotations() {
-        List<TypeCompound> tas = ((com.sun.tools.javac.code.Type.AnnotatedType)type).typeAnnotations;
+        List<? extends TypeCompound> tas = type.getAnnotationMirrors();
         if (tas == null ||
                 tas.isEmpty()) {
             return new AnnotationDesc[0];
@@ -65,7 +65,7 @@
 
     @Override
     public com.sun.javadoc.Type underlyingType() {
-        return TypeMaker.getType(env, ((com.sun.tools.javac.code.Type.AnnotatedType)type).underlyingType, true, false);
+        return TypeMaker.getType(env, type.unannotatedType(), true, false);
     }
 
     @Override
--- a/langtools/src/share/classes/com/sun/tools/javadoc/TypeMaker.java	Thu Aug 29 12:11:36 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/TypeMaker.java	Thu Aug 29 19:19:23 2013 -0700
@@ -63,10 +63,8 @@
             t = env.types.erasure(t);
         }
 
-        if (considerAnnotations &&
-                t.isAnnotated()) {
-            Type.AnnotatedType at = (Type.AnnotatedType) t;
-            return new AnnotatedTypeImpl(env, at);
+        if (considerAnnotations && t.isAnnotated()) {
+            return new AnnotatedTypeImpl(env, t);
         }
 
         switch (t.getTag()) {
@@ -143,8 +141,7 @@
     static String getTypeString(DocEnv env, Type t, boolean full) {
         // TODO: should annotations be included here?
         if (t.isAnnotated()) {
-            Type.AnnotatedType at = (Type.AnnotatedType)t;
-            t = at.underlyingType;
+            t = t.unannotatedType();
         }
         switch (t.getTag()) {
         case ARRAY:
--- a/langtools/src/share/classes/com/sun/tools/javadoc/TypeVariableImpl.java	Thu Aug 29 12:11:36 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/TypeVariableImpl.java	Thu Aug 29 19:19:23 2013 -0700
@@ -140,7 +140,7 @@
         if (!type.isAnnotated()) {
             return new AnnotationDesc[0];
         }
-        List<TypeCompound> tas = ((com.sun.tools.javac.code.Type.AnnotatedType) type).typeAnnotations;
+        List<? extends TypeCompound> tas = type.getAnnotationMirrors();
         AnnotationDesc res[] = new AnnotationDesc[tas.length()];
         int i = 0;
         for (Attribute.Compound a : tas) {