913
914 @DefinedBy(Api.LANGUAGE_MODEL)
915 public Type getSuperBound() {
916 if (kind == SUPER)
917 return type;
918 else
919 return null;
920 }
921
922 @DefinedBy(Api.LANGUAGE_MODEL)
923 public TypeKind getKind() {
924 return TypeKind.WILDCARD;
925 }
926
927 @DefinedBy(Api.LANGUAGE_MODEL)
928 public <R, P> R accept(TypeVisitor<R, P> v, P p) {
929 return v.visitWildcard(this, p);
930 }
931 }
932
933 public static class ClassType extends Type implements DeclaredType {
934
935 /** The enclosing type of this type. If this is the type of an inner
936 * class, outer_field refers to the type of its enclosing
937 * instance class, in all other cases it refers to noType.
938 */
939 private Type outer_field;
940
941 /** The type parameters of this type (to be set once class is loaded).
942 */
943 public List<Type> typarams_field;
944
945 /** A cache variable for the type parameters of this type,
946 * appended to all parameters of its enclosing class.
947 * @see #allparams
948 */
949 public List<Type> allparams_field;
950
951 /** The supertype of this class (to be set once class is loaded).
952 */
953 public Type supertype_field;
1124 this != tsym.type && // necessary, but not sufficient condition
1125 tsym.type.allparams().nonEmpty() &&
1126 allparams().isEmpty();
1127 }
1128
1129 public boolean contains(Type elem) {
1130 return
1131 elem.equalsIgnoreMetadata(this)
1132 || (isParameterized()
1133 && (getEnclosingType().contains(elem) || contains(getTypeArguments(), elem)))
1134 || (isCompound()
1135 && (supertype_field.contains(elem) || contains(interfaces_field, elem)));
1136 }
1137
1138 public void complete() {
1139 tsym.complete();
1140 }
1141
1142 @DefinedBy(Api.LANGUAGE_MODEL)
1143 public TypeKind getKind() {
1144 return TypeKind.DECLARED;
1145 }
1146
1147 @DefinedBy(Api.LANGUAGE_MODEL)
1148 public <R, P> R accept(TypeVisitor<R, P> v, P p) {
1149 return v.visitDeclared(this, p);
1150 }
1151 }
1152
1153 public static class ErasedClassType extends ClassType {
1154 public ErasedClassType(Type outer, TypeSymbol tsym,
1155 TypeMetadata metadata) {
1156 super(outer, List.nil(), tsym, metadata);
1157 }
1158
1159 @Override
1160 public boolean hasErasedSupertypes() {
1161 return true;
1162 }
1163 }
1164
|
913
914 @DefinedBy(Api.LANGUAGE_MODEL)
915 public Type getSuperBound() {
916 if (kind == SUPER)
917 return type;
918 else
919 return null;
920 }
921
922 @DefinedBy(Api.LANGUAGE_MODEL)
923 public TypeKind getKind() {
924 return TypeKind.WILDCARD;
925 }
926
927 @DefinedBy(Api.LANGUAGE_MODEL)
928 public <R, P> R accept(TypeVisitor<R, P> v, P p) {
929 return v.visitWildcard(this, p);
930 }
931 }
932
933 public static class ClassType extends Type implements DeclaredType,
934 javax.lang.model.type.ErrorType {
935
936 /** The enclosing type of this type. If this is the type of an inner
937 * class, outer_field refers to the type of its enclosing
938 * instance class, in all other cases it refers to noType.
939 */
940 private Type outer_field;
941
942 /** The type parameters of this type (to be set once class is loaded).
943 */
944 public List<Type> typarams_field;
945
946 /** A cache variable for the type parameters of this type,
947 * appended to all parameters of its enclosing class.
948 * @see #allparams
949 */
950 public List<Type> allparams_field;
951
952 /** The supertype of this class (to be set once class is loaded).
953 */
954 public Type supertype_field;
1125 this != tsym.type && // necessary, but not sufficient condition
1126 tsym.type.allparams().nonEmpty() &&
1127 allparams().isEmpty();
1128 }
1129
1130 public boolean contains(Type elem) {
1131 return
1132 elem.equalsIgnoreMetadata(this)
1133 || (isParameterized()
1134 && (getEnclosingType().contains(elem) || contains(getTypeArguments(), elem)))
1135 || (isCompound()
1136 && (supertype_field.contains(elem) || contains(interfaces_field, elem)));
1137 }
1138
1139 public void complete() {
1140 tsym.complete();
1141 }
1142
1143 @DefinedBy(Api.LANGUAGE_MODEL)
1144 public TypeKind getKind() {
1145 tsym.apiComplete();
1146 return tsym.kind == TYP ? TypeKind.DECLARED : TypeKind.ERROR;
1147 }
1148
1149 @DefinedBy(Api.LANGUAGE_MODEL)
1150 public <R, P> R accept(TypeVisitor<R, P> v, P p) {
1151 return v.visitDeclared(this, p);
1152 }
1153 }
1154
1155 public static class ErasedClassType extends ClassType {
1156 public ErasedClassType(Type outer, TypeSymbol tsym,
1157 TypeMetadata metadata) {
1158 super(outer, List.nil(), tsym, metadata);
1159 }
1160
1161 @Override
1162 public boolean hasErasedSupertypes() {
1163 return true;
1164 }
1165 }
1166
|