All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class epp.TypeSystem

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

public class TypeSystem
extends Object
The TypeSystem.java file defines methods of the EPP preprocessor that define the relationship between types.

Note: This class is provided for the sake of creating javadocs. It does not exist in the actual EPP source code.

Plug-ins can extend this method to define a relationship between a newly introduced type and an existing type.

Some of the methods are also defined as static methods of class Type to make it easier to call from TypeChecker. For example, the method isSuperType(t1, t2) can be called from a method of TypeChecker by writing Type.isSuperType(t1, t2). Actually, this method is delegated to an Ld-2 method.

See Also:
Type

Constructor Index

 o TypeSystem()

Method Index

 o argumentListToSignatureString(Tree)
Converts the types of each actual parameter of argumentList into a single string.
 o checkVariableDeclaratorId(Type, Tree, Tree[])
 o coerce(Type, Tree)
Checks that type of argument tree can be used as type type and returns a tree.
 o coerceArgumentList(Tree, MethodInfo)
Coerces each actual parameter of arguemntList to the type selectedMethod expects.
 o confirmArgs(MethodInfo, Tree)
Returns true if method matchs argumentList and returns false otherwise.
 o confirmType(Type, Tree)
Checks that argument type is a super type of a type an expression specified by the argument tree.
 o doesImplement(ClassInfo, ClassInfo)
Returns true if info1 is implemented by info2.
 o equals(Type, Type)
Returns true if t1 and t2 are of the same type, and returns false otherwise.
 o isAncestor(ClassInfo, ClassInfo)
Returns true if Info1 is a super class of info2.
 o isSuperType(Type, Type)
Returns true if t1 is a super type of t2.
 o moreSpecificMethod(MethodInfo, MethodInfo)
Returns true iff m1 is more specific than m2.
 o selectField(Type, Symbol)
Returns the field named fieldName if targetType has any such field.
 o selectMostSpecificMethod(String, MethodInfo[], Tree)
Selects and returns a single method from methods that matches the argument specified by argument arguemntList and is the most determinative.
 o typeCheckAndSelectMethod(Type, Symbol, Tree)
Type checks the arguemntList and selects a method to call.
 o typeCheckBlockStatement(Tree, int, Tree[], TreeVec)
 o typeCheckBlockStatements(int, Tree[], TreeVec)
Type checks the type of the trees after offset i of args and puts the result into newArgs.
 o typeCheckVariableDeclarator(Tree, int, Tree[], TreeVec, Tree, Tree, Tree, int, Tree[], TreeVec)
 o typeCheckVariableDeclarators(int, Tree[], TreeVec, Tree, Tree, Tree, int, Tree[], TreeVec)

Constructors

 o TypeSystem
 public TypeSystem()

Methods

 o equals
 public boolean equals(Type t1,
                       Type t2)
Returns true if t1 and t2 are of the same type, and returns false otherwise.

This method is delegated from a static method of class Type.

 o confirmType
 public void confirmType(Type type,
                         Tree tree)
Checks that argument type is a super type of a type an expression specified by the argument tree. If it is, nothing will happen. If it is not the super type, an EppUserError will be thrown.

 o isSuperType
 public boolean isSuperType(Type t1,
                            Type t2)
Returns true if t1 is a super type of t2. Otherwise returns false. To be more precise, the following will occur.

Returns true if t1 is a super type of, or the same type as t2.
If t1 is an "unknown extended type", a fatal error results.
Otherwise, if t2 is an "unknown extended type", false will be returned.

This method is delegated from a static method of the Type.

 o isAncestor
 public boolean isAncestor(ClassInfo info1,
                           ClassInfo info2)
Returns true if Info1 is a super class of info2. Otherwise returns false. To be more precise, the following will occur.

Returns true if info1 and info2 have the same name,
or class info1 is an ancestor of class info2.

