public class JL5TypeSystem_c extends ParamTypeSystem_c<TypeVariable,ReferenceType> implements JL5TypeSystem
TypeSystem_c.MostSpecificComparator<T extends ProcedureInstance>
Modifier and Type | Field and Description |
---|---|
protected ClassType |
ANNOTATION_ |
protected ClassType |
ELEMENT_TYPE_ |
protected ClassType |
ENUM_ |
protected ClassType |
ITERABLE_ |
protected ClassType |
ITERATOR_ |
protected ClassType |
OVERRIDE_ANNOTATION_ |
protected ClassType |
RETENTION_ANNOTATION_ |
protected ClassType |
TARGET_ANNOTATION_ |
protected UnknownReferenceType |
unknownReferenceType |
substCache
ABSTRACT_METHOD_FLAGS, ACCESS_FLAGS, BOOLEAN_, BYTE_, CHAR_, CLASS_, CONSTRUCTOR_FLAGS, DOUBLE_, extInfo, FIELD_FLAGS, flagsForName, FLOAT_, INITIALIZER_FLAGS, INT_, INTERFACE_FIELD_FLAGS, loadedResolver, LOCAL_CLASS_FLAGS, LOCAL_FLAGS, LONG_, MEMBER_CLASS_FLAGS, METHOD_FLAGS, NULL_, OBJECT_, SHORT_, STRING_, systemResolver, THROWABLE_, TOP_LEVEL_CLASS_FLAGS, unknownPackage, unknownQualifier, unknownType, VOID_
SERIALIZE_MEMBERS_WITH_CONTAINER
Constructor and Description |
---|
JL5TypeSystem_c() |
Modifier and Type | Method and Description |
---|---|
protected java.util.List<ReferenceType> |
abstractSuperInterfaces(ReferenceType rt)
Utility method to gather all the superclasses and interfaces of
ct that may contain abstract methods that must be
implemented by ct . |
boolean |
accessibleFromPackage(Flags flags,
Package pkg1,
Package pkg2)
Return true if a member (in an accessible container) or a
top-level class with access flags
flags
in package pkg1 is accessible from package
pkg2 . |
java.util.List<ReferenceType> |
allAncestorsOf(ReferenceType rt) |
ClassType |
Annotation() |
ClassType |
AnnotationElementType() |
AnnotationElementValueAnnotation |
AnnotationElementValueAnnotation(Position pos,
Type annotationType,
java.util.Map<java.lang.String,AnnotationElementValue> annotationElementValues) |
AnnotationElementValueArray |
AnnotationElementValueArray(Position pos,
java.util.List<AnnotationElementValue> vals) |
AnnotationElementValueConstant |
AnnotationElementValueConstant(Position pos,
Type type,
java.lang.Object constVal) |
AnnotationTypeElemInstance |
annotationElemInstance(Position pos,
ClassType ct,
Flags f,
Type type,
java.lang.String name,
boolean hasDefault) |
Type |
applyCaptureConversion(Type t,
Position pos)
Apply capture conversion to t.
|
boolean |
areOverrideEquivalent(JL5MethodInstance mi,
JL5MethodInstance mj)
Are methods mi and mj override equivalent?
See JLS 3rd ed.
|
boolean |
areReturnTypeSubstitutable(Type ri,
Type rj)
Are types ri and rj return type substitutable?
See JLS 3rd ed.
|
ArrayType |
arrayOf(Position position,
Type type,
boolean isVarargs) |
protected ArrayType |
arrayType(Position pos,
Type type,
boolean isVarargs) |
Type |
boxingConversion(Type t)
Perform boxing conversion on t.
|
protected boolean |
boxingRequired(JL5ProcedureInstance pi,
java.util.List<? extends Type> paramTypes) |
JL5ProcedureInstance |
callValid(JL5ProcedureInstance mi,
java.util.List<? extends Type> argTypes,
java.util.List<? extends ReferenceType> actualTypeArgs)
Check whether
ci can be called with
arguments of type actualTypes , with type parameters
instantiated with actualTypeArgs. |
boolean |
callValid(ProcedureInstance mi,
java.util.List<? extends Type> argTypes)
Return true if
pi can be called with
actual parameters of types actualTypes . |
boolean |
canBeRaw(Type type) |
CaptureConvertedWildCardType |
captureConvertedWildCardType(Position pos) |
void |
checkAnnotationValueConstant(Term value) |
protected void |
checkCycles(ReferenceType curr,
ReferenceType goal) |
void |
checkDuplicateAnnotations(java.util.List<AnnotationElem> annotations) |
boolean |
checkIntersectionBounds(java.util.List<? extends Type> bounds,
boolean quiet) |
void |
checkMethodNameClash(JL5MethodInstance mi,
ClassType ct)
Check whether mi's name clashes with some other method accessible in
type, according to JLS 3rd ed.
|
void |
checkMethodNameClash(JL5MethodInstance mi,
ClassType type,
ReferenceType declaringClass) |
Type |
Class(Position pos,
ReferenceType type)
Return the class representing Class
type . |
java.util.List<TypeVariable> |
classAndEnclosingTypeVariables(JL5ParsedClassType ct)
Does pct, or a containing class of pct, have type variables?
|
protected void |
classAndEnclosingTypeVariables(JL5ParsedClassType ct,
java.util.List<TypeVariable> l) |
ClassFileLazyClassInitializer |
classFileLazyClassInitializer(ClassFile clazz)
Constructs a new ClassFileLazyClassInitializer for the given class file.
|
java.util.List<Type> |
concreteBounds(java.util.List<? extends Type> bounds) |
ConstructorInstance |
constructorInstance(Position pos,
ClassType container,
Flags flags,
java.util.List<? extends Type> argTypes,
java.util.List<? extends Type> excTypes)
Create a constructor instance.
|
JL5ConstructorInstance |
constructorInstance(Position pos,
ClassType container,
Flags flags,
java.util.List<? extends Type> argTypes,
java.util.List<? extends Type> excTypes,
java.util.List<TypeVariable> typeParams) |
Annotations |
createAnnotations(java.util.Map<Type,java.util.Map<java.lang.String,AnnotationElementValue>> annotationElems,
Position pos) |
protected ArrayType |
createArrayType(Position pos,
Type type)
Factory method for ArrayTypes.
|
protected ArrayType |
createArrayType(Position pos,
Type type,
boolean isVarargs) |
ParsedClassType |
createClassType(LazyClassInitializer init,
Source fromSource)
Create a new empty class.
|
Context |
createContext()
Create a new context object for looking up variables, types, etc.
|
protected NullType |
createNull() |
protected PrimitiveType |
createPrimitive(PrimitiveType.Kind kind) |
LazyClassInitializer |
defaultClassInitializer()
The default lazy class initializer.
|
ConstructorInstance |
defaultConstructor(Position pos,
ClassType container)
Create a default constructor instance.
|
boolean |
descendsFrom(Type child,
Type ancestor)
Returns true iff child and ancestor are distinct,
but child descends from ancestor.
|
ClassType |
Enum() |
EnumInstance |
enumInstance(Position pos,
ClassType ct,
Flags f,
java.lang.String name,
long ordinal) |
JL5Subst |
erasureSubst(JL5ParsedClassType base)
Given a , produce a JL5RawSubst that maps the
TypeVariables to the erasure of their bounds.
|
JL5Subst |
erasureSubst(JL5ProcedureInstance pi)
Given a JL5ProcedureInstance, produce a JL5Subst that maps the
TypeVariables to the erasure of their bounds.
|
Type |
erasureType(Type t)
Returns the erased type of t.
|
protected Type |
erasureType(Type t,
java.util.Set<TypeVariable> visitedTypeVariables) |
JL5FieldInstance |
fieldInstance(Position pos,
ReferenceType container,
Flags flags,
Type type,
java.lang.String name)
Create a field instance.
|
protected java.util.List<? extends ConstructorInstance> |
findAcceptableConstructors(ClassType container,
java.util.List<? extends Type> argTypes,
ClassType currClass,
boolean fromClient)
Populates the list acceptable with those MethodInstances which are
Applicable and Accessible as defined by JLS 15.11.2.1
|
protected java.util.List<ConstructorInstance> |
findAcceptableConstructors(ClassType container,
java.util.List<? extends Type> argTypes,
java.util.List<? extends ReferenceType> actualTypeArgs,
ClassType currClass,
boolean fromClient)
Populates the list acceptable with those MethodInstances which are
Applicable and Accessible as defined by JLS 15.12.2
|
protected java.util.List<? extends MethodInstance> |
findAcceptableMethods(ReferenceType container,
java.lang.String name,
java.util.List<? extends Type> argTypes,
ClassType currClass,
boolean fromClient)
Populates the list acceptable with those MethodInstances which are
Applicable and Accessible as defined by JLS 15.12.2
|
protected java.util.List<? extends MethodInstance> |
findAcceptableMethods(ReferenceType container,
java.lang.String name,
java.util.List<? extends Type> argTypes,
java.util.List<? extends ReferenceType> actualTypeArgs,
ClassType currClass,
boolean fromClient) |
protected java.util.List<? extends MethodInstance> |
findAcceptableMethods(ReferenceType container,
java.lang.String name,
java.util.List<? extends Type> argTypes,
java.util.List<? extends ReferenceType> actualTypeArgs,
ClassType currClass,
Type expectedReturnType,
boolean fromClient) |
AnnotationTypeElemInstance |
findAnnotation(ReferenceType container,
java.lang.String name,
ClassType currClass) |
java.util.Set<AnnotationTypeElemInstance> |
findAnnotations(ReferenceType container,
java.lang.String name) |
ConstructorInstance |
findConstructor(ClassType container,
java.util.List<? extends Type> argTypes,
ClassType currClass,
boolean fromClient)
Find a constructor.
|
ConstructorInstance |
findConstructor(ClassType container,
java.util.List<? extends Type> argTypes,
java.util.List<? extends ReferenceType> typeArgs,
ClassType currClass,
boolean fromClient) |
EnumInstance |
findEnumConstant(ReferenceType container,
long ordinal) |
EnumInstance |
findEnumConstant(ReferenceType container,
java.lang.String name) |
EnumInstance |
findEnumConstant(ReferenceType container,
java.lang.String name,
ClassType currClass) |
EnumInstance |
findEnumConstant(ReferenceType container,
java.lang.String name,
Context c) |
java.util.Set<EnumInstance> |
findEnumConstants(ReferenceType container,
java.lang.String name) |
FieldInstance |
findFieldOrEnum(ReferenceType container,
java.lang.String name,
ClassType currClass) |
JL5SubstClassType |
findGenericSupertype(JL5ParsedClassType base,
ReferenceType sub)
Base is a generic supertype (e.g., a class C with uninstantiated parameters).
|
MethodInstance |
findImplementingMethod(ClassType ct,
MethodInstance mi)
Find a potentially suitable implementation of the method
mi
in the class ct or a supertype thereof. |
MethodInstance |
findMethod(ReferenceType container,
java.lang.String name,
java.util.List<? extends Type> argTypes,
ClassType currClass,
boolean fromClient)
Requires: all type arguments are canonical.
|
MethodInstance |
findMethod(ReferenceType container,
java.lang.String name,
java.util.List<? extends Type> argTypes,
java.util.List<? extends ReferenceType> typeArgs,
ClassType currClass,
Type expectedReturnType,
boolean fromClient) |
Flags |
flagsForBits(int bits)
Given the JVM encoding of a set of flags, returns the Flags object
for that encoding.
|
ReferenceType |
glb(Position pos,
java.util.List<ReferenceType> bounds) |
protected ReferenceType |
glb(Position pos,
java.util.List<ReferenceType> bounds,
boolean performIntersectionCheck) |
ReferenceType |
glb(ReferenceType t1,
ReferenceType t2) |
protected ReferenceType |
glb(ReferenceType t1,
ReferenceType t2,
boolean performIntersectionCheck) |
boolean |
hasEnclosingInstance(ClassType inner,
ClassType encl)
Returns whether an object of the inner class
inner has an
enclosing instance of class encl . |
protected boolean |
hasSameErasure(JL5MethodInstance mi,
JL5MethodInstance mj) |
boolean |
hasSameSignature(JL5MethodInstance mi,
JL5MethodInstance mj)
Do methods mi and mj have the same signature?
See JLS 3rd ed.
|
protected boolean |
hasSameSignature(JL5MethodInstance mi,
JL5MethodInstance mj,
boolean eraseMj) |
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.
|
protected InferenceSolver |
inferenceSolver(JL5ProcedureInstance pi,
java.util.List<? extends Type> argTypes) |
protected JL5Subst |
inferTypeArgs(JL5ProcedureInstance pi,
java.util.List<? extends Type> argTypes,
Type expectedReturnType)
Infer type arguments for mi, when it is called with arguments of type argTypes
|
ClassType |
instantiate(Position pos,
JL5ParsedClassType clazz,
java.util.List<? extends ReferenceType> actuals)
Instantiate class clazz with actuals.
|
ClassType |
instantiate(Position pos,
JL5ParsedClassType clazz,
ReferenceType... actuals)
Instantiate class clazz with actuals.
|
JL5ProcedureInstance |
instantiate(Position pos,
JL5ProcedureInstance mi,
java.util.List<? extends ReferenceType> actuals) |
ClassType |
instantiate(Position pos,
PClass<TypeVariable,ReferenceType> base,
java.util.List<? extends ReferenceType> actuals)
Instantiate a parametric type on a list of actual parameters.
|
ClassType |
instantiateInnerClassFromContext(Context c,
ClassType ct) |
ReferenceType |
intersectionType(Position pos,
java.util.List<ReferenceType> types) |
boolean |
isAccessible(MemberInstance mi,
ReferenceType container,
ReferenceType contextType,
boolean fromClient)
Checks whether a member mi, which is declared in container or
an ancestor of container, can be accessed from code that is declared
in type
context . |
protected boolean |
isAnnotationValueConstant(Term value) |
boolean |
isBaseCastValid(Type fromType,
Type toType) |
boolean |
isCastValid(Type fromType,
Type toType)
Requires: all type arguments are canonical, and toType is not a NullType.
|
protected boolean |
isCastValidFromArray(ArrayType arrayType,
Type toType) |
protected boolean |
isCastValidFromClass(ClassType fromType,
Type toType) |
protected boolean |
isCastValidFromInterface(ClassType fromType,
Type toType) |
boolean |
isContained(Type fromType,
Type toType)
Is fromType contained in toType? See JLS 3rd ed 4.5.1.1
|
boolean |
isEnclosed(ClassType inner,
ClassType outer)
Returns whether inner is enclosed within outer
|
boolean |
isImplicitCastValid(Type fromType,
Type toType)
Requires: all type arguments are canonical.
|
java.util.LinkedList<Type> |
isImplicitCastValidChain(Type fromType,
Type toType) |
boolean |
isMember(MemberInstance mi,
ReferenceType type)
Returns whether member
mi is a member of reference type
type , either by definition or by inheritance. |
boolean |
isPrimitiveWrapper(Type l) |
boolean |
isReifiable(Type t)
Is the type reifiable (i.e., representable at runtime).
|
boolean |
isRetainedAnnotation(Type annotationType)
Given an annotation of type annotationType, should the annotation
be retained in the binary? See JLS 3rd ed, 9.6.1.2
|
boolean |
isSubSignature(JL5MethodInstance m1,
JL5MethodInstance m2)
Return true of the signature of m1 is a subsignature of the signature of
m2, according to JLS 3rd ed.
|
boolean |
isSubtype(Type t1,
Type t2)
Returns true iff child descends from ancestor or child == ancestor.
|
boolean |
isUncheckedConversion(Type fromType,
Type toType)
Is there an unchecked conversion from "from" to "to"?
See JLS 3rd ed.
|
boolean |
isValidAnnotationValueType(Type t) |
ClassType |
Iterable() |
ClassType |
Iterator() |
Type |
leastCommonAncestor(Type type1,
Type type2)
Requires: all type arguments are canonical.
|
Flags |
legalAbstractMethodFlags()
All flags allowed for an abstract method.
|
Flags |
legalConstructorFlags()
All flags allowed for a constructor.
|
Flags |
legalLocalFlags()
All flags allowed for a local variable.
|
Flags |
legalMemberClassFlags()
All flags allowed for a member class.
|
Flags |
legalMethodFlags()
All flags allowed for a method.
|
Flags |
legalTopLevelClassFlags()
All flags allowed for a top-level class.
|
static java.lang.String |
listToString(java.util.List<?> l) |
LocalInstance |
localInstance(Position pos,
Flags flags,
Type type,
java.lang.String name)
Create a local variable instance.
|
LubType |
lub(Position pos,
java.util.List<ReferenceType> us)
Compute the least upper bound of a set of types
bounds . |
JL5MethodInstance |
methodCallValid(JL5MethodInstance mi,
java.lang.String name,
java.util.List<? extends Type> argTypes,
java.util.List<? extends ReferenceType> actualTypeArgs,
Type expectedReturnType)
Check whether
mi can be called with name name
and arguments of type actualTypes , with type parameters
instantiated with actualTypeArgs. |
boolean |
methodCallValid(MethodInstance mi,
java.lang.String name,
java.util.List<? extends Type> 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<? extends Type> argTypes,
java.util.List<? extends Type> excTypes)
Create a method instance.
|
JL5MethodInstance |
methodInstance(Position pos,
ReferenceType container,
Flags flags,
Type returnType,
java.lang.String name,
java.util.List<? extends Type> argTypes,
java.util.List<? extends Type> excTypes,
java.util.List<TypeVariable> typeParams) |
Annotations |
NoAnnotations()
A special Annotations that has no annotations.
|
boolean |
numericConversionBaseValid(Type t,
java.lang.Object value) |
boolean |
numericConversionValid(Type type,
java.lang.Object value)
Returns true if
value can be implicitly cast to
primitive type t . |
ClassType |
OverrideAnnotation() |
PrimitiveType |
primitiveTypeOfWrapper(Type l) |
PrimitiveType |
promote(Type t1,
Type t2)
Binary promotion for numeric types.
|
RawClass |
rawClass(JL5ParsedClassType base)
Create a raw class
|
RawClass |
rawClass(JL5ParsedClassType base,
Position pos)
Create a raw class
|
ClassType |
RetentionAnnotation() |
protected boolean |
returnTypesConsistent(MethodInstance mi,
MethodInstance mj) |
protected Subst<TypeVariable,ReferenceType> |
substImpl(java.util.Map<TypeVariable,? extends ReferenceType> substMap) |
ClassType |
TargetAnnotation() |
Type |
toRawType(Type t)
Create a raw class
|
TypeVariable |
typeVariable(Position pos,
java.lang.String name,
ReferenceType upperBound) |
Type |
unboxingConversion(Type t)
Perform unboxing conversion on t.
|
UnknownReferenceType |
unknownReferenceType(Position position) |
UnknownTypeVariable |
unknownTypeVariable(Position position) |
protected boolean |
varArgsRequired(JL5ProcedureInstance pi) |
WildCardType |
wildCardType(Position position) |
WildCardType |
wildCardType(Position position,
ReferenceType upperBound,
ReferenceType lowerBound) |
ClassType |
wrapperClassOfPrimitive(PrimitiveType t)
Returns the PrimitiveType corresponding to the wrapper type t.
|
checkInstantiation, mutablePClass, subst, subst, uncheckedInstantiate
Abstract, ArithmeticException, arrayOf, arrayOf, arrayOf, arrayOf, ArrayStoreException, arrayType, assert_, assert_, Boolean, Byte, canCoerceToString, canOverride, Char, checkAccessFlags, checkClassConformance, checkClassFlagsConflict, checkConstructorFlags, checkCycles, checkFieldFlags, checkInitializerFlags, checkInterfaceFieldFlags, checkLocalClassFlags, checkLocalFlags, checkMemberClassFlags, checkMethodFlags, checkOverride, checkTopLevelClassFlags, Class, classAccessible, classAccessible, classAccessibleFromPackage, ClassCastException, classContextResolver, classContextResolver, Cloneable, createClassContextResolver, createClassType, createClassType, createClassType, createNewFlag, createPackage, createPackage, createPackageContextResolver, defaultPackageImports, deserializedClassInitializer, Double, equals, Error, Exception, extensionInfo, Final, findConstructor, findConstructor, findField, findField, findField, findField, findFields, findMemberClass, findMemberClass, findMemberClass, findMethod, findMethod, findMostSpecificProcedures, findProcedure, flagsForName, Float, forName, forName, getTransformedClassName, getTypeEncoderRootSet, hasAccessibleMethodNamed, hasFormals, hasMethod, hasMethodNamed, implemented, initEnums, initFlags, initialize, initializerInstance, initTypes, Int, Interface, interfaces, isAccessible, isAccessible, isAccessible, isAccessible, isCanonical, isInherited, isSameMethod, isThrowable, isUncheckedException, legalAccessFlags, legalFieldFlags, legalInitializerFlags, legalInterfaceFieldFlags, legalLocalClassFlags, load, loadedResolver, Long, moreSpecific, Native, NoFlags, Null, NullPointerException, numericConversionValid, Object, OutOfBoundsException, overrides, packageContextResolver, packageContextResolver, packageContextResolver, packageEquals, packageExists, packageForName, packageForName, parsedResolver, placeHolder, placeHolder, primitiveForName, Private, promote, promoteNumeric, promoteNumeric, Protected, Public, restoreSystemResolver, RuntimeException, saveSystemResolver, Serializable, Short, Static, staticTarget, StrictFP, String, superType, Synchronized, systemResolver, Throwable, throwsSubset, toString, Transient, translateArray, translateClass, translatePackage, translatePrimitive, typeEquals, typeForClass, typeForClass, typeForName, uncheckedExceptions, unknownPackage, unknownQualifier, unknownType, Void, Volatile, wrapperTypeString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createClassType, equals
mutablePClass, subst, subst
Abstract, ArithmeticException, arrayOf, arrayOf, arrayOf, arrayOf, ArrayStoreException, Boolean, Byte, canCoerceToString, canOverride, Char, checkAccessFlags, checkClassConformance, checkConstructorFlags, checkCycles, checkFieldFlags, checkInitializerFlags, checkInterfaceFieldFlags, checkLocalClassFlags, checkLocalFlags, checkMemberClassFlags, checkMethodFlags, checkOverride, checkTopLevelClassFlags, Class, classAccessible, classAccessible, classAccessibleFromPackage, ClassCastException, classContextResolver, classContextResolver, Cloneable, createClassContextResolver, createClassType, createClassType, createNewFlag, createPackage, createPackage, createPackageContextResolver, defaultPackageImports, deserializedClassInitializer, Double, Error, Exception, extensionInfo, Final, findConstructor, findConstructor, findField, findField, findField, findField, findMemberClass, findMemberClass, findMemberClass, findMethod, findMethod, Float, forName, getTransformedClassName, getTypeEncoderRootSet, hasAccessibleMethodNamed, hasFormals, hasMethod, hasMethodNamed, implemented, initialize, initializerInstance, Int, Interface, interfaces, isAccessible, isAccessible, isAccessible, isAccessible, isCanonical, isInherited, isSameMethod, isThrowable, isUncheckedException, legalAccessFlags, legalFieldFlags, legalInitializerFlags, legalInterfaceFieldFlags, legalLocalClassFlags, loadedResolver, Long, moreSpecific, Native, NoFlags, Null, NullPointerException, numericConversionValid, Object, OutOfBoundsException, overrides, packageContextResolver, packageContextResolver, packageContextResolver, packageEquals, packageExists, packageForName, packageForName, parsedResolver, placeHolder, placeHolder, primitiveForName, Private, promote, Protected, Public, restoreSystemResolver, RuntimeException, saveSystemResolver, Serializable, Short, Static, staticTarget, StrictFP, String, superType, Synchronized, systemResolver, Throwable, throwsSubset, Transient, translateArray, translateClass, translatePackage, translatePrimitive, typeEquals, typeForName, uncheckedExceptions, unknownPackage, unknownQualifier, unknownType, Void, Volatile, wrapperTypeString
protected ClassType ENUM_
protected ClassType ANNOTATION_
protected ClassType OVERRIDE_ANNOTATION_
protected ClassType TARGET_ANNOTATION_
protected ClassType RETENTION_ANNOTATION_
protected ClassType ELEMENT_TYPE_
protected ClassType ITERABLE_
protected ClassType ITERATOR_
protected UnknownReferenceType unknownReferenceType
public ClassType Enum()
Enum
in interface JL5TypeSystem
public ClassType Annotation()
Annotation
in interface JL5TypeSystem
public ClassType OverrideAnnotation()
OverrideAnnotation
in interface JL5TypeSystem
public ClassType TargetAnnotation()
TargetAnnotation
in interface JL5TypeSystem
public ClassType RetentionAnnotation()
RetentionAnnotation
in interface JL5TypeSystem
public ClassType AnnotationElementType()
AnnotationElementType
in interface JL5TypeSystem
public ClassType Iterable()
Iterable
in interface JL5TypeSystem
public ClassType Iterator()
Iterator
in interface JL5TypeSystem
public LazyClassInitializer defaultClassInitializer()
TypeSystem
defaultClassInitializer
in interface TypeSystem
defaultClassInitializer
in class TypeSystem_c
public boolean accessibleFromPackage(Flags flags, Package pkg1, Package pkg2)
TypeSystem_c
flags
in package pkg1
is accessible from package
pkg2
.accessibleFromPackage
in interface JL5TypeSystem
accessibleFromPackage
in class TypeSystem_c
public ClassType wrapperClassOfPrimitive(PrimitiveType t)
JL5TypeSystem
wrapperClassOfPrimitive
in interface JL5TypeSystem
public PrimitiveType primitiveTypeOfWrapper(Type l)
primitiveTypeOfWrapper
in interface JL5TypeSystem
public boolean isPrimitiveWrapper(Type l)
isPrimitiveWrapper
in interface JL5TypeSystem
public Flags legalTopLevelClassFlags()
TypeSystem
legalTopLevelClassFlags
in interface TypeSystem
legalTopLevelClassFlags
in class TypeSystem_c
public Flags legalMemberClassFlags()
TypeSystem
legalMemberClassFlags
in interface TypeSystem
legalMemberClassFlags
in class TypeSystem_c
protected void checkCycles(ReferenceType curr, ReferenceType goal) throws SemanticException
checkCycles
in class TypeSystem_c
SemanticException
public ConstructorInstance defaultConstructor(Position pos, ClassType container)
TypeSystem
defaultConstructor
in interface TypeSystem
defaultConstructor
in class TypeSystem_c
pos
- Position of the constructor.container
- Containing class of the constructor.public ParsedClassType createClassType(LazyClassInitializer init, Source fromSource)
TypeSystem
createClassType
in interface JL5TypeSystem
createClassType
in interface TypeSystem
createClassType
in class TypeSystem_c
protected PrimitiveType createPrimitive(PrimitiveType.Kind kind)
createPrimitive
in class TypeSystem_c
protected NullType createNull()
createNull
in class TypeSystem_c
public EnumInstance findEnumConstant(ReferenceType container, java.lang.String name, Context c) throws SemanticException
findEnumConstant
in interface JL5TypeSystem
SemanticException
public EnumInstance findEnumConstant(ReferenceType container, java.lang.String name, ClassType currClass) throws SemanticException
findEnumConstant
in interface JL5TypeSystem
SemanticException
public EnumInstance findEnumConstant(ReferenceType container, java.lang.String name) throws SemanticException
findEnumConstant
in interface JL5TypeSystem
SemanticException
public EnumInstance findEnumConstant(ReferenceType container, long ordinal) throws SemanticException
findEnumConstant
in interface JL5TypeSystem
SemanticException
public java.util.Set<EnumInstance> findEnumConstants(ReferenceType container, java.lang.String name)
public EnumInstance enumInstance(Position pos, ClassType ct, Flags f, java.lang.String name, long ordinal)
enumInstance
in interface JL5TypeSystem
public Context createContext()
TypeSystem
createContext
in interface TypeSystem
createContext
in class TypeSystem_c
public FieldInstance findFieldOrEnum(ReferenceType container, java.lang.String name, ClassType currClass) throws SemanticException
findFieldOrEnum
in interface JL5TypeSystem
SemanticException
public MethodInstance methodInstance(Position pos, ReferenceType container, Flags flags, Type returnType, java.lang.String name, java.util.List<? extends Type> argTypes, java.util.List<? extends Type> excTypes)
TypeSystem
methodInstance
in interface TypeSystem
methodInstance
in class TypeSystem_c
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.public JL5MethodInstance methodInstance(Position pos, ReferenceType container, Flags flags, Type returnType, java.lang.String name, java.util.List<? extends Type> argTypes, java.util.List<? extends Type> excTypes, java.util.List<TypeVariable> typeParams)
methodInstance
in interface JL5TypeSystem
public ConstructorInstance constructorInstance(Position pos, ClassType container, Flags flags, java.util.List<? extends Type> argTypes, java.util.List<? extends Type> excTypes)
TypeSystem
constructorInstance
in interface TypeSystem
constructorInstance
in class TypeSystem_c
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.public JL5ConstructorInstance constructorInstance(Position pos, ClassType container, Flags flags, java.util.List<? extends Type> argTypes, java.util.List<? extends Type> excTypes, java.util.List<TypeVariable> typeParams)
constructorInstance
in interface JL5TypeSystem
public LocalInstance localInstance(Position pos, Flags flags, Type type, java.lang.String name)
TypeSystem
localInstance
in interface TypeSystem
localInstance
in class TypeSystem_c
pos
- Position of the local variable.flags
- The local variable's flags.type
- The local variable's type.name
- The local variable's name.public JL5FieldInstance fieldInstance(Position pos, ReferenceType container, Flags flags, Type type, java.lang.String name)
TypeSystem
fieldInstance
in interface TypeSystem
fieldInstance
in class TypeSystem_c
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.public TypeVariable typeVariable(Position pos, java.lang.String name, ReferenceType upperBound)
typeVariable
in interface JL5TypeSystem
public UnknownTypeVariable unknownTypeVariable(Position position)
unknownTypeVariable
in interface JL5TypeSystem
public boolean isBaseCastValid(Type fromType, Type toType)
isBaseCastValid
in interface JL5TypeSystem
public boolean numericConversionBaseValid(Type t, java.lang.Object value)
numericConversionBaseValid
in interface JL5TypeSystem
public Flags flagsForBits(int bits)
TypeSystem
flagsForBits
in interface JL5TypeSystem
flagsForBits
in interface TypeSystem
flagsForBits
in class TypeSystem_c
public ClassFileLazyClassInitializer classFileLazyClassInitializer(ClassFile clazz)
TypeSystem
classFileLazyClassInitializer
in interface TypeSystem
classFileLazyClassInitializer
in class TypeSystem_c
public ImportTable importTable(java.lang.String sourceName, Package pkg)
TypeSystem
importTable
in interface TypeSystem
importTable
in class TypeSystem_c
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.public ImportTable importTable(Package pkg)
TypeSystem
importTable
in interface TypeSystem
importTable
in class TypeSystem_c
pkg
- The package of the source file in which to import.public ArrayType arrayOf(Position position, Type type, boolean isVarargs)
arrayOf
in interface JL5TypeSystem
protected ArrayType createArrayType(Position pos, Type type)
createArrayType
in class TypeSystem_c
protected java.util.List<? extends MethodInstance> findAcceptableMethods(ReferenceType container, java.lang.String name, java.util.List<? extends Type> argTypes, ClassType currClass, boolean fromClient) throws SemanticException
findAcceptableMethods
in class TypeSystem_c
SemanticException
protected java.util.List<? extends MethodInstance> findAcceptableMethods(ReferenceType container, java.lang.String name, java.util.List<? extends Type> argTypes, java.util.List<? extends ReferenceType> actualTypeArgs, ClassType currClass, boolean fromClient) throws SemanticException
SemanticException
protected java.util.List<? extends MethodInstance> findAcceptableMethods(ReferenceType container, java.lang.String name, java.util.List<? extends Type> argTypes, java.util.List<? extends ReferenceType> actualTypeArgs, ClassType currClass, Type expectedReturnType, boolean fromClient) throws SemanticException
SemanticException
public boolean methodCallValid(MethodInstance mi, java.lang.String name, java.util.List<? extends Type> argTypes)
TypeSystem
mi
can be called with name name
and actual parameters of types actualTypes
.methodCallValid
in interface TypeSystem
methodCallValid
in class TypeSystem_c
public JL5MethodInstance methodCallValid(JL5MethodInstance mi, java.lang.String name, java.util.List<? extends Type> argTypes, java.util.List<? extends ReferenceType> actualTypeArgs, Type expectedReturnType)
JL5TypeSystem
mi
can be called with name name
and arguments of type actualTypes
, with type parameters
instantiated with actualTypeArgs. If actualTypeArgs is null or empty,
then type inference should be performed. (See JLS 3rd ed. 15.12.2.7)
Will return null if mi cannot be successfully called. Will return an appropriately
instantiated method instance if the call is valid (i.e., the substitution after type inference).methodCallValid
in interface JL5TypeSystem
public boolean callValid(ProcedureInstance mi, java.util.List<? extends Type> argTypes)
TypeSystem
pi
can be called with
actual parameters of types actualTypes
.callValid
in interface TypeSystem
callValid
in class TypeSystem_c
public JL5ProcedureInstance callValid(JL5ProcedureInstance mi, java.util.List<? extends Type> argTypes, java.util.List<? extends ReferenceType> actualTypeArgs)
JL5TypeSystem
ci
can be called with
arguments of type actualTypes
, with type parameters
instantiated with actualTypeArgs. If actualTypeArgs is null or empty,
then type inference should be performed. (See JLS 3rd ed. 15.12.2.7)
Will return null if ci cannot be successfully called. Will return an appropriately
instantiated instance if the call is valid (i.e., the substitution after type inference).callValid
in interface JL5TypeSystem
protected JL5Subst inferTypeArgs(JL5ProcedureInstance pi, java.util.List<? extends Type> argTypes, Type expectedReturnType)
pi
- argTypes
- protected InferenceSolver inferenceSolver(JL5ProcedureInstance pi, java.util.List<? extends Type> argTypes)
public ClassType instantiate(Position pos, PClass<TypeVariable,ReferenceType> base, java.util.List<? extends ReferenceType> actuals) throws SemanticException
ParamTypeSystem
instantiate
in interface ParamTypeSystem<TypeVariable,ReferenceType>
instantiate
in class ParamTypeSystem_c<TypeVariable,ReferenceType>
pos
- The position of the instantiated typebase
- The parameterized typeactuals
- The list of actualsSemanticException
- when the actuals do not agree with the formalspublic ClassType instantiate(Position pos, JL5ParsedClassType clazz, ReferenceType... actuals) throws SemanticException
JL5TypeSystem
instantiate
in interface JL5TypeSystem
SemanticException
public ClassType instantiate(Position pos, JL5ParsedClassType clazz, java.util.List<? extends ReferenceType> actuals) throws SemanticException
JL5TypeSystem
instantiate
in interface JL5TypeSystem
SemanticException
public JL5ProcedureInstance instantiate(Position pos, JL5ProcedureInstance mi, java.util.List<? extends ReferenceType> actuals)
instantiate
in interface JL5TypeSystem
protected boolean boxingRequired(JL5ProcedureInstance pi, java.util.List<? extends Type> paramTypes)
protected boolean varArgsRequired(JL5ProcedureInstance pi)
public java.util.List<ReferenceType> allAncestorsOf(ReferenceType rt)
allAncestorsOf
in interface JL5TypeSystem
public static java.lang.String listToString(java.util.List<?> l)
protected Subst<TypeVariable,ReferenceType> substImpl(java.util.Map<TypeVariable,? extends ReferenceType> substMap)
substImpl
in class ParamTypeSystem_c<TypeVariable,ReferenceType>
public boolean hasSameSignature(JL5MethodInstance mi, JL5MethodInstance mj)
JL5TypeSystem
hasSameSignature
in interface JL5TypeSystem
protected boolean hasSameSignature(JL5MethodInstance mi, JL5MethodInstance mj, boolean eraseMj)
public boolean isSubSignature(JL5MethodInstance m1, JL5MethodInstance m2)
JL5TypeSystem
isSubSignature
in interface JL5TypeSystem
public boolean areOverrideEquivalent(JL5MethodInstance mi, JL5MethodInstance mj)
JL5TypeSystem
areOverrideEquivalent
in interface JL5TypeSystem
public boolean isUncheckedConversion(Type fromType, Type toType)
JL5TypeSystem
isUncheckedConversion
in interface JL5TypeSystem
public boolean areReturnTypeSubstitutable(Type ri, Type rj)
JL5TypeSystem
areReturnTypeSubstitutable
in interface JL5TypeSystem
public MethodInstance findImplementingMethod(ClassType ct, MethodInstance mi)
TypeSystem
mi
in the class ct
or a supertype thereof. Since we are
looking for implementations, ct
cannot be an interface.
The first potentially satisfying method is returned, that is, the method
that is visible from ct
, with the correct signature, in
the most precise class in the class hierarchy starting from
ct
.findImplementingMethod
in interface TypeSystem
findImplementingMethod
in class TypeSystem_c
ct
or a supertype thereof, null if none exists.public Type erasureType(Type t)
JL5TypeSystem
erasureType
in interface JL5TypeSystem
protected Type erasureType(Type t, java.util.Set<TypeVariable> visitedTypeVariables)
public JL5Subst erasureSubst(JL5ProcedureInstance pi)
JL5TypeSystem
erasureSubst
in interface JL5TypeSystem
public JL5Subst erasureSubst(JL5ParsedClassType base)
JL5TypeSystem
erasureSubst
in interface JL5TypeSystem
public boolean isContained(Type fromType, Type toType)
JL5TypeSystem
isContained
in interface JL5TypeSystem
public boolean descendsFrom(Type child, Type ancestor)
TypeSystem
descendsFrom
in interface TypeSystem
descendsFrom
in class TypeSystem_c
public boolean isSubtype(Type t1, Type t2)
TypeSystem
descendsFrom(child, ancestor) || equals(child, ancestor)
isSubtype
in interface TypeSystem
isSubtype
in class TypeSystem_c
public boolean isImplicitCastValid(Type fromType, Type toType)
TypeSystem
isImplicitCastValid
in interface TypeSystem
isImplicitCastValid
in class TypeSystem_c
public java.util.LinkedList<Type> isImplicitCastValidChain(Type fromType, Type toType)
isImplicitCastValidChain
in interface JL5TypeSystem
public boolean numericConversionValid(Type type, java.lang.Object value)
TypeSystem
value
can be implicitly cast to
primitive type t
.numericConversionValid
in interface TypeSystem
numericConversionValid
in class TypeSystem_c
public boolean isCastValid(Type fromType, Type toType)
TypeSystem
isCastValid
in interface TypeSystem
isCastValid
in class TypeSystem_c
protected boolean isCastValidFromInterface(ClassType fromType, Type toType)
protected java.util.List<ReferenceType> abstractSuperInterfaces(ReferenceType rt)
TypeSystem_c
ct
that may contain abstract methods that must be
implemented by ct
. The list returned also contains
rt
.abstractSuperInterfaces
in class TypeSystem_c
public MethodInstance findMethod(ReferenceType container, java.lang.String name, java.util.List<? extends Type> argTypes, ClassType currClass, boolean fromClient) throws SemanticException
TypeSystem
name
defined in type
container
and visible from class curClass
.
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.findMethod
in interface TypeSystem
findMethod
in class TypeSystem_c
SemanticException
- if the method cannot be found or is
inaccessible.public MethodInstance findMethod(ReferenceType container, java.lang.String name, java.util.List<? extends Type> argTypes, java.util.List<? extends ReferenceType> typeArgs, ClassType currClass, Type expectedReturnType, boolean fromClient) throws SemanticException
findMethod
in interface JL5TypeSystem
SemanticException
public ConstructorInstance findConstructor(ClassType container, java.util.List<? extends Type> argTypes, ClassType currClass, boolean fromClient) throws SemanticException
TypeSystem
findConstructor
in interface TypeSystem
findConstructor
in class TypeSystem_c
fromClient
- indicates whether the constructor is being accessed
from a client or by inheritanceSemanticException
- if the constructor cannot be found or is
inaccessible.public ConstructorInstance findConstructor(ClassType container, java.util.List<? extends Type> argTypes, java.util.List<? extends ReferenceType> typeArgs, ClassType currClass, boolean fromClient) throws SemanticException
findConstructor
in interface JL5TypeSystem
SemanticException
protected java.util.List<? extends ConstructorInstance> findAcceptableConstructors(ClassType container, java.util.List<? extends Type> argTypes, ClassType currClass, boolean fromClient) throws SemanticException
TypeSystem_c
findAcceptableConstructors
in class TypeSystem_c
SemanticException
protected java.util.List<ConstructorInstance> findAcceptableConstructors(ClassType container, java.util.List<? extends Type> argTypes, java.util.List<? extends ReferenceType> actualTypeArgs, ClassType currClass, boolean fromClient) throws SemanticException
SemanticException
public boolean isMember(MemberInstance mi, ReferenceType type)
TypeSystem
mi
is a member of reference type
type
, either by definition or by inheritance.isMember
in interface TypeSystem
isMember
in class TypeSystem_c
public boolean isAccessible(MemberInstance mi, ReferenceType container, ReferenceType contextType, boolean fromClient)
TypeSystem
context
. fromClient indicates whether this member is
being access from a client (true) or by inheritance (false).isAccessible
in interface TypeSystem
isAccessible
in class TypeSystem_c
public boolean isEnclosed(ClassType inner, ClassType outer)
TypeSystem
isEnclosed
in interface TypeSystem
isEnclosed
in class TypeSystem_c
public boolean hasEnclosingInstance(ClassType inner, ClassType encl)
TypeSystem
inner
has an
enclosing instance of class encl
.hasEnclosingInstance
in interface TypeSystem
hasEnclosingInstance
in class TypeSystem_c
public WildCardType wildCardType(Position position)
wildCardType
in interface JL5TypeSystem
public WildCardType wildCardType(Position position, ReferenceType upperBound, ReferenceType lowerBound)
wildCardType
in interface JL5TypeSystem
public CaptureConvertedWildCardType captureConvertedWildCardType(Position pos)
public Type applyCaptureConversion(Type t, Position pos) throws SemanticException
JL5TypeSystem
applyCaptureConversion
in interface JL5TypeSystem
SemanticException
public Flags legalLocalFlags()
TypeSystem
legalLocalFlags
in interface TypeSystem
legalLocalFlags
in class TypeSystem_c
public Flags legalConstructorFlags()
TypeSystem
legalConstructorFlags
in interface TypeSystem
legalConstructorFlags
in class TypeSystem_c
public Flags legalMethodFlags()
TypeSystem
legalMethodFlags
in interface TypeSystem
legalMethodFlags
in class TypeSystem_c
public Flags legalAbstractMethodFlags()
TypeSystem
legalAbstractMethodFlags
in interface TypeSystem
legalAbstractMethodFlags
in class TypeSystem_c
public JL5SubstClassType findGenericSupertype(JL5ParsedClassType base, ReferenceType sub)
JL5TypeSystem
findGenericSupertype
in interface JL5TypeSystem
public ReferenceType intersectionType(Position pos, java.util.List<ReferenceType> types)
intersectionType
in interface JL5TypeSystem
public boolean checkIntersectionBounds(java.util.List<? extends Type> bounds, boolean quiet) throws SemanticException
checkIntersectionBounds
in interface JL5TypeSystem
SemanticException
public ReferenceType glb(ReferenceType t1, ReferenceType t2)
glb
in interface JL5TypeSystem
protected ReferenceType glb(ReferenceType t1, ReferenceType t2, boolean performIntersectionCheck)
public ReferenceType glb(Position pos, java.util.List<ReferenceType> bounds)
glb
in interface JL5TypeSystem
protected ReferenceType glb(Position pos, java.util.List<ReferenceType> bounds, boolean performIntersectionCheck)
public UnknownReferenceType unknownReferenceType(Position position)
unknownReferenceType
in interface JL5TypeSystem
public RawClass rawClass(JL5ParsedClassType base)
JL5TypeSystem
rawClass
in interface JL5TypeSystem
public RawClass rawClass(JL5ParsedClassType base, Position pos)
JL5TypeSystem
rawClass
in interface JL5TypeSystem
public boolean canBeRaw(Type type)
canBeRaw
in interface JL5TypeSystem
public Type toRawType(Type t)
JL5TypeSystem
toRawType
in interface JL5TypeSystem
public java.util.List<TypeVariable> classAndEnclosingTypeVariables(JL5ParsedClassType ct)
classAndEnclosingTypeVariables
in interface JL5TypeSystem
protected void classAndEnclosingTypeVariables(JL5ParsedClassType ct, java.util.List<TypeVariable> l)
public PrimitiveType promote(Type t1, Type t2) throws SemanticException
TypeSystem
promote
in interface TypeSystem
promote
in class TypeSystem_c
SemanticException
- if the types cannot be promoted.public Type boxingConversion(Type t)
JL5TypeSystem
boxingConversion
in interface JL5TypeSystem
public Type unboxingConversion(Type t)
JL5TypeSystem
unboxingConversion
in interface JL5TypeSystem
public LubType lub(Position pos, java.util.List<ReferenceType> us)
JL5TypeSystem
bounds
. This is the
lub(U1 ... Uk) function, as defined in the JLS 3rd edition, Section 15.12.2.7.lub
in interface JL5TypeSystem
public boolean isValidAnnotationValueType(Type t)
isValidAnnotationValueType
in interface JL5TypeSystem
public void checkAnnotationValueConstant(Term value) throws SemanticException
checkAnnotationValueConstant
in interface JL5TypeSystem
SemanticException
protected boolean isAnnotationValueConstant(Term value)
public void checkDuplicateAnnotations(java.util.List<AnnotationElem> annotations) throws SemanticException
checkDuplicateAnnotations
in interface JL5TypeSystem
SemanticException
public AnnotationTypeElemInstance annotationElemInstance(Position pos, ClassType ct, Flags f, Type type, java.lang.String name, boolean hasDefault)
annotationElemInstance
in interface JL5TypeSystem
public AnnotationTypeElemInstance findAnnotation(ReferenceType container, java.lang.String name, ClassType currClass) throws SemanticException
findAnnotation
in interface JL5TypeSystem
SemanticException
public java.util.Set<AnnotationTypeElemInstance> findAnnotations(ReferenceType container, java.lang.String name)
public void checkMethodNameClash(JL5MethodInstance mi, ClassType ct) throws SemanticException
JL5TypeSystem
checkMethodNameClash
in interface JL5TypeSystem
SemanticException
public void checkMethodNameClash(JL5MethodInstance mi, ClassType type, ReferenceType declaringClass) throws SemanticException
SemanticException
protected boolean hasSameErasure(JL5MethodInstance mi, JL5MethodInstance mj)
protected boolean returnTypesConsistent(MethodInstance mi, MethodInstance mj)
returnTypesConsistent
in class TypeSystem_c
public Type Class(Position pos, ReferenceType type)
JL5TypeSystem
type
.Class
in interface JL5TypeSystem
public boolean isReifiable(Type t)
JL5TypeSystem
isReifiable
in interface JL5TypeSystem
public ClassType instantiateInnerClassFromContext(Context c, ClassType ct)
instantiateInnerClassFromContext
in interface JL5TypeSystem
public Annotations createAnnotations(java.util.Map<Type,java.util.Map<java.lang.String,AnnotationElementValue>> annotationElems, Position pos)
createAnnotations
in interface JL5TypeSystem
public boolean isRetainedAnnotation(Type annotationType)
isRetainedAnnotation
in interface JL5TypeSystem
public Annotations NoAnnotations()
JL5TypeSystem
NoAnnotations
in interface JL5TypeSystem
public AnnotationElementValueArray AnnotationElementValueArray(Position pos, java.util.List<AnnotationElementValue> vals)
AnnotationElementValueArray
in interface JL5TypeSystem
public AnnotationElementValueAnnotation AnnotationElementValueAnnotation(Position pos, Type annotationType, java.util.Map<java.lang.String,AnnotationElementValue> annotationElementValues)
AnnotationElementValueAnnotation
in interface JL5TypeSystem
public AnnotationElementValueConstant AnnotationElementValueConstant(Position pos, Type type, java.lang.Object constVal)
AnnotationElementValueConstant
in interface JL5TypeSystem
public Type leastCommonAncestor(Type type1, Type type2) throws SemanticException
TypeSystem
type1
and type2
.leastCommonAncestor
in interface TypeSystem
leastCommonAncestor
in class TypeSystem_c
SemanticException
- if the LCA does not exist