com.sun.tools.javac.code.Type.TypeVar Java Examples

The following examples show how to use com.sun.tools.javac.code.Type.TypeVar. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LambdaToMethod.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Erasure destroys the implementation parameter subtype
 * relationship for intersection types
 */
boolean interfaceParameterIsIntersectionType() {
    List<Type> tl = tree.getDescriptorType(types).getParameterTypes();
    if (tree.kind == ReferenceKind.UNBOUND) {
        tl = tl.tail;
    }
    for (; tl.nonEmpty(); tl = tl.tail) {
        Type pt = tl.head;
        if (pt.getKind() == TypeKind.TYPEVAR) {
            TypeVar tv = (TypeVar) pt;
            if (tv.bound.getKind() == TypeKind.INTERSECTION) {
                return true;
            }
        }
    }
    return false;
}
 
Example #2
Source File: LambdaToMethod.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Erasure destroys the implementation parameter subtype
 * relationship for intersection types
 */
boolean interfaceParameterIsIntersectionType() {
    List<Type> tl = tree.getDescriptorType(types).getParameterTypes();
    if (tree.kind == ReferenceKind.UNBOUND) {
        tl = tl.tail;
    }
    for (; tl.nonEmpty(); tl = tl.tail) {
        Type pt = tl.head;
        if (pt.getKind() == TypeKind.TYPEVAR) {
            TypeVar tv = (TypeVar) pt;
            if (tv.bound.getKind() == TypeKind.INTERSECTION) {
                return true;
            }
        }
    }
    return false;
}
 
Example #3
Source File: LambdaToMethod.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Erasure destroys the implementation parameter subtype
 * relationship for intersection types
 */
boolean interfaceParameterIsIntersectionType() {
    List<Type> tl = tree.getDescriptorType(types).getParameterTypes();
    if (tree.kind == ReferenceKind.UNBOUND) {
        tl = tl.tail;
    }
    for (; tl.nonEmpty(); tl = tl.tail) {
        Type pt = tl.head;
        if (pt.getKind() == TypeKind.TYPEVAR) {
            TypeVar tv = (TypeVar) pt;
            if (tv.bound.getKind() == TypeKind.INTERSECTION) {
                return true;
            }
        }
    }
    return false;
}
 
Example #4
Source File: VarTypePrinter.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Type visitTypeVar(TypeVar t, Boolean upward) {
    if (vars.contains(t)) {
        try {
            if (seen.add(t)) {
                return (upward ?
                        t.getUpperBound() :
                        (t.getLowerBound() == null) ?
                                syms.botType :
                                t.getLowerBound())
                            .map(this, upward);
            } else {
                //cycle
                return syms.objectType;
            }
        } finally {
            seen.remove(t);
        }
    } else {
        return t;
    }
}
 
Example #5
Source File: LambdaToMethod.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Erasure destroys the implementation parameter subtype
 * relationship for intersection types
 */
boolean interfaceParameterIsIntersectionType() {
    List<Type> tl = tree.getDescriptorType(types).getParameterTypes();
    if (tree.kind == ReferenceKind.UNBOUND) {
        tl = tl.tail;
    }
    for (; tl.nonEmpty(); tl = tl.tail) {
        Type pt = tl.head;
        if (pt.getKind() == TypeKind.TYPEVAR) {
            TypeVar tv = (TypeVar) pt;
            if (tv.bound.getKind() == TypeKind.INTERSECTION) {
                return true;
            }
        }
    }
    return false;
}
 
Example #6
Source File: UTemplater.java    From Refaster with Apache License 2.0 6 votes vote down vote up
@Override
public UTypeVar visitTypeVar(TypeVar type, Void v) {
  /*
   * In order to handle recursively bounded type variables without a stack overflow, we first
   * cache a type var with no bounds, then we template the bounds.
   */
  TypeSymbol tsym = type.asElement();
  if (typeVariables.containsKey(tsym)) {
    return typeVariables.get(tsym);
  }
  UTypeVar var = UTypeVar.create(tsym.getSimpleName().toString());
  typeVariables.put(tsym, var); // so the type variable can be used recursively in the bounds
  var.setLowerBound(type.getLowerBound().accept(this, null));
  var.setUpperBound(type.getUpperBound().accept(this, null));
  return var;
}
 
Example #7
Source File: LambdaToMethod.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Erasure destroys the implementation parameter subtype
 * relationship for intersection types
 */