Both info1 and info2 must be a ClassInfo that expresses a class. (The behaviour when either is a ClassInfo that expresses an interface is undefined.)

 o doesImplement
 public boolean doesImplement(ClassInfo info1,
                              ClassInfo info2)
Returns true if info1 is implemented by info2. Otherwise returns false. info1 must be a ClassInfo that expresses an interface. info2 may be a class or an interface. To be more precise, the following will occur.

Return true if info1 and info2 have the same name,
or interface info1 is implemented by class info2,
or interface info1 is extended by interface info2.

 o coerce
 public Tree coerce(Type type,
                    Tree tree)
Checks that type of argument tree can be used as type type and returns a tree. If it cannot be used as the type, an EppUserError will be thrown. Normally, the tree will be returned unchanged.

Plug-ins may extend this method to implement an "implicit type conversion" not included in standard Java.

This method is delegated from a static method of the Type class.

 o selectField
 public FieldInfo selectField(Type targetType,
                              Symbol fieldName)
Returns the field named fieldName if targetType has any such field. If not, an EppUserError will be thrown.

This method is delegated from a static method of the Type class.

 o typeCheckAndSelectMethod
 public Object[] typeCheckAndSelectMethod(Type targetType,
                                          Symbol methodName,
                                          Tree argumentList)
Type checks the arguemntList and selects a method to call. This method returns two values. One is the selected method, and its type is MethodInfo. The second is the type checked argumentList, and its type is Tree.

This method is delegated from a static method of the Type class.

 o selectMostSpecificMethod
 public MethodInfo selectMostSpecificMethod(String methodName,
                                            MethodInfo methods[],
                                            Tree argumentList)
Selects and returns a single method from methods that matches the argument specified by argument arguemntList and is the most determinative. If such method is not found, an EppUserError is thrown. Argument methodName is used in the error message.

 o confirmArgs
 public boolean confirmArgs(MethodInfo method,
                            Tree argumentList)
Returns true if method matchs argumentList and returns false otherwise.

 o moreSpecificMethod
 public boolean moreSpecificMethod(MethodInfo m1,
                                   MethodInfo m2)
Returns true iff m1 is more specific than m2.

 o coerceArgumentList
 public Tree coerceArgumentList(Tree argumentList,
                                MethodInfo selectedMethod)
Coerces each actual parameter of arguemntList to the type selectedMethod expects.

See Also:
coerce
 o argumentListToSignatureString
 public String argumentListToSignatureString(Tree argumentList)
Converts the types of each actual parameter of argumentList into a single string. This method is called from selectMostSpecificMethod when creating an error message.

See Also:
selectMostSpecificMethod
 o typeCheckBlockStatements
 public void typeCheckBlockStatements(int i,
                                      Tree args[],
                                      TreeVec newArgs)
Type checks the type of the trees after offset i of args and puts the result into newArgs. This method is called in cases such as type checking a block.

This method is delegated from a static method of the Type class.

 o typeCheckBlockStatement
 public void typeCheckBlockStatement(Tree tree,
                                     int i,
                                     Tree args[],
                                     TreeVec newArgs)
 o typeCheckVariableDeclarators
 public void typeCheckVariableDeclarators(int vi,
                                          Tree vardecls[],
                                          TreeVec newVardecls,
                                          Tree declTree,
                                          Tree modifiers,
                                          Tree typeTree,
                                          int i,
                                          Tree args[],
                                          TreeVec newArgs)
 o typeCheckVariableDeclarator
 public void typeCheckVariableDeclarator(Tree tree,
                                         int vi,
                                         Tree vardecls[],
                                         TreeVec newVardecls,
                                         Tree declTree,
                                         Tree modifiers,
                                         Tree typeTree,
                                         int i,
                                         Tree args[],
                                         TreeVec newArgs)
 o checkVariableDeclaratorId
 public Tree checkVariableDeclaratorId(Type type,
                                       Tree tree,
                                       Tree declaredVars[])

All Packages  Class Hierarchy  This Package  Previous  Next  Index