8023833: Replace direct use of AnnotatedType in javadoc code

Reviewed-by: darcy
This commit is contained in:
Jonathan Gibbons 2013-08-29 19:19:23 -07:00
parent 9ffac2cf47
commit d7bccbe430
3 changed files with 7 additions and 10 deletions

View File

@ -40,7 +40,7 @@ import com.sun.tools.javac.util.List;
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 @@ public class AnnotatedTypeImpl
*/
@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 @@ public class AnnotatedTypeImpl
@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

View File

@ -63,10 +63,8 @@ public class TypeMaker {
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 @@ public class TypeMaker {
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:

View File

@ -140,7 +140,7 @@ public class TypeVariableImpl extends AbstractTypeImpl implements TypeVariable {
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) {