Home » openjdk-7 » com.sun.tools » javac » code » [javadoc | source]
public class: Type [javadoc | source]

All Implemented Interfaces:

Direct Known Subclasses:
    DelegatedType, UninitializedType, ErasedClassType, WildcardType, JCNoType, UndetVar, TypeVar, UnionClassType, BottomType, ForAll, ErrorType, CapturedType, UninferredReturnType, UninferredMethodType, MethodType, ArrayType, ClassType, PackageType

This class represents Java types. The class itself defines the behavior of the following types:
 type `void' (tag: VOID),
 the bottom type (tag: BOT),
 the missing type (tag: NONE).

The behavior of the following types is defined in subclasses, which are all static inner classes of this class:

 class types (tag: CLASS, class: ClassType),
 array types (tag: ARRAY, class: ArrayType),
 method types (tag: METHOD, class: MethodType),
 package types (tag: PACKAGE, class: PackageType),
 type variables (tag: TYPEVAR, class: TypeVar),
 type arguments (tag: WILDCARD, class: WildcardType),
 polymorphic types (tag: FORALL, class: ForAll),
 the error type (tag: ERROR, class: ErrorType).

This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.

Nested Class Summary:
abstract public static class  Type.Mapping  An abstract class for mappings from types to types 
public static class  Type.WildcardType   
public static class  Type.ClassType   
public static class  Type.ErasedClassType   
public static class  Type.UnionClassType   
public static class  Type.ArrayType   
public static class  Type.MethodType   
public static class  Type.PackageType   
public static class  Type.TypeVar   
public static class  Type.CapturedType  A captured type variable comes from wildcards which can have both upper and lower bound. CapturedType extends TypeVar with a lower bound. 
abstract public static class  Type.DelegatedType   
public static class  Type.ForAll   
public static class  Type.UndetVar  A class for instantiatable variables, for use during type inference. 
static class  Type.JCNoType  Represents VOID or NONE. 
static class  Type.BottomType   
public static class  Type.ErrorType   
public interface  Type.Visitor  A visitor for types. A visitor is used to implement operations (or relations) on types. Most common operations on types are binary relations and this interface is designed for binary relations, that is, operations on the form Type × S → R.  
Field Summary
public static final  JCNoType noType    Constant type: no type at all. 
public static  boolean moreInfo    If this switch is turned on, the names of type variables and anonymous classes are printed with hashcodes appended. 
public  int tag    The tag of this type. 
public  TypeSymbol tsym    The defining class / interface / package / type variable 
 public Type(int tag,
    TypeSymbol tsym) 
    Define a type given its tag and type symbol
Method from com.sun.tools.javac.code.Type Summary:
accept,   accept,   allparams,   argtypes,   asElement,   asMethodType,   baseType,   baseTypes,   complete,   constType,   constValue,   contains,   contains,   containsAny,   containsAny,   equals,   filter,   getEnclosingType,   getKind,   getLowerBound,   getModelType,   getModelTypes,   getParameterTypes,   getReturnType,   getThrownTypes,   getTypeArguments,   getUpperBound,   hashCode,   isCompound,   isErroneous,   isErroneous,   isExtendsBound,   isFalse,   isFinal,   isInterface,   isParameterized,   isPrimitive,   isRaw,   isSuperBound,   isTrue,   isUnbound,   map,   map,   stringValue,   toString,   toString,   withTypeVar
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.sun.tools.javac.code.Type Detail:
 public R accept(Visitor<R, S> v,
    S s) 
 public R accept(TypeVisitor<R, P> v,
    P p) 
 public List<Type> allparams() 
    Return all parameters of this type and all its outer types in order outer (first) to inner (last).
 public String argtypes(boolean varargs) 
 public TypeSymbol asElement() 
 public MethodType asMethodType() 
    The underlying method type of this type.
 public Type baseType() 
    If this is a constant type, return its underlying type. Otherwise, return the type itself.
 public static List<Type> baseTypes(List<Type> ts) 
    Return the base types of a list of types.
 public  void complete() 
    Complete loading all classes in this type.
 public Type constType(Object constValue) 
    Define a constant type, of the same kind as this type and with given constant value
 public Object constValue() 
    The constant value of this type, null if this type does not have a constant value attribute. Only primitive types and strings (ClassType) can have a constant value attribute.
 public boolean contains(Type t) 
    Does this type contain occurrences of type t?
 public static boolean contains(List<Type> ts,
    Type t) 
 public boolean containsAny(List<Type> ts) 
    Does this type contain an occurrence of some type in 'ts'?
 public static boolean containsAny(List<Type> ts1,
    List<Type> ts2) 
 public boolean equals(Object t) 
    This method is analogous to isSameType, but weaker, since we never complete classes. Where isSameType would complete a class, equals assumes that the two types are different.
 public static List<Type> filter(List<Type> ts,
    Filter<Type> tf) 
 public Type getEnclosingType() 
 public TypeKind getKind() 
 public Type getLowerBound() 
 public Type getModelType() 
    Get the representation of this type used for modelling purposes. By default, this is itself. For ErrorType, a different value may be provided,
 public static List<Type> getModelTypes(List<Type> ts) 
 public List<Type> getParameterTypes() 
 public Type getReturnType() 
 public List<Type> getThrownTypes() 
 public List<Type> getTypeArguments() 
    Access methods.
 public Type getUpperBound() 
 public int hashCode() 
 public boolean isCompound() 
 public boolean isErroneous() 
    Does this type contain "error" elements?
 public static boolean isErroneous(List<Type> ts) 
 public boolean isExtendsBound() 
 public boolean isFalse() 
    Is this a constant type whose value is false?
 public boolean isFinal() 
 public boolean isInterface() 
 public boolean isParameterized() 
    Is this type parameterized? A class type is parameterized if it has some parameters. An array type is parameterized if its element type is parameterized. All other types are not parameterized.
 public boolean isPrimitive() 
 public boolean isRaw() 
    Is this type a raw type? A class type is a raw type if it misses some of its parameters. An array type is a raw type if its element type is raw. All other types are not raw. Type validation will ensure that the only raw types in a program are types that miss all their type variables.
 public boolean isSuperBound() 
 public boolean isTrue() 
    Is this a constant type whose value is true?
 public boolean isUnbound() 
 public Type map(Mapping f) 
    map a type function over all immediate descendants of this type
 public static List<Type> map(List<Type> ts,
    Mapping f) 
    map a type function over a list of types
 public String stringValue() 
    The constant value of this type, converted to String
 public String toString() 
    The Java source which this type represents.
 public static String toString(List<Type> ts) 
    The Java source which this type list represents. A List is represented as a comma-spearated listing of the elements in that list.
 public Type withTypeVar(Type t)