Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javafe.tc
Class Types

    java.lang.Object
      javafe.tc.Types

Direct Known Subclasses:
  Types

public class Types
extends java.lang.Object

Field Summary
`static PrimitiveType` | `booleanType`
`static PrimitiveType` | `byteType`
`static PrimitiveType` | `charType`
`static PrimitiveType` | `doubleType`
`static Type` | `errorType` Used to indicate the type of an illegal operation, so that error messages do not unnecessarily propagate; should only be used if the error has already been reported.
`static PrimitiveType` | `floatType`
`static Types` | `inst` Types uses the inst pattern to allow subclasses to provide alternative implementations of some of the static methods here.
`static PrimitiveType` | `intType`
`static FieldDecl` | `lengthFieldDecl`
`protected static Identifier` | `lenId`
`static PrimitiveType` | `longType`
`static PrimitiveType` | `nullType`
`private static TypeSig` | `s_javaLangClass`
`private static TypeSig` | `s_javaLangCloneable`
`private static TypeSig` | `s_javaLangError`
`private static TypeSig` | `s_javaLangException`
`private static TypeSig` | `s_javaLangObject`
`private static java.lang.String[]` | `s_javaLangPackage`
`private static TypeSig` | `s_javaLangRuntimeException`
`private static TypeSig` | `s_javaLangString`
`private static TypeSig` | `s_javaLangSystem`
`private static TypeSig` | `s_javaLangThrowable`
`static PrimitiveType` | `shortType`
`static PrimitiveType` | `voidType`

Constructor Summary
`Types()`

Method Summary
`static Type` | `baseType(Type t)`
`static Type` | `binaryNumericPromotion(Type x, Type y)`
`static Type[]` | `getFormalParaTypes(FormalParaDeclVec args)`
`static TypeSig` | `getJavaLang(java.lang.String T)` Find the TypeSig for the required package-member type java.lang.T.
`protected static boolean` | `isAnyPrimitiveConvertable(Type x, Type y)` Returns true iff the first argument is convertable to the second argument, either through a widening primitive conversion, a narrowing primitive conversion, or the identity conversion.
`static boolean` | `isBooleanType(Type t)`
`static boolean` | `isByteType(Type t)`
`static boolean` | `isCastable(Type s, Type t)` Checks if one Type is castable to another.
`protected boolean` | `isCastableInstance(Type s, Type t)`
`static boolean` | `isCharType(Type t)`
`(package private) static boolean` | `isCheckedException(Type E)` Is an exception a checked one?
`(package private) static boolean` | `isCompatibleAccess(int x, int y)`
`(package private) static boolean` | `isCompatibleRaises(TypeNameVec x, TypeNameVec y)` Is "throws " a valid overriding of "throws "?
`static boolean` | `isDoubleType(Type t)`
`static boolean` | `isErrorType(Type t)` * Predicates on types: * *
`static boolean` | `isFloatingPointType(Type t)`
`boolean` | `isFloatingPointTypeInstance(Type t)`
`static boolean` | `isFloatType(Type t)`
`static boolean` | `isIntegralType(Type t)`
`boolean` | `isIntegralTypeInstance(Type t)`
`static boolean` | `isIntType(Type t)`
`static boolean` | `isInvocationConvertable(Type x, Type y)`
`protected boolean` | `isInvocationConvertableInstance(Type x, Type y)`
`static boolean` | `isLongType(Type t)`
`static boolean` | `isNumericType(Type t)`
`boolean` | `isNumericTypeInstance(Type t)`
`private static boolean` | `isPrimitiveType(Type t, int tag)`
`static boolean` | `isReferenceOrNullType(Type t)`
`static boolean` | `isReferenceType(Type t)`
`static boolean` | `isSameFormalParaDeclVec(FormalParaDeclVec x, FormalParaDeclVec y)`
`static boolean` | `isSameMethodSig(MethodDecl x, MethodDecl y)`
`static boolean` | `isSameType(Type x, Type y)`
`protected boolean` | `isSameTypeInstance(Type x, Type y)`
`static boolean` | `isShortType(Type t)`
`static boolean` | `isSubclassOf(Type x, TypeSig y)` Returns true if and only if `x` is a subclass or superinterface of `y`.
`static boolean` | `isSubClassOrEq(Type x, Type y)` Returns true iff `x` is a superclass or superinterface of `y`, or if `x` is the same type as `y`.
`static boolean` | `isVoidType(Type t)`
`protected static boolean` | `isWideningPrimitiveConvertable(Type x, Type y)`
`protected boolean` | `isWideningPrimitiveConvertableInstance(Type x, Type y)`
`protected static boolean` | `isWideningReferenceConvertable(Type s, Type t)`
`protected boolean` | `isWideningReferenceConvertableInstance(Type s, Type t)`
`static TypeSig` | `javaLangClass()`
`static TypeSig` | `javaLangCloneable()`
`static TypeSig` | `javaLangError()`
`static TypeSig` | `javaLangException()`
`static TypeSig` | `javaLangObject()`
`static java.lang.String[]` | `javaLangPackage()` Return the package java.lang as a String[] for use in calling OutsideEnv.lookup[deferred].
`static TypeSig` | `javaLangRuntimeException()`
`static TypeSig` | `javaLangString()`
`static TypeSig` | `javaLangSystem()`
`static TypeSig` | `javaLangThrowable()`
`static FieldDecl` | `lookupField(Type t, Identifier id, TypeSig caller)`
`protected FieldDecl` | `lookupFieldInstance(Type t, Identifier id, TypeSig caller)`
`static MethodDecl` | `lookupMethod(Type t, Identifier id, Type[] args, TypeSig caller)`
`protected MethodDecl` | `lookupMethodInstance(Type t, Identifier id, Type[] args, TypeSig caller)`
`private static PrimitiveType` | `makePrimitiveType(int tag)`
`protected static TypeSig` | `makeTypeSig(java.lang.String[] packageName, java.lang.String simpleName, TypeSig enclosingType, TypeDecl decl, CompilationUnit CU)` Factory method for TypeSig structures
`static TypeSig` | `makeTypeSig(java.lang.String simpleName, Env enclosingEnv, TypeDecl decl)` Factory method for TypeSig structures
`protected TypeSig` | `makeTypeSigInstance(java.lang.String[] packageName, java.lang.String simpleName, TypeSig enclosingType, TypeDecl decl, CompilationUnit CU)`
`protected TypeSig` | `makeTypeSigInstance(java.lang.String simpleName, Env enclosingEnv, TypeDecl decl)`
`static java.lang.String` | `printName(Type t)` Returns the name of a `Type` as a `String`.
`static java.lang.String` | `printName(Type[] ts)` Formats an array of `Type`s as a `String` containing a parenthesized list of user-readable names.
`protected java.lang.String` | `printNameInstance(Type t)`
`static void` | `remakeTypes()`
`static boolean` | `routineMoreSpecific(RoutineDecl x, RoutineDecl y)`
`static TypeSig` | `toClassTypeSig(Type x)` Returns the TypeSig for a Type x, if x denotes a class type, otherwise returns null.
`static Type` | `unaryPromote(Type t)`
`static LiteralExpr` | `zeroEquivalent(Type t)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### inst

    public static Types inst

  Types uses the inst pattern to allow subclasses to provide alternative implementations of some of the static methods here.

### errorType

    public static Type errorType

  Used to indicate the type of an illegal operation, so that error messages do not unnecessarily propagate; should only be used if the error has already been reported.

### voidType

    public static PrimitiveType voidType

### booleanType

    public static PrimitiveType booleanType

### intType

    public static PrimitiveType intType

### doubleType

    public static PrimitiveType doubleType

### floatType

    public static PrimitiveType floatType

### longType

    public static PrimitiveType longType

### charType

    public static PrimitiveType charType

### nullType

    public static PrimitiveType nullType

### byteType

    public static PrimitiveType byteType

### shortType

    public static PrimitiveType shortType

### s_javaLangPackage

    private static java.lang.String[] s_javaLangPackage

### s_javaLangObject

    private static TypeSig s_javaLangObject

### s_javaLangSystem

    private static TypeSig s_javaLangSystem

### s_javaLangError

    private static TypeSig s_javaLangError

### s_javaLangException

    private static TypeSig s_javaLangException

### s_javaLangThrowable

    private static TypeSig s_javaLangThrowable

### s_javaLangString

    private static TypeSig s_javaLangString

### s_javaLangRuntimeException

    private static TypeSig s_javaLangRuntimeException

### s_javaLangCloneable

    private static TypeSig s_javaLangCloneable

### s_javaLangClass

    private static TypeSig s_javaLangClass

### lenId

    protected static Identifier lenId

### lengthFieldDecl

    public static FieldDecl lengthFieldDecl

Constructor Detail

### Types

    public Types()

Method Detail

### makeTypeSig

    public static TypeSig makeTypeSig(java.lang.String simpleName,
                                      Env enclosingEnv,
                                      TypeDecl decl)

  Factory method for TypeSig structures

### makeTypeSigInstance

    protected TypeSig makeTypeSigInstance(java.lang.String simpleName,
                                          Env enclosingEnv,
                                          TypeDecl decl)

### makeTypeSig

    protected static TypeSig makeTypeSig(java.lang.String[] packageName,
                                         java.lang.String simpleName,
                                         TypeSig enclosingType,
                                         TypeDecl decl,
                                         CompilationUnit CU)

  Factory method for TypeSig structures

### makeTypeSigInstance

    protected TypeSig makeTypeSigInstance(java.lang.String[] packageName,
                                          java.lang.String simpleName,
                                          TypeSig enclosingType,
                                          TypeDecl decl,
                                          CompilationUnit CU)

### makePrimitiveType

    private static final PrimitiveType makePrimitiveType(int tag)

### remakeTypes

    public static void remakeTypes()

### javaLangPackage

    public static java.lang.String[] javaLangPackage()

  Return the package java.lang as a String[] for use in calling OutsideEnv.lookup[deferred].

### getJavaLang

    public static TypeSig getJavaLang(java.lang.String T)

  Find the TypeSig for the required package-member type java.lang.T.

  If the type is not found in the classpath, an error message is reported via ErrorSet and an unloaded TypeSig is returned.

  Precondition: the TypeSig has been initialized.

### javaLangObject

    public static TypeSig javaLangObject()

### javaLangSystem

    public static TypeSig javaLangSystem()

### javaLangError

    public static TypeSig javaLangError()

### javaLangException

    public static TypeSig javaLangException()

### javaLangThrowable

    public static TypeSig javaLangThrowable()

### javaLangString

    public static TypeSig javaLangString()

### javaLangRuntimeException

    public static TypeSig javaLangRuntimeException()

### javaLangCloneable

    public static TypeSig javaLangCloneable()

### javaLangClass

    public static TypeSig javaLangClass()

### isErrorType

    public static boolean isErrorType(Type t)

  * Predicates on types: * *

### isReferenceType

    public static boolean isReferenceType(Type t)

### isReferenceOrNullType

    public static boolean isReferenceOrNullType(Type t)

### isPrimitiveType

    private static boolean isPrimitiveType(Type t,
                                           int tag)

### isByteType

    public static boolean isByteType(Type t)

### isBooleanType

    public static boolean isBooleanType(Type t)

### isShortType

    public static boolean isShortType(Type t)

### isCharType

    public static boolean isCharType(Type t)

### isDoubleType

    public static boolean isDoubleType(Type t)

### isFloatType

    public static boolean isFloatType(Type t)

### isIntType

    public static boolean isIntType(Type t)

### isLongType

    public static boolean isLongType(Type t)

### isVoidType

    public static boolean isVoidType(Type t)

### isNumericType

    public static boolean isNumericType(Type t)

### isNumericTypeInstance

    public boolean isNumericTypeInstance(Type t)

### isIntegralType

    public static boolean isIntegralType(Type t)

### isIntegralTypeInstance

    public boolean isIntegralTypeInstance(Type t)

### isFloatingPointType

    public static boolean isFloatingPointType(Type t)

### isFloatingPointTypeInstance

    public boolean isFloatingPointTypeInstance(Type t)

### isSameType

    public static boolean isSameType(Type x,
                                     Type y)

### isSameTypeInstance

    protected boolean isSameTypeInstance(Type x,
                                         Type y)

### isSubclassOf

    public static boolean isSubclassOf(Type x,
                                       TypeSig y)

  Returns true if and only if `x` is a subclass or superinterface of `y`. (The occurrence of "class" in the name of the method is rather unfortunate.)

### isSubClassOrEq

    public static boolean isSubClassOrEq(Type x,
                                         Type y)

  Returns true iff `x` is a superclass or superinterface of `y`, or if `x` is the same type as `y`. Warning: This is *not* the same as is `x` a subtype of `y`! It does not consider short below int.

### isCastable

    public static boolean isCastable(Type s,
                                     Type t)

  Checks if one Type is castable to another. See JLS, P.67.

### isCastableInstance

    protected boolean isCastableInstance(Type s,
                                         Type t)

### isInvocationConvertable

    public static boolean isInvocationConvertable(Type x,
                                                  Type y)

### isInvocationConvertableInstance

    protected boolean isInvocationConvertableInstance(Type x,
                                                      Type y)

### isWideningPrimitiveConvertable

    protected static boolean isWideningPrimitiveConvertable(Type x,
                                                            Type y)

### isWideningPrimitiveConvertableInstance

    protected boolean isWideningPrimitiveConvertableInstance(Type x,
                                                             Type y)

### isAnyPrimitiveConvertable

    protected static boolean isAnyPrimitiveConvertable(Type x,
                                                       Type y)

  Returns true iff the first argument is convertable to the second argument, either through a widening primitive conversion, a narrowing primitive conversion, or the identity conversion.

### isWideningReferenceConvertable

    protected static boolean isWideningReferenceConvertable(Type s,
                                                            Type t)

### isWideningReferenceConvertableInstance

    protected boolean isWideningReferenceConvertableInstance(Type s,
                                                             Type t)

### toClassTypeSig

    public static TypeSig toClassTypeSig(Type x)

  Returns the TypeSig for a Type x, if x denotes a class type, otherwise returns null.

### unaryPromote

    public static Type unaryPromote(Type t)

### binaryNumericPromotion

    public static Type binaryNumericPromotion(Type x,
                                              Type y)

### baseType

    public static Type baseType(Type t)

### zeroEquivalent

    public static LiteralExpr zeroEquivalent(Type t)

### isSameMethodSig

    public static boolean isSameMethodSig(MethodDecl x,
                                          MethodDecl y)

### isSameFormalParaDeclVec

    public static boolean isSameFormalParaDeclVec(FormalParaDeclVec x,
                                                  FormalParaDeclVec y)

### routineMoreSpecific

    public static boolean routineMoreSpecific(RoutineDecl x,
                                              RoutineDecl y)

### isCheckedException

    static boolean isCheckedException(Type E)

  Is an exception a checked one?

### isCompatibleRaises

    static boolean isCompatibleRaises(TypeNameVec x,
                                      TypeNameVec y)

  Is "throws " a valid overriding of "throws "?

  Answer: Each exception E in the list must be either: (a) an unchecked exception (b) a subtype of some exception in the list

### isCompatibleAccess

    static boolean isCompatibleAccess(int x,
                                      int y)

### getFormalParaTypes

    public static Type[] getFormalParaTypes(FormalParaDeclVec args)

### printName

    public static java.lang.String printName(Type t)

  Returns the name of a `Type` as a `String`. The resulting name will be fully qualified if the `Type` has been name resolved.

  Note: `t` may safely be null.

  Precondition: `PrettyPrint.inst` != null

### printNameInstance

    protected java.lang.String printNameInstance(Type t)

### printName

    public static java.lang.String printName(Type[] ts)

  Formats an array of `Type`s as a `String` containing a parenthesized list of user-readable names. The resulting names will be fully qualified if the `Type`s have been name resolved.

  Sample output: "(int, javafe.tc.TypeSig, char[])"

  Precondition: `PrettyPrint.inst` != null, `ts` != null

### lookupField

    public static FieldDecl lookupField(Type t,
                                        Identifier id,
                                        TypeSig caller)
                                 throws LookupException

  Throws:
    `LookupException`

### lookupFieldInstance

    protected FieldDecl lookupFieldInstance(Type t,
                                            Identifier id,
                                            TypeSig caller)
                                     throws LookupException

  Throws:
    `LookupException`

### lookupMethod

    public static MethodDecl lookupMethod(Type t,
                                          Identifier id,
                                          Type[] args,
                                          TypeSig caller)
                                   throws LookupException

  Throws:
    `LookupException`

### lookupMethodInstance

    protected MethodDecl lookupMethodInstance(Type t,
                                              Identifier id,
                                              Type[] args,
                                              TypeSig caller)
                                       throws LookupException

  Throws:
    `LookupException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

The ESC/Java2 Project Homepage