polyglot.types
Interface TypeSystem

All Known Subinterfaces:
CofferTypeSystem, PaoTypeSystem, ParamTypeSystem
All Known Implementing Classes:
CofferTypeSystem_c, PaoTypeSystem_c, ParamTypeSystem_c, TypeSystem_c

public interface TypeSystem

The TypeSystem defines the types of the language and how they are related.


Method Summary
 Flags Abstract()
           
 ClassType ArithmeticException()
          java.lang.ArithmeticException
 ArrayType arrayOf(Position pos, Type type)
          Return an array of type
 ArrayType arrayOf(Position pos, Type type, int dims)
          Return a dims-array of type
 ArrayType arrayOf(Type type)
          Return an array of type
 ArrayType arrayOf(Type type, int dims)
          Return a dims-array of type
 ClassType ArrayStoreException()
          java.lang.ArrayStoreException
 PrimitiveType Boolean()
          boolean
 PrimitiveType Byte()
          byte
 boolean callValid(ProcedureInstance mi, java.util.List argTypes)
          Return true if pi can be called with actual parameters of types actualTypes.
 boolean canCoerceToString(Type t, Context c)
          Returns true iff the type t can be coerced to a String in the given Context.
 boolean canOverride(MethodInstance mi, MethodInstance mj)
          Return true if mi can override mj.
 PrimitiveType Char()
          char
 void checkAccessFlags(Flags f)
          Assert if the flags f are legal access flags.
 void checkClassConformance(ClassType ct)
          Assert that ct implements all abstract methods that it has to; that is, if it is a concrete class, then it must implement all interfaces and abstract methods that it or its superclasses declare.
 void checkConstructorFlags(Flags f)
          Assert if the flags f are legal constructor flags.
 void checkCycles(ReferenceType t)
          Assert that t has no cycles in the super type+nested class graph starting at t.
 void checkFieldFlags(Flags f)
          Assert if the flags f are legal field flags.
 void checkInitializerFlags(Flags f)
          Assert if the flags f are legal initializer flags.
 void checkLocalClassFlags(Flags f)
          Assert if the flags f are legal local class flags.
 void checkLocalFlags(Flags f)
          Assert if the flags f are legal local variable flags.
 void checkMemberClassFlags(Flags f)
          Assert if the flags f are legal member class flags.
 void checkMethodFlags(Flags f)
          Assert if the flags f are legal method flags.
 void checkOverride(MethodInstance mi, MethodInstance mj)
          Throw a SemanticException if mi cannot override mj.
 void checkTopLevelClassFlags(Flags f)
          Assert if the flags f are legal top-level class flags.
 ClassType Class()
          java.lang.Class
 boolean classAccessible(ClassType ct, Context context)
          Checks whether a class can be accessed from Context context.
 boolean classAccessibleFromPackage(ClassType ct, Package pkg)
          Checks whether a top-level or member class can be accessed from the package pkg.
 ClassType ClassCastException()
          java.lang.ClassCastException
 Resolver classContextResolver(ClassType ct)
          Get a resolver for looking up a type in a class context.
 ClassType Cloneable()
          java.lang.Cloneable
 ConstructorInstance constructorInstance(Position pos, ClassType container, Flags flags, java.util.List argTypes, java.util.List excTypes)
          Create a constructor instance.
 ParsedClassType createClassType()
          Create a new empty class.
 ParsedClassType createClassType(LazyClassInitializer init)
          Create a new empty class.
 ParsedClassType createClassType(LazyClassInitializer init, Source fromSource)
          Create a new empty class.
 ParsedClassType createClassType(Source fromSource)
          Create a new empty class.
 Context createContext()
          Create a new context object for looking up variables, types, etc.
 Flags createNewFlag(java.lang.String name, Flags print_after)
          Create a new unique Flags object.
 Package createPackage(Package prefix, java.lang.String name)
          Return a package by name with the given outer package.
 Package createPackage(java.lang.String name)
          Return a package by name.
 LazyClassInitializer defaultClassInitializer()
          The default lazy class initializer.
 ConstructorInstance defaultConstructor(Position pos, ClassType container)
          Create a default constructor instance.
 java.util.List defaultPackageImports()
          Return a list of the packages names that will be imported by default.
 boolean descendsFrom(Type child, Type ancestor)
          Returns true iff child is not ancestor, but child descends from ancestor.
 PrimitiveType Double()
          double
 boolean equals(TypeObject type1, TypeObject type2)
          Returns true iff type1 and type2 represent the same type object.
 ClassType Error()
          java.lang.Error
 ClassType Exception()
          java.lang.Exception
 FieldInstance fieldInstance(Position pos, ReferenceType container, Flags flags, Type type, java.lang.String name)
          Create a field instance.
 Flags Final()
           
 ConstructorInstance findConstructor(ClassType container, java.util.List argTypes, ClassType currClass)
          Find a constructor.
 ConstructorInstance findConstructor(ClassType container, java.util.List argTypes, Context c)
          Deprecated.  
 FieldInstance findField(ReferenceType container, java.lang.String name)
          Returns the field named 'name' defined on 'type'.
 FieldInstance findField(ReferenceType container, java.lang.String name, ClassType currClass)
          Returns the field named 'name' defined on 'type'.
 FieldInstance findField(ReferenceType container, java.lang.String name, Context c)
          Deprecated.  
 ClassType findMemberClass(ClassType container, java.lang.String name)
          Find a member class.
 ClassType findMemberClass(ClassType container, java.lang.String name, ClassType currClass)
          Find a member class.
 ClassType findMemberClass(ClassType container, java.lang.String name, Context c)
          Deprecated.  
 MethodInstance findMethod(ReferenceType container, java.lang.String name, java.util.List argTypes, ClassType currClass)
          Find a method.
 MethodInstance findMethod(ReferenceType container, java.lang.String name, java.util.List argTypes, Context c)
          Deprecated.  
 Flags flagsForBits(int bits)
          Given the JVM encoding of a set of flags, returns the Flags object for that encoding.
 PrimitiveType Float()
          float
 Named forName(java.lang.String name)
          Get the named type object with the following name.
 java.lang.String getTransformedClassName(ClassType ct)
          Get the transformed class name of a class.
 java.util.Set getTypeEncoderRootSet(Type clazz)
          Return the set of objects that should be serialized into the type information for the given ClassType.
 boolean hasEnclosingInstance(ClassType inner, ClassType encl)
          Returns whether an object of the inner class inner has an enclosing instance of class encl.
 boolean hasFormals(ProcedureInstance p, java.util.List formalTypes)
          Returns true iff p has exactly the formal arguments formalTypes.
 boolean hasMethod(ReferenceType t, MethodInstance mi)
          Returns true iff t has the method mi.
 boolean hasMethodNamed(ReferenceType t, java.lang.String name)
          Returns true iff t has a method with name name either defined in t or inherited into it.
 java.util.List implemented(MethodInstance mi)
          Get the list of methods mi implements, in no specified order.
 ImportTable importTable(Package pkg)
          Create an import table for the source file.
 ImportTable importTable(java.lang.String sourceName, Package pkg)
          Create an import table for the source file.
 void initialize(LoadedClassResolver resolver, ExtensionInfo extInfo)
          Initialize the type system with the compiler.
 InitializerInstance initializerInstance(Position pos, ClassType container, Flags flags)
          Create an initailizer instance.
 PrimitiveType Int()
          int
 Flags Interface()
           
 java.util.List interfaces(ReferenceType type)
          Returns an immutable list of all the interface types which type implements.
 boolean isAccessible(MemberInstance mi, Context context)
          Checks whether a class member can be accessed from Context context.
 boolean isCanonical(Type type)
          Returns true iff type is a canonical (fully qualified) type.
 boolean isCastValid(Type fromType, Type toType)
          Returns true iff a cast from fromType to toType is valid; in other words, some non-null members of fromType are also members of toType.
 boolean isEnclosed(ClassType inner, ClassType outer)
          Returns whether inner is enclosed within outer
 boolean isImplicitCastValid(Type fromType, Type toType)
          Returns true iff an implicit cast from fromType to toType is valid; in other words, every member of fromType is member of toType.
 boolean isSameMethod(MethodInstance m1, MethodInstance m2)
          Returns true iff m1 is the same method as m2.
 boolean isSubtype(Type child, Type ancestor)
          Returns true iff child descends from ancestor or child == ancestor.
 boolean isThrowable(Type type)
          Returns true iff an object of type type may be thrown.
 boolean isUncheckedException(Type type)
          Returns a true iff the type or a supertype is in the list returned by uncheckedExceptions().
 Type leastCommonAncestor(Type type1, Type type2)
          Returns the least common ancestor of type1 and type2
 LoadedClassResolver loadedResolver()
          Return the type system's loaded resolver.
 LocalInstance localInstance(Position pos, Flags flags, Type type, java.lang.String name)
          Create a local variable instance.
 PrimitiveType Long()
          long
 boolean methodCallValid(MethodInstance mi, java.lang.String name, java.util.List argTypes)
          Return true if mi can be called with name name and actual parameters of types actualTypes.
 MethodInstance methodInstance(Position pos, ReferenceType container, Flags flags, Type returnType, java.lang.String name, java.util.List argTypes, java.util.List excTypes)
          Create a method instance.
 boolean moreSpecific(ProcedureInstance m1, ProcedureInstance m2)
          Returns true iff m1 is more specific than m2.
 Flags Native()
           
 Flags NoFlags()
           
 NullType Null()
          The type of null.
 ClassType NullPointerException()
          java.lang.NullPointerException
 boolean numericConversionValid(Type t, long value)
          Returns true if value can be implicitly cast to type t.
 boolean numericConversionValid(Type t, java.lang.Object value)
          Returns true if value can be implicitly cast to type t.
 ClassType Object()
          java.lang.Object
 ClassType OutOfBoundsException()
          java.lang.ArrayIndexOutOfBoundsException
 java.util.List overrides(MethodInstance mi)
          Get the list of methods mi (potentially) overrides, in order from this class (that is, including this) to super classes.
 Resolver packageContextResolver(Resolver resolver, Package pkg)
          Get a resolver for looking up a type in a package.
 boolean packageExists(java.lang.String name)
          Returns true if the package named name exists.
 Package packageForName(Package prefix, java.lang.String name)
          Return a package by name with the given outer package.
 Package packageForName(java.lang.String name)
          Return a package by name.
 TableResolver parsedResolver()
          Return the type system's table resolver.
 java.lang.Object placeHolder(TypeObject o)
          Get a place-holder for serializing a type object.
 java.lang.Object placeHolder(TypeObject o, java.util.Set roots)
          Get a place-holder for serializing a type object.
 PrimitiveType primitiveForName(java.lang.String name)
          Return the primitive with the given name.
 Flags Private()
           
 PrimitiveType promote(Type t)
          Unary promotion for numeric types.
 PrimitiveType promote(Type t1, Type t2)
          Binary promotion for numeric types.
 Flags Protected()
           
 Flags Public()
           
 ClassType RuntimeException()
          java.lang.RuntimeException
 ClassType Serializable()
          java.io.Serializable
 PrimitiveType Short()
          short
 Flags Static()
           
 Type staticTarget(Type t)
          Returns t, modified as necessary to make it a legal static target.
 Flags StrictFP()
           
 ClassType String()
          java.lang.String
 Type superType(ReferenceType type)
          Returns the immediate supertype of type, or null if type has no supertype.
 Flags Synchronized()
           
 TopLevelResolver systemResolver()
          Returns the system resolver.
 ClassType Throwable()
          java.lang.Throwable
 boolean throwsSubset(ProcedureInstance m1, ProcedureInstance m2)
          Returns true iff m1 throws fewer exceptions than m2.
 Flags Transient()
           
 java.lang.String translateArray(Resolver c, ArrayType t)
          Translate an array type.
 java.lang.String translateClass(Resolver c, ClassType t)
          Translate a top-level class type.
 java.lang.String translatePackage(Resolver c, Package p)
          Translate a package.
 java.lang.String translatePrimitive(Resolver c, PrimitiveType t)
          Translate a primitive type.
 Type typeForName(java.lang.String name)
          Get the type with the following name.
 java.util.Collection uncheckedExceptions()
          Returns a collection of the Throwable types that need not be declared in method and constructor signatures.
 UnknownPackage unknownPackage(Position pos)
          Get an unknown package.
 UnknownQualifier unknownQualifier(Position pos)
          Get an unknown type qualifier.
 UnknownType unknownType(Position pos)
          Get an unknown type.
 PrimitiveType Void()
          void
 Flags Volatile()
           
 java.lang.String wrapperTypeString(PrimitiveType t)
          Return the boxed version of t.
 

