All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class epp.Type

java.lang.Object
   |
   +----epp.Type

public abstract class Type
extends Object
implements Cloneable
The Type class is a type information that is attached to a node of an abstract syntax tree.

Within the type checking pass, the TypeChecker converts each node of a Tree into a Tree with type information. You can obtain type information from the Tree with type information using the tree.type() method.

You can obtain the type of a type using the type.tag() method call. The following type tags specify standard Java types.

:void, :char, :byte, :short, :int, :long, :float, :double, :boolean,
:null
:class
:arrayOf
These types are expressed by subclasses of class Type, including PrimitiveType, NullType, ClassType, and ArrayType. For details on accessing the internals of ClassType and ArrayType, please refer to the description of these classes. PrimitiveType and NullType do not have any internal structures.

Plug-ins may introduce new types into the Java language by defining a subclass of class Type and providing a new tag. However, you cannot add new primitive types.

The Type class only holds information required to descibe a type and does not define any "type semantics." Type semantics are defined by a method that defines TypeSystem and the TypeChecker object.

Though not included in this javadoc, the following static variables that hold the built-in type instances are defined.

Type.Tnull
Type.Tvoid
Type.Tchar
Type.Tbyte
Type.Tshort
Type.Tint
Type.Tlong
Type.Tfloat
Type.Tdouble
Type.Tboolean
Type.TString	// java.lang.String
Type.TObject	// java.lang.Object
Type.TClass	// java.lang.Class

See Also:
type, PrimitiveType, ClassType, ArrayType, NullType, TypeSystem, TypeCheck, TypeChecker

Constructor Index

 o Type(Symbol)

Method Index

 o classInfo()
Returns ClassInfo if this type is :class type.
 o coerce(Type, Tree)
 o epp()
 o equals(Type, Type)
 o isPrimitiveType()
Returns true if this type is a primitive type, and false otherwise.
 o isSuperType(Type, Type)
 o print()
Prints the content to Opts.out in a human readable form.
 o selectField(Type, Symbol)
 o tag()
Returns the tag of this type.
 o toTree()
Returns a tree that describes this type in a program.
 o typeCheckAndSelectMethod(Type, Symbol, Tree)
 o typeCheckBlockStatements(int, Tree[], TreeVec)

Constructors

 o Type
 public Type(Symbol tag)

Methods

 o epp
 public static Obj epp()
 o equals
 public static boolean equals(Type type1,
                              Type type2)
See Also:
equals
 o isSuperType
 public static boolean isSuperType(Type type1,
                                   Type type2)
See Also:
isSuperType
 o coerce
 public static Tree coerce(Type type,
                           Tree tree)
See Also:
coerce
 o selectField
 public static FieldInfo selectField(Type targetType,
                                     Symbol fieldName)
See Also:
selectField
 o typeCheckAndSelectMethod
 public static Object[] typeCheckAndSelectMethod(Type targetType,
                                                 Symbol methodName,
                                                 Tree argumentList)
See Also:
typeCheckAndSelectMethod
 o typeCheckBlockStatements
 public static void typeCheckBlockStatements(int i,
                                             Tree args[],
                                             TreeVec newArgs)
See Also:
typeCheckBlockStatements
 o isPrimitiveType
 public boolean isPrimitiveType()
Returns true if this type is a primitive type, and false otherwise. The following primitive types are available. :void, :char, :byte, :short, :int, :long, :float, :double, and :boolean. (void is not a type specified in "The Java Language Specification", but will be handled as a primitive type in EPP.)

:null, :class, and :arrayOf are not primitive types.

See Also:
PrimitiveType
 o tag
 public Symbol tag()
Returns the tag of this type.

 o classInfo
 public ClassInfo classInfo()
Returns ClassInfo if this type is :class type. Otherwise, a fatal error occurs.

See Also:
ClassType, ClassInfo
 o toTree
 public abstract Tree toTree()
Returns a tree that describes this type in a program. If this method is called with a type that cannot be described in a program (for example, a null type), an EppUserError will be thrown.

 o print
 public Type print()
Prints the content to Opts.out in a human readable form. Used for debugging. This method returns itself as the return value.


All Packages  Class Hierarchy  This Package  Previous  Next  Index