src/share/classes/com/sun/tools/javac/code/Type.java

changeset 1644
40adaf938847
parent 1628
5ddecb91d843
child 1645
97f6839673d6
     1.1 --- a/src/share/classes/com/sun/tools/javac/code/Type.java	Mon Mar 18 08:46:09 2013 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Type.java	Mon Mar 18 14:40:32 2013 -0700
     1.3 @@ -246,6 +246,10 @@
     1.4          return this;
     1.5      }
     1.6  
     1.7 +    public boolean isAnnotated() {
     1.8 +        return false;
     1.9 +    }
    1.10 +
    1.11      /**
    1.12       * If this is an annotated type, return the underlying type.
    1.13       * Otherwise, return the type itself.
    1.14 @@ -1539,7 +1543,12 @@
    1.15      }
    1.16  
    1.17      public static class AnnotatedType extends Type
    1.18 -            implements javax.lang.model.type.AnnotatedType {
    1.19 +            implements
    1.20 +                javax.lang.model.type.ArrayType,
    1.21 +                javax.lang.model.type.DeclaredType,
    1.22 +                javax.lang.model.type.PrimitiveType,
    1.23 +                javax.lang.model.type.TypeVariable,
    1.24 +                javax.lang.model.type.WildcardType {
    1.25          /** The type annotations on this type.
    1.26           */
    1.27          public List<Attribute.TypeCompound> typeAnnotations;
    1.28 @@ -1552,7 +1561,7 @@
    1.29              super(underlyingType.tag, underlyingType.tsym);
    1.30              this.typeAnnotations = List.nil();
    1.31              this.underlyingType = underlyingType;
    1.32 -            Assert.check(underlyingType.getKind() != TypeKind.ANNOTATED,
    1.33 +            Assert.check(!underlyingType.isAnnotated(),
    1.34                      "Can't annotate already annotated type: " + underlyingType);
    1.35          }
    1.36  
    1.37 @@ -1561,14 +1570,19 @@
    1.38              super(underlyingType.tag, underlyingType.tsym);
    1.39              this.typeAnnotations = typeAnnotations;
    1.40              this.underlyingType = underlyingType;
    1.41 -            Assert.check(underlyingType.getKind() != TypeKind.ANNOTATED,
    1.42 +            Assert.check(!underlyingType.isAnnotated(),
    1.43                      "Can't annotate already annotated type: " + underlyingType +
    1.44                      "; adding: " + typeAnnotations);
    1.45          }
    1.46  
    1.47          @Override
    1.48 +        public boolean isAnnotated() {
    1.49 +            return true;
    1.50 +        }
    1.51 +
    1.52 +        @Override
    1.53          public TypeKind getKind() {
    1.54 -            return TypeKind.ANNOTATED;
    1.55 +            return underlyingType.getKind();
    1.56          }
    1.57  
    1.58          @Override
    1.59 @@ -1577,11 +1591,6 @@
    1.60          }
    1.61  
    1.62          @Override
    1.63 -        public TypeMirror getUnderlyingType() {
    1.64 -            return underlyingType;
    1.65 -        }
    1.66 -
    1.67 -        @Override
    1.68          public Type unannotatedType() {
    1.69              return underlyingType;
    1.70          }
    1.71 @@ -1593,7 +1602,7 @@
    1.72  
    1.73          @Override
    1.74          public <R, P> R accept(TypeVisitor<R, P> v, P p) {
    1.75 -            return v.visitAnnotated(this, p);
    1.76 +            return underlyingType.accept(v, p);
    1.77          }
    1.78  
    1.79          @Override

mercurial