Method Detail

initialize

void initialize(LoadedClassResolver resolver,
                ExtensionInfo extInfo)
                throws SemanticException
Initialize the type system with the compiler. This method must be called before any other type system method is called.

Parameters:
resolver - The resolver to use for loading types from class files or other source files.
extInfo - The ExtensionInfo the TypeSystem is being created for.
Throws:
SemanticException

systemResolver

TopLevelResolver systemResolver()
Returns the system resolver. This resolver can load top-level classes with fully qualified names from the class path and the source path.


parsedResolver

TableResolver parsedResolver()
Return the type system's table resolver. This resolver contains types parsed from source files.


loadedResolver

LoadedClassResolver loadedResolver()
Return the type system's loaded resolver. This resolver contains types loaded from class files.


importTable

ImportTable importTable(java.lang.String sourceName,
                        Package pkg)
Create an import table for the source file.

Parameters:
sourceName - Name of the source file to import into. This is used mainly for error messages and for debugging.
pkg - The package of the source file in which to import.

importTable

ImportTable importTable(Package pkg)
Create an import table for the source file.

Parameters:
pkg - The package of the source file in which to import.

defaultPackageImports

java.util.List defaultPackageImports()
Return a list of the packages names that will be imported by default. A list of Strings is returned, not a list of Packages.


packageExists

boolean packageExists(java.lang.String name)
Returns true if the package named name exists.


forName

Named forName(java.lang.String name)
              throws SemanticException
Get the named type object with the following name.

Parameters:
name - The name of the type object to look for.
Throws:
SemanticException - when object is not found.

typeForName

Type typeForName(java.lang.String name)
                 throws SemanticException
Get the type with the following name.

Parameters:
name - The name to create the type for.
Throws:
SemanticException - when type is not found.

initializerInstance

InitializerInstance initializerInstance(Position pos,
                                        ClassType container,
                                        Flags flags)
Create an initailizer instance.

Parameters:
pos - Position of the initializer.
container - Containing class of the initializer.
flags - The initializer's flags.

constructorInstance

ConstructorInstance constructorInstance(Position pos,
                                        ClassType container,
                                        Flags flags,
                                        java.util.List argTypes,
                                        java.util.List excTypes)
Create a constructor instance.

Parameters:
pos - Position of the constructor.
container - Containing class of the constructor.
flags - The constructor's flags.
argTypes - The constructor's formal parameter types.
excTypes - The constructor's exception throw types.

methodInstance

MethodInstance methodInstance(Position pos,
                              ReferenceType container,
                              Flags flags,
                              Type returnType,
                              java.lang.String name,
                              java.util.List argTypes,
                              java.util.List excTypes)
Create a method instance.

Parameters:
pos - Position of the method.
container - Containing type of the method.
flags - The method's flags.
returnType - The method's return type.
name - The method's name.
argTypes - The method's formal parameter types.
excTypes - The method's exception throw types.

fieldInstance

FieldInstance fieldInstance(Position pos,
                            ReferenceType container,
                            Flags flags,
                            Type type,
                            java.lang.String name)
Create a field instance.

Parameters:
pos - Position of the field.
container - Containing type of the field.
flags - The field's flags.
type - The field's type.
name - The field's name.

localInstance

LocalInstance localInstance(Position pos,
                            Flags flags,
                            Type type,
                            java.lang.String name)
Create a local variable instance.

Parameters:
pos - Position of the local variable.
flags - The local variable's flags.
type - The local variable's type.
name - The local variable's name.

defaultConstructor

ConstructorInstance defaultConstructor(Position pos,
                                       ClassType container)
Create a default constructor instance.

Parameters:
pos - Position of the constructor.
container - Containing class of the constructor.

unknownType

UnknownType unknownType(Position pos)
Get an unknown type.


unknownPackage

UnknownPackage unknownPackage(Position pos)
Get an unknown package.


unknownQualifier

UnknownQualifier unknownQualifier(Position pos)
Get an unknown type qualifier.


isSubtype

boolean isSubtype(Type child,
                  Type ancestor)
Returns true iff child descends from ancestor or child == ancestor. This is equivalent to:
    descendsFrom(child, ancestor) || equals(child, ancestor)
 


descendsFrom

boolean descendsFrom(Type child,
                     Type ancestor)
Returns true iff child is not ancestor, but child descends from ancestor.


isCastValid

boolean isCastValid(Type fromType,
                    Type toType)
Returns true iff a cast from fromType to toType is valid; in other words, some non-null members of fromType are also members of toType.


isImplicitCastValid

boolean isImplicitCastValid(Type fromType,
                            Type toType)
Returns true iff an implicit cast from fromType to toType is valid; in other words, every member of fromType is member of toType.


equals

boolean equals(TypeObject type1,
               TypeObject type2)
Returns true iff type1 and type2 represent the same type object.


numericConversionValid

boolean numericConversionValid(Type t,
                               long value)
Returns true if value can be implicitly cast to type t. This method should be removed. It is kept for backward compatibility.


numericConversionValid

boolean numericConversionValid(Type t,
                               java.lang.Object value)
Returns true if value can be implicitly cast to type t.


leastCommonAncestor

Type leastCommonAncestor(Type type1,
                         Type type2)
                         throws SemanticException
Returns the least common ancestor of type1 and type2

Throws:
SemanticException - if the LCA does not exist

isCanonical

boolean isCanonical(Type type)
Returns true iff type is a canonical (fully qualified) type.


isAccessible

boolean isAccessible(MemberInstance mi,
                     Context context)
Checks whether a class member can be accessed from Context context.


classAccessible

boolean classAccessible(ClassType ct,
                        Context context)
Checks whether a class can be accessed from Context context.


classAccessibleFromPackage

boolean classAccessibleFromPackage(ClassType ct,
                                   Package pkg)
Checks whether a top-level or member class can be accessed from the package pkg. Returns false for local and anonymous classes.


isEnclosed

boolean isEnclosed(ClassType inner,
                   ClassType outer)
Returns whether inner is enclosed within outer


hasEnclosingInstance

boolean hasEnclosingInstance(ClassType inner,
                             ClassType encl)
Returns whether an object of the inner class inner has an enclosing instance of class encl.


canCoerceToString

boolean canCoerceToString(Type t,
                          Context c)
Returns true iff the type t can be coerced to a String in the given Context. If a type can be coerced to a String then it can be concatenated with Strings, e.g. if o is of type T, then the code snippet "" + o would be allowed.


isThrowable

boolean isThrowable(Type type)
Returns true iff an object of type type may be thrown.


isUncheckedException

boolean isUncheckedException(Type type)
Returns a true iff the type or a supertype is in the list returned by uncheckedExceptions().


uncheckedExceptions

java.util.Collection uncheckedExceptions()
Returns a collection of the Throwable types that need not be declared in method and constructor signatures.


promote

PrimitiveType promote(Type t)
                      throws SemanticException
Unary promotion for numeric types.

Throws:
SemanticException - if the type cannot be promoted.

promote

PrimitiveType promote(Type t1,
                      Type t2)
                      throws SemanticException
Binary promotion for numeric types.

Throws:
SemanticException - if the types cannot be promoted.

findField

FieldInstance findField(ReferenceType container,
                        java.lang.String name,
                        Context c)
                        throws SemanticException
Deprecated. 

Deprecated version of the findField method.

Throws:
SemanticException

findField

FieldInstance findField(ReferenceType container,
                        java.lang.String name,
                        ClassType currClass)
                        throws SemanticException
Returns the field named 'name' defined on 'type'. We check if the field is accessible from the class currClass.

Throws:
SemanticException - if the field cannot be found or is inaccessible.

findField

FieldInstance findField(ReferenceType container,
                        java.lang.String name)
                        throws SemanticException
Returns the field named 'name' defined on 'type'.

Throws:
SemanticException - if the field cannot be found or is inaccessible.

findMethod

MethodInstance findMethod(ReferenceType container,
                          java.lang.String name,
                          java.util.List argTypes,
                          ClassType currClass)
                          throws SemanticException
Find a method. We need to pass the class from which the method is being found because the method we find depends on whether the method is accessible from that class. We also check if the field is accessible from the context 'c'.

Throws:
SemanticException - if the method cannot be found or is inaccessible.

findMethod

MethodInstance findMethod(ReferenceType container,
                          java.lang.String name,
                          java.util.List argTypes,
                          Context c)
                          throws SemanticException
Deprecated. 

Deprecated version of the findMethod method.

Throws:
SemanticException

findConstructor

ConstructorInstance findConstructor(ClassType container,
                                    java.util.List argTypes,
                                    ClassType currClass)
                                    throws SemanticException
Find a constructor. We need to pass the class from which the constructor is being found because the constructor we find depends on whether the constructor is accessible from that class.

Throws:
SemanticException - if the constructor cannot be found or is inaccessible.

findConstructor

ConstructorInstance findConstructor(ClassType container,
                                    java.util.List argTypes,
                                    Context c)
                                    throws SemanticException
Deprecated. 

Deprecated version of the findConstructor method.

Throws:
SemanticException

findMemberClass

ClassType findMemberClass(ClassType container,
                          java.lang.String name,
                          ClassType currClass)
                          throws SemanticException
Find a member class. We check if the field is accessible from the class currClass.

Throws:
SemanticException - if the class cannot be found or is inaccessible.

findMemberClass

ClassType findMemberClass(ClassType container,
                          java.lang.String name,
                          Context c)
                          throws SemanticException
Deprecated. 

Deprecated version of the findMemberClass method.

Throws:
SemanticException

findMemberClass

ClassType findMemberClass(ClassType container,
                          java.lang.String name)
                          throws SemanticException
Find a member class.

Throws:
SemanticException - if the class cannot be found or is inaccessible.

superType

Type superType(ReferenceType type)
Returns the immediate supertype of type, or null if type has no supertype.


interfaces

java.util.List interfaces(ReferenceType type)
Returns an immutable list of all the interface types which type implements.


throwsSubset

boolean throwsSubset(ProcedureInstance m1,
                     ProcedureInstance m2)
Returns true iff m1 throws fewer exceptions than m2.


hasMethod

boolean hasMethod(ReferenceType t,
                  MethodInstance mi)
Returns true iff t has the method mi.


hasMethodNamed

boolean hasMethodNamed(ReferenceType t,
                       java.lang.String name)
Returns true iff t has a method with name name either defined in t or inherited into it.


isSameMethod

boolean isSameMethod(MethodInstance m1,
                     MethodInstance m2)
Returns true iff m1 is the same method as m2.


moreSpecific

boolean moreSpecific(ProcedureInstance m1,
                     ProcedureInstance m2)
Returns true iff m1 is more specific than m2.


hasFormals

boolean hasFormals(ProcedureInstance p,
                   java.util.List formalTypes)
Returns true iff p has exactly the formal arguments formalTypes.


Null

NullType Null()
The type of null.


Void

PrimitiveType Void()
void


Boolean

PrimitiveType Boolean()
boolean


Char

PrimitiveType Char()
char


Byte

PrimitiveType Byte()
byte


Short

PrimitiveType Short()
short


Int

PrimitiveType Int()
int


Long

PrimitiveType Long()
long


Float

PrimitiveType Float()
float


Double

PrimitiveType Double()
double


Object

ClassType Object()
java.lang.Object


String

ClassType String()
java.lang.String


Class

ClassType Class()
java.lang.Class


Throwable

ClassType Throwable()
java.lang.Throwable


Error

ClassType Error()
java.lang.Error


Exception

ClassType Exception()
java.lang.Exception


RuntimeException

ClassType RuntimeException()
java.lang.RuntimeException


Cloneable

ClassType Cloneable()
java.lang.Cloneable


Serializable

ClassType Serializable()
java.io.Serializable


NullPointerException

ClassType NullPointerException()
java.lang.NullPointerException


ClassCastException

ClassType ClassCastException()
java.lang.ClassCastException


OutOfBoundsException

ClassType OutOfBoundsException()
java.lang.ArrayIndexOutOfBoundsException


ArrayStoreException

ClassType ArrayStoreException()
java.lang.ArrayStoreException


ArithmeticException

ClassType ArithmeticException()
java.lang.ArithmeticException


arrayOf

ArrayType arrayOf(Type type)
Return an array of type


arrayOf

ArrayType arrayOf(Position pos,
                  Type type)
Return an array of type


arrayOf

ArrayType arrayOf(Type type,
                  int dims)
Return a dims-array of type


arrayOf

ArrayType arrayOf(Position pos,
                  Type type,
                  int dims)
Return a dims-array of type


packageForName

Package packageForName(java.lang.String name)
                       throws SemanticException
Return a package by name. Fail if the package does not exists.

Throws:
SemanticException

packageForName

Package packageForName(Package prefix,
                       java.lang.String name)
                       throws SemanticException
Return a package by name with the given outer package. Fail if the package does not exists.

Throws:
SemanticException

createPackage

Package createPackage(java.lang.String name)
Return a package by name.


createPackage

Package createPackage(Package prefix,
                      java.lang.String name)
Return a package by name with the given outer package.


createContext

Context createContext()
Create a new context object for looking up variables, types, etc.


packageContextResolver

Resolver packageContextResolver(Resolver resolver,
                                Package pkg)
Get a resolver for looking up a type in a package.


classContextResolver

Resolver classContextResolver(ClassType ct)
Get a resolver for looking up a type in a class context.


defaultClassInitializer

LazyClassInitializer defaultClassInitializer()
The default lazy class initializer.


createClassType

ParsedClassType createClassType(LazyClassInitializer init)
Create a new empty class.


createClassType

ParsedClassType createClassType()
Create a new empty class.


createClassType

ParsedClassType createClassType(LazyClassInitializer init,
                                Source fromSource)
Create a new empty class.


createClassType

ParsedClassType createClassType(Source fromSource)
Create a new empty class.


getTypeEncoderRootSet

java.util.Set getTypeEncoderRootSet(Type clazz)
Return the set of objects that should be serialized into the type information for the given ClassType. Usually only the clazz itself should get encoded, and references to other classes should just have their name written out. If it makes sense for additional types to be fully encoded, (ie, they're necessary to correctly reconstruct the given clazz, and the usual class resolvers can't otherwise find them) they should be returned in the set in addition to clazz.


getTransformedClassName

java.lang.String getTransformedClassName(ClassType ct)
Get the transformed class name of a class. This utility method returns the "mangled" name of the given class, whereby all periods ('.') following the toplevel class name are replaced with dollar signs ('$'). If any of the containing classes is not a member class or a top level class, then null is returned.


placeHolder

java.lang.Object placeHolder(TypeObject o,
                             java.util.Set roots)
Get a place-holder for serializing a type object.

Parameters:
o - The object to get the place-holder for.
roots - The root objects for the serialization. Place holders are not created for these.

placeHolder

java.lang.Object placeHolder(TypeObject o)
Get a place-holder for serializing a type object.

Parameters:
o - The object to get the place-holder for.

translatePackage

java.lang.String translatePackage(Resolver c,
                                  Package p)
Translate a package.


translatePrimitive

java.lang.String translatePrimitive(Resolver c,
                                    PrimitiveType t)
Translate a primitive type.


translateArray

java.lang.String translateArray(Resolver c,
                                ArrayType t)
Translate an array type.


translateClass

java.lang.String translateClass(Resolver c,
                                ClassType t)
Translate a top-level class type.


wrapperTypeString

java.lang.String wrapperTypeString(PrimitiveType t)
Return the boxed version of t.


methodCallValid

boolean methodCallValid(MethodInstance mi,
                        java.lang.String name,
                        java.util.List argTypes)
Return true if mi can be called with name name and actual parameters of types actualTypes.


callValid

boolean callValid(ProcedureInstance mi,
                  java.util.List argTypes)
Return true if pi can be called with actual parameters of types actualTypes.


overrides

java.util.List overrides(MethodInstance mi)
Get the list of methods mi (potentially) overrides, in order from this class (that is, including this) to super classes.


canOverride

boolean canOverride(MethodInstance mi,
                    MethodInstance mj)
Return true if mi can override mj.


checkOverride

void checkOverride(MethodInstance mi,
                   MethodInstance mj)
                   throws SemanticException
Throw a SemanticException if mi cannot override mj.

Throws:
SemanticException

implemented

java.util.List implemented(MethodInstance mi)
Get the list of methods mi implements, in no specified order.


primitiveForName

PrimitiveType primitiveForName(java.lang.String name)
                               throws SemanticException
Return the primitive with the given name.

Throws:
SemanticException

checkMethodFlags

void checkMethodFlags(Flags f)
                      throws SemanticException
Assert if the flags f are legal method flags.

Throws:
SemanticException

checkLocalFlags

void checkLocalFlags(Flags f)
                     throws SemanticException
Assert if the flags f are legal local variable flags.

Throws:
SemanticException

checkFieldFlags

void checkFieldFlags(Flags f)
                     throws SemanticException
Assert if the flags f are legal field flags.

Throws:
SemanticException

checkConstructorFlags

void checkConstructorFlags(Flags f)
                           throws SemanticException
Assert if the flags f are legal constructor flags.

Throws:
SemanticException

checkInitializerFlags

void checkInitializerFlags(Flags f)
                           throws SemanticException
Assert if the flags f are legal initializer flags.

Throws:
SemanticException

checkTopLevelClassFlags

void checkTopLevelClassFlags(Flags f)
                             throws SemanticException
Assert if the flags f are legal top-level class flags.

Throws:
SemanticException

checkMemberClassFlags

void checkMemberClassFlags(Flags f)
                           throws SemanticException
Assert if the flags f are legal member class flags.

Throws:
SemanticException

checkLocalClassFlags

void checkLocalClassFlags(Flags f)
                          throws SemanticException
Assert if the flags f are legal local class flags.

Throws:
SemanticException

checkAccessFlags

void checkAccessFlags(Flags f)
                      throws SemanticException
Assert if the flags f are legal access flags.

Throws:
SemanticException

checkCycles

void checkCycles(ReferenceType t)
                 throws SemanticException
Assert that t has no cycles in the super type+nested class graph starting at t.

Throws:
SemanticException

checkClassConformance

void checkClassConformance(ClassType ct)
                           throws SemanticException
Assert that ct implements all abstract methods that it has to; that is, if it is a concrete class, then it must implement all interfaces and abstract methods that it or its superclasses declare.

Throws:
SemanticException

staticTarget

Type staticTarget(Type t)
Returns t, modified as necessary to make it a legal static target.


flagsForBits

Flags flagsForBits(int bits)
Given the JVM encoding of a set of flags, returns the Flags object for that encoding.


createNewFlag

Flags createNewFlag(java.lang.String name,
                    Flags print_after)
Create a new unique Flags object.

Parameters:
name - the name of the flag
print_after - print the new flag after these flags

NoFlags

Flags NoFlags()

Public

Flags Public()

Protected

Flags Protected()

Private

Flags Private()

Static

Flags Static()

Final

Flags Final()

Synchronized

Flags Synchronized()

Transient

Flags Transient()

Native

Flags Native()

Interface

Flags Interface()

Abstract

Flags Abstract()

Volatile

Flags Volatile()

StrictFP

Flags StrictFP()