polyglot.ext.param.types
Class ParamTypeSystem_c

java.lang.Object
  extended by polyglot.ext.jl.types.TypeSystem_c
      extended by polyglot.ext.param.types.ParamTypeSystem_c
All Implemented Interfaces:
ParamTypeSystem, TypeSystem
Direct Known Subclasses:
CofferTypeSystem_c

public abstract class ParamTypeSystem_c
extends TypeSystem_c
implements ParamTypeSystem

Implementation of type system for parameterized types.


Nested Class Summary
 
Nested classes/interfaces inherited from class polyglot.ext.jl.types.TypeSystem_c
TypeSystem_c.MostSpecificComparator
 
Field Summary
 
Fields inherited from class polyglot.ext.jl.types.TypeSystem_c
ACCESS_FLAGS, BOOLEAN_, BYTE_, CHAR_, CLASS_, CONSTRUCTOR_FLAGS, defaultClassInit, DOUBLE_, FIELD_FLAGS, flagsForName, FLOAT_, INITIALIZER_FLAGS, INT_, loadedResolver, LOCAL_CLASS_FLAGS, LOCAL_FLAGS, LONG_, MEMBER_CLASS_FLAGS, METHOD_FLAGS, NULL_, OBJECT_, parsedResolver, SHORT_, STRING_, systemResolver, THROWABLE_, TOP_LEVEL_CLASS_FLAGS, unknownPackage, unknownQualifier, unknownType, VOID_
 
Constructor Summary
ParamTypeSystem_c()
           
 
Method Summary
protected  void checkInstantiation(Position pos, PClass base, java.util.List actuals)
          Check that an instantiation of a parametric type on a list of actual parameters is legal.
 ClassType instantiate(Position pos, PClass base, java.util.List actuals)
          Instantiate a parametric type on a list of actual parameters.
 MuPClass mutablePClass(Position pos)
          Create a new mutable PClass.
 Subst subst(java.util.Map substMap, java.util.Map cache)
          Create a substitutor.
 Type subst(Type t, java.util.Map substMap)
          Apply a parameter substitution to a type.
 Type subst(Type t, java.util.Map substMap, java.util.Map cache)
          Apply a parameter substitution to a type.
protected  ClassType uncheckedInstantiate(Position pos, PClass base, java.util.List actuals)
          Instantiate a parametric type on a list of actual parameters, but do not check that the instantiation is legal.
 
Methods inherited from class polyglot.ext.jl.types.TypeSystem_c
Abstract, abstractSuperInterfaces, accessibleFromPackage, ArithmeticException, arrayOf, arrayOf, arrayOf, arrayOf, ArrayStoreException, arrayType, assert_, assert_, Boolean, Byte, callValid, canCoerceToString, canOverride, Char, checkAccessFlags, checkClassConformance, checkConstructorFlags, checkCycles, checkCycles, checkFieldFlags, checkInitializerFlags, checkLocalClassFlags, checkLocalFlags, checkMemberClassFlags, checkMethodFlags, checkOverride, checkTopLevelClassFlags, Class, classAccessible, classAccessible, classAccessibleFromPackage, ClassCastException, classContextResolver, Cloneable, constructorInstance, createClassType, createClassType, createClassType, createClassType, createContext, createNewFlag, createNull, createPackage, createPackage, createPrimitive, defaultClassInitializer, defaultConstructor, defaultPackageImports, descendsFrom, Double, equals, Error, Exception, fieldInstance, Final, findAcceptableConstructors, findAcceptableMethods, findConstructor, findConstructor, findField, findField, findField, findFields, findMemberClass, findMemberClass, findMemberClass, findMemberClasses, findMethod, findMethod, findMostSpecificProcedures, findProcedure, flagsForBits, flagsForName, Float, forName, getTransformedClassName, getTypeEncoderRootSet, hasEnclosingInstance, hasFormals, hasMethod, hasMethodNamed, implemented, importTable, importTable, initFlags, initialize, initializerInstance, initTypes, Int, Interface, interfaces, isAccessible, isAccessible, isCanonical, isCastValid, isEnclosed, isImplicitCastValid, isSameMethod, isSubtype, isThrowable, isUncheckedException, leastCommonAncestor, listToString, load, loadedResolver, localInstance, Long, methodCallValid, methodInstance, moreSpecific, Native, NoFlags, Null, NullPointerException, numericConversionValid, numericConversionValid, Object, OutOfBoundsException, overrides, packageContextResolver, packageExists, packageForName, packageForName, parsedResolver, placeHolder, placeHolder, primitiveForName, Private, promote, promote, promoteNumeric, promoteNumeric, Protected, Public, RuntimeException, Serializable, Short, Static, staticTarget, StrictFP, String, superType, Synchronized, systemResolver, Throwable, throwsSubset, toString, Transient, translateArray, translateClass, translatePackage, translatePrimitive, typeForClass, typeForName, uncheckedExceptions, unknownPackage, unknownQualifier, unknownType, Void, Volatile, wrapperTypeString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface polyglot.types.TypeSystem
Abstract, ArithmeticException, arrayOf, arrayOf, arrayOf, arrayOf, ArrayStoreException, Boolean, Byte, callValid, canCoerceToString, canOverride, Char, checkAccessFlags, checkClassConformance, checkConstructorFlags, checkCycles, checkFieldFlags, checkInitializerFlags, checkLocalClassFlags, checkLocalFlags, checkMemberClassFlags, checkMethodFlags, checkOverride, checkTopLevelClassFlags, Class, classAccessible, classAccessibleFromPackage, ClassCastException, classContextResolver, Cloneable, constructorInstance, createClassType, createClassType, createClassType, createClassType, createContext, createNewFlag, createPackage, createPackage, defaultClassInitializer, defaultConstructor, defaultPackageImports, descendsFrom, Double, equals, Error, Exception, fieldInstance, Final, findConstructor, findConstructor, findField, findField, findField, findMemberClass, findMemberClass, findMemberClass, findMethod, findMethod, flagsForBits, Float, forName, getTransformedClassName, getTypeEncoderRootSet, hasEnclosingInstance, hasFormals, hasMethod, hasMethodNamed, implemented, importTable, importTable, initialize, initializerInstance, Int, Interface, interfaces, isAccessible, isCanonical, isCastValid, isEnclosed, isImplicitCastValid, isSameMethod, isSubtype, isThrowable, isUncheckedException, leastCommonAncestor, loadedResolver, localInstance, Long, methodCallValid, methodInstance, moreSpecific, Native, NoFlags, Null, NullPointerException, numericConversionValid, numericConversionValid, Object, OutOfBoundsException, overrides, packageContextResolver, packageExists, packageForName, packageForName, parsedResolver, placeHolder, placeHolder, primitiveForName, Private, promote, promote, Protected, Public, RuntimeException, Serializable, Short, Static, staticTarget, StrictFP, String, superType, Synchronized, systemResolver, Throwable, throwsSubset, Transient, translateArray, translateClass, translatePackage, translatePrimitive, typeForName, uncheckedExceptions, unknownPackage, unknownQualifier, unknownType, Void, Volatile, wrapperTypeString
 

Constructor Detail

ParamTypeSystem_c

public ParamTypeSystem_c()
Method Detail

mutablePClass

public MuPClass mutablePClass(Position pos)
Create a new mutable PClass.

Specified by:
mutablePClass in interface ParamTypeSystem
Parameters:
pos - The position of the PClass.

instantiate

public ClassType instantiate(Position pos,
                             PClass base,
                             java.util.List actuals)
                      throws SemanticException
Instantiate a parametric type on a list of actual parameters.

Specified by:
instantiate in interface ParamTypeSystem
Parameters:
pos - The position of the instantiated type
base - The parameterized type
actuals - The list of actuals
Throws:
SemanticException - when the actuals do not agree with the formals

checkInstantiation

protected void checkInstantiation(Position pos,
                                  PClass base,
                                  java.util.List actuals)
                           throws SemanticException
Check that an instantiation of a parametric type on a list of actual parameters is legal.

Parameters:
pos - The position of the instantiated type
base - The parameterized type
actuals - The list of actuals
Throws:
SemanticException - when the actuals do not agree with the formals

uncheckedInstantiate

protected ClassType uncheckedInstantiate(Position pos,
                                         PClass base,
                                         java.util.List actuals)
Instantiate a parametric type on a list of actual parameters, but do not check that the instantiation is legal.

Parameters:
pos - The position of the instantiated type
base - The parameterized type
actuals - The list of actuals

subst

public Type subst(Type t,
                  java.util.Map substMap)
Apply a parameter substitution to a type.

Specified by:
subst in interface ParamTypeSystem
Parameters:
t - The type on which we perform substitutions.
substMap - Map from formal parameters to actuals; the formals are not necessarily formals of t.

subst

public Type subst(Type t,
                  java.util.Map substMap,
                  java.util.Map cache)
Apply a parameter substitution to a type.

Specified by:
subst in interface ParamTypeSystem
Parameters:
t - The type on which we perform substitutions.
substMap - Map from formal parameters to actuals; the formals are not necessarily formals of t.
cache - Cache of substitutions performed, implemented as a map from type to substituted type. This is passed in to ensure pointers to outer classes are substituted correctly.

subst

public Subst subst(java.util.Map substMap,
                   java.util.Map cache)
Create a substitutor.

Specified by:
subst in interface ParamTypeSystem
Parameters:
substMap - Map from formal parameters to actuals; the formals are not necessarily formals of t.
cache - Cache of substitutions performed, implemented as a map from type to substituted type. This is passed in to ensure pointers to outer classes are substituted correctly.