boolean interfaceParameterIsIntersectionType() {
    List<Type> tl = tree.getDescriptorType(types).getParameterTypes();
    if (tree.kind == ReferenceKind.UNBOUND) {
        tl = tl.tail;
    }
    for (; tl.nonEmpty(); tl = tl.tail) {
        Type pt = tl.head;
        if (pt.getKind() == TypeKind.TYPEVAR) {
            TypeVar tv = (TypeVar) pt;
            if (tv.bound.getKind() == TypeKind.INTERSECTION) {
                return true;
            }
        }
    }
    return false;
}
 
Example #8
Source File: InferenceContext.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Void visitTypeVar(TypeVar t, Void aVoid) {
    Type undet = asUndetVar(t);
    if (undet.hasTag(TypeTag.UNDETVAR)) {
        visitUndetVar((UndetVar)undet, null);
    }
    return null;
}
 
Example #9
Source File: TypeMaker.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the formal type parameters of a class or method as an
 * angle-bracketed string.  Each parameter is a type variable with
 * optional bounds.  Class names are qualified if "full" is true.
 * Return "" if there are no type parameters or we're hiding generics.
 */
static String typeParametersString(DocEnv env, Symbol sym, boolean full) {
    if (env.legacyDoclet || sym.type.getTypeArguments().isEmpty()) {
        return "";
    }
    StringBuilder s = new StringBuilder();
    for (Type t : sym.type.getTypeArguments()) {
        s.append(s.length() == 0 ? "<" : ", ");
        s.append(TypeVariableImpl.typeVarToString(env, (TypeVar)t, full));
    }
    s.append(">");
    return s.toString();
}
 
Example #10
Source File: TypeVariableImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get the bounds of a type variable as listed in the "extends" clause.
 */
private static List<Type> getBounds(TypeVar v, DocEnv env) {
    final Type upperBound = v.getUpperBound();
    Name boundname = upperBound.tsym.getQualifiedName();
    if (boundname == boundname.table.names.java_lang_Object
        && !upperBound.isAnnotated()) {
        return List.nil();
    } else {
        return env.types.getBounds(v);
    }
}
 
Example #11
Source File: TypeMaker.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the formal type parameters of a class or method as an
 * angle-bracketed string.  Each parameter is a type variable with
 * optional bounds.  Class names are qualified if "full" is true.
 * Return "" if there are no type parameters or we're hiding generics.
 */
static String typeParametersString(DocEnv env, Symbol sym, boolean full) {
    if (env.legacyDoclet || sym.type.getTypeArguments().isEmpty()) {
        return "";
    }
    StringBuilder s = new StringBuilder();
    for (Type t : sym.type.getTypeArguments()) {
        s.append(s.length() == 0 ? "<" : ", ");
        s.append(TypeVariableImpl.typeVarToString(env, (TypeVar)t, full));
    }
    s.append(">");
    return s.toString();
}
 
Example #12
Source File: TypeVariableImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the string form of a type variable along with any
 * "extends" clause.  Class names are qualified if "full" is true.
 */
static String typeVarToString(DocEnv env, TypeVar v, boolean full) {
    StringBuilder s = new StringBuilder(v.toString());
    List<Type> bounds = getBounds(v, env);
    if (bounds.nonEmpty()) {
        boolean first = true;
        for (Type b : bounds) {
            s.append(first ? " extends " : " & ");
            s.append(TypeMaker.getTypeString(env, b, full));
            first = false;
        }
    }
    return s.toString();
}
 
Example #13
Source File: VarTypePrinter.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Void visitTypeVar(TypeVar t, Set<Type> seen) {
    if ((t.tsym.flags() & Flags.SYNTHETIC) != 0 && seen.add(t)) {
        visit(t.getUpperBound(), seen);
    }
    return null;
}
 
Example #14
Source File: TypeMaker.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("fallthrough")
public static com.sun.javadoc.Type getType(DocEnv env, Type t,
        boolean errToClassDoc, boolean considerAnnotations) {
    if (env.legacyDoclet) {
        t = env.types.erasure(t);
    }

    if (considerAnnotations && t.isAnnotated()) {
        return new AnnotatedTypeImpl(env, t);
    }

    switch (t.getTag()) {
    case CLASS:
        if (ClassDocImpl.isGeneric((ClassSymbol)t.tsym)) {
            return env.getParameterizedType((ClassType)t);
        } else {
            return env.getClassDoc((ClassSymbol)t.tsym);
        }
    case WILDCARD:
        Type.WildcardType a = (Type.WildcardType)t;
        return new WildcardTypeImpl(env, a);
    case TYPEVAR: return new TypeVariableImpl(env, (TypeVar)t);
    case ARRAY: return new ArrayTypeImpl(env, t);
    case BYTE: return PrimitiveType.byteType;
    case CHAR: return PrimitiveType.charType;
    case SHORT: return PrimitiveType.shortType;
    case INT: return PrimitiveType.intType;
    case LONG: return PrimitiveType.longType;
    case FLOAT: return PrimitiveType.floatType;
    case DOUBLE: return PrimitiveType.doubleType;
    case BOOLEAN: return PrimitiveType.booleanType;
    case VOID: return PrimitiveType.voidType;
    case ERROR:
        if (errToClassDoc)
            return env.getClassDoc((ClassSymbol)t.tsym);
        // FALLTHRU
    default:
        return new PrimitiveType(t.tsym.getQualifiedName().toString());
    }
}
 
Example #15
Source File: TypeVariableImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get the bounds of a type variable as listed in the "extends" clause.
 */
private static List<Type> getBounds(TypeVar v, DocEnv env) {
    final Type upperBound = v.getUpperBound();
    Name boundname = upperBound.tsym.getQualifiedName();
    if (boundname == boundname.table.names.java_lang_Object
        && !upperBound.isAnnotated()) {
        return List.nil();
    } else {
        return env.types.getBounds(v);
    }
}
 
Example #16
Source File: TypeMaker.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("fallthrough")
private static com.sun.javadoc.Type getTypeImpl(DocEnv env, Type t,
        boolean errToClassDoc, boolean considerAnnotations) {
    if (env.legacyDoclet) {
        t = env.types.erasure(t);
    }

    if (considerAnnotations && t.isAnnotated()) {
        return new AnnotatedTypeImpl(env, t);
    }

    switch (t.getTag()) {
    case CLASS:
        if (ClassDocImpl.isGeneric((ClassSymbol)t.tsym)) {
            return env.getParameterizedType((ClassType)t);
        } else {
            return env.getClassDoc((ClassSymbol)t.tsym);
        }
    case WILDCARD:
        Type.WildcardType a = (Type.WildcardType)t;
        return new WildcardTypeImpl(env, a);
    case TYPEVAR: return new TypeVariableImpl(env, (TypeVar)t);
    case ARRAY: return new ArrayTypeImpl(env, t);
    case BYTE: return PrimitiveType.byteType;
    case CHAR: return PrimitiveType.charType;
    case SHORT: return PrimitiveType.shortType;
    case INT: return PrimitiveType.intType;
    case LONG: return PrimitiveType.longType;
    case FLOAT: return PrimitiveType.floatType;
    case DOUBLE: return PrimitiveType.doubleType;
    case BOOLEAN: return PrimitiveType.booleanType;
    case VOID: return PrimitiveType.voidType;
    case ERROR:
        if (errToClassDoc)
            return env.getClassDoc((ClassSymbol)t.tsym);
        // FALLTHRU
    default:
        return new PrimitiveType(t.tsym.getQualifiedName().toString());
    }
}
 
Example #17
Source File: TypeMaker.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("fallthrough")
private static com.sun.javadoc.Type getTypeImpl(DocEnv env, Type t,
        boolean errToClassDoc, boolean considerAnnotations) {
    if (env.legacyDoclet) {
        t = env.types.erasure(t);
    }

    if (considerAnnotations && t.isAnnotated()) {
        return new AnnotatedTypeImpl(env, t);
    }

    switch (t.getTag()) {
    case CLASS:
        if (ClassDocImpl.isGeneric((ClassSymbol)t.tsym)) {
            return env.getParameterizedType((ClassType)t);
        } else {
            return env.getClassDoc((ClassSymbol)t.tsym);
        }
    case WILDCARD:
        Type.WildcardType a = (Type.WildcardType)t;
        return new WildcardTypeImpl(env, a);
    case TYPEVAR: return new TypeVariableImpl(env, (TypeVar)t);
    case ARRAY: return new ArrayTypeImpl(env, t);
    case BYTE: return PrimitiveType.byteType;
    case CHAR: return PrimitiveType.charType;
    case SHORT: return PrimitiveType.shortType;
    case INT: return PrimitiveType.intType;
    case LONG: return PrimitiveType.longType;
    case FLOAT: return PrimitiveType.floatType;
    case DOUBLE: return PrimitiveType.doubleType;
    case BOOLEAN: return PrimitiveType.booleanType;
    case VOID: return PrimitiveType.voidType;
    case ERROR:
        if (errToClassDoc)
            return env.getClassDoc((ClassSymbol)t.tsym);
        // FALLTHRU
    default:
        return new PrimitiveType(t.tsym.getQualifiedName().toString());
    }
}
 
Example #18
Source File: TypeVariableImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get the bounds of a type variable as listed in the "extends" clause.
 */
private static List<Type> getBounds(TypeVar v, DocEnv env) {
    final Type upperBound = v.getUpperBound();
    Name boundname = upperBound.tsym.getQualifiedName();
    if (boundname == boundname.table.names.java_lang_Object
        && !upperBound.isAnnotated()) {
        return List.nil();
    } else {
        return env.types.getBounds(v);
    }
}
 
Example #19
Source File: TypeVariableImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the string form of a type variable along with any
 * "extends" clause.  Class names are qualified if "full" is true.
 */
static String typeVarToString(DocEnv env, TypeVar v, boolean full) {
    StringBuilder s = new StringBuilder(v.toString());
    List<Type> bounds = getBounds(v, env);
    if (bounds.nonEmpty()) {
        boolean first = true;
        for (Type b : bounds) {
            s.append(first ? " extends " : " & ");
            s.append(TypeMaker.getTypeString(env, b, full));
            first = false;
        }
    }
    return s.toString();
}
 
Example #20
Source File: TypeVariableImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the string form of a type variable along with any
 * "extends" clause.  Class names are qualified if "full" is true.
 */
static String typeVarToString(DocEnv env, TypeVar v, boolean full) {
    StringBuilder s = new StringBuilder(v.toString());
    List<Type> bounds = getBounds(v, env);
    if (bounds.nonEmpty()) {
        boolean first = true;
        for (Type b : bounds) {
            s.append(first ? " extends " : " & ");
            s.append(TypeMaker.getTypeString(env, b, full));
            first = false;
        }
    }
    return s.toString();
}
 
Example #21
Source File: TypeMaker.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("fallthrough")
public static com.sun.javadoc.Type getType(DocEnv env, Type t,
        boolean errToClassDoc, boolean considerAnnotations) {
    if (env.legacyDoclet) {
        t = env.types.erasure(t);
    }

    if (considerAnnotations && t.isAnnotated()) {
        return new AnnotatedTypeImpl(env, t);
    }

    switch (t.getTag()) {
    case CLASS:
        if (ClassDocImpl.isGeneric((ClassSymbol)t.tsym)) {
            return env.getParameterizedType((ClassType)t);
        } else {
            return env.getClassDoc((ClassSymbol)t.tsym);
        }
    case WILDCARD:
        Type.WildcardType a = (Type.WildcardType)t;
        return new WildcardTypeImpl(env, a);
    case TYPEVAR: return new TypeVariableImpl(env, (TypeVar)t);
    case ARRAY: return new ArrayTypeImpl(env, t);
    case BYTE: return PrimitiveType.byteType;
    case CHAR: return PrimitiveType.charType;
    case SHORT: return PrimitiveType.shortType;
    case INT: return PrimitiveType.intType;
    case LONG: return PrimitiveType.longType;
    case FLOAT: return PrimitiveType.floatType;
    case DOUBLE: return PrimitiveType.doubleType;
    case BOOLEAN: return PrimitiveType.booleanType;
    case VOID: return PrimitiveType.voidType;
    case ERROR:
        if (errToClassDoc)
            return env.getClassDoc((ClassSymbol)t.tsym);
        // FALLTHRU
    default:
        return new PrimitiveType(t.tsym.getQualifiedName().toString());
    }
}
 
Example #22
Source File: TypeMirrorHandle.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Void visitTypeVar(TypeVar t, Void s) {
    if (t.bound instanceof PlaceholderType)
        t.bound = ((PlaceholderType)t.bound).delegate;
    else if (t.bound != null)
        t.bound.accept(this, s);
    if (t.lower instanceof PlaceholderType)
        t.lower = ((PlaceholderType)t.lower).delegate;
    else if (t.lower != null)
        t.lower.accept(this, s);
    return null;
}
 
Example #23
Source File: LambdaToMethod.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Erasure destroys the implementation parameter subtype
 * relationship for intersection types
 */
boolean interfaceParameterIsIntersectionType() {
    List<Type> tl = tree.getDescriptorType(types).getParameterTypes();
    for (; tl.nonEmpty(); tl = tl.tail) {
        Type pt = tl.head;
        if (pt.getKind() == TypeKind.TYPEVAR) {
            TypeVar tv = (TypeVar) pt;
            if (tv.bound.getKind() == TypeKind.INTERSECTION) {
                return true;
            }
        }
    }
    return false;
}
 
Example #24
Source File: InferenceContext.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public Void visitTypeVar(TypeVar t, Void aVoid) {
    Type undet = asUndetVar(t);
    if (undet.hasTag(TypeTag.UNDETVAR)) {
        visitUndetVar((UndetVar)undet, null);
    }
    return null;
}
 
Example #25
Source File: Check.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public Boolean visitTypeVar(TypeVar t, Void s) {
    /* Any type variable mentioned in the inferred type must have been declared as a type parameter
      (i.e cannot have been produced by inference (18.4))
    */
    return (t.tsym.flags() & SYNTHETIC) == 0;
}
 
Example #26
Source File: Enter.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/** Class enter visitor method for type parameters.
 *  Enter a symbol for type parameter in local scope, after checking that it
 *  is unique.
 */
@Override
public void visitTypeParameter(JCTypeParameter tree) {
    TypeVar a = (tree.type != null)
        ? (TypeVar)tree.type
        : new TypeVar(tree.name, env.info.scope.owner, syms.botType);
    tree.type = a;
    if (chk.checkUnique(tree.pos(), a.tsym, env.info.scope)) {
        env.info.scope.enter(a.tsym);
    }
    result = a;
}
 
Example #27
Source File: ClassReader.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private List<Type> enterTypeVariables(TypeVariable[] clsparams) {
    ListBuffer<Type> paramsBuff=new ListBuffer<>();
    for (TypeVariable type:clsparams){
        Name name=names.fromString(type.getName());
        TypeVar typeVar=new TypeVar(name,currentOwner,syms.botType);
        typevars.enter(typeVar.tsym);
        ListBuffer<Type> bounds=new ListBuffer<>();
        for (java.lang.reflect.Type bound:type.getBounds()){
            bounds.append(javaTypeToType(bound));
        }
        types.setBounds(typeVar,bounds.toList(),false);
        paramsBuff.append(typeVar);
    }
    return paramsBuff.toList();
}
 
Example #28
Source File: TypeVariableImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the string form of a type variable along with any
 * "extends" clause.  Class names are qualified if "full" is true.
 */
static String typeVarToString(DocEnv env, TypeVar v, boolean full) {
    StringBuilder s = new StringBuilder(v.toString());
    List<Type> bounds = getBounds(v, env);
    if (bounds.nonEmpty()) {
        boolean first = true;
        for (Type b : bounds) {
            s.append(first ? " extends " : " & ");
            s.append(TypeMaker.getTypeString(env, b, full));
            first = false;
        }
    }
    return s.toString();
}
 
Example #29
Source File: TypeMaker.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the formal type parameters of a class or method as an
 * angle-bracketed string.  Each parameter is a type variable with
 * optional bounds.  Class names are qualified if "full" is true.
 * Return "" if there are no type parameters or we're hiding generics.
 */
static String typeParametersString(DocEnv env, Symbol sym, boolean full) {
    if (env.legacyDoclet || sym.type.getTypeArguments().isEmpty()) {
        return "";
    }
    StringBuilder s = new StringBuilder();
    for (Type t : sym.type.getTypeArguments()) {
        s.append(s.length() == 0 ? "<" : ", ");
        s.append(TypeVariableImpl.typeVarToString(env, (TypeVar)t, full));
    }
    s.append(">");
    return s.toString();
}
 
Example #30
Source File: TypeMaker.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("fallthrough")
private static com.sun.javadoc.Type getTypeImpl(DocEnv env, Type t,
        boolean errToClassDoc, boolean considerAnnotations) {
    if (env.legacyDoclet) {
        t = env.types.erasure(t);
    }

    if (considerAnnotations && t.isAnnotated()) {
        return new AnnotatedTypeImpl(env, t);
    }

    switch (t.getTag()) {
    case CLASS:
        if (ClassDocImpl.isGeneric((ClassSymbol)t.tsym)) {
            return env.getParameterizedType((ClassType)t);
        } else {
            return env.getClassDoc((ClassSymbol)t.tsym);
        }
    case WILDCARD:
        Type.WildcardType a = (Type.WildcardType)t;
        return new WildcardTypeImpl(env, a);
    case TYPEVAR: return new TypeVariableImpl(env, (TypeVar)t);
    case ARRAY: return new ArrayTypeImpl(env, t);
    case BYTE: return PrimitiveType.byteType;
    case CHAR: return PrimitiveType.charType;
    case SHORT: return PrimitiveType.shortType;
    case INT: return PrimitiveType.intType;
    case LONG: return PrimitiveType.longType;
    case FLOAT: return PrimitiveType.floatType;
    case DOUBLE: return PrimitiveType.doubleType;
    case BOOLEAN: return PrimitiveType.booleanType;
    case VOID: return PrimitiveType.voidType;
    case ERROR:
        if (errToClassDoc)
            return env.getClassDoc((ClassSymbol)t.tsym);
        // FALLTHRU
    default:
        return new PrimitiveType(t.tsym.getQualifiedName().toString());
    }
}