Package gw.internal.gosu.parser
Class TypeLord
java.lang.Object
gw.internal.gosu.parser.TypeLord
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final TypeSystemAwareCache<Pair<IType,IType>, Boolean> private static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static String_getNameOfParams(IType[] paramTypes, boolean bRelative, boolean bWithEnclosingType, boolean bIncludeModule, Set<IType> visited) private static boolean_isRecursiveType(IType declaringClass, Set<IType> visited) private static boolean_isRecursiveType(ITypeVariableType subject, Set<IType> visited, IType... types) static voidaddAllClassesInClassHierarchy(IType type, Set<IType> set) static voidaddAllClassesInClassHierarchy(IType type, Set<IType> set, boolean bForce) private static voidaddAllClassesInClassHierarchy(IJavaClassInfo entityClass, Set<IJavaClassInfo> set) static voidaddAllClassesInClassHierarchy(Class entityClass, Set<Class> set) static voidaddNamespace(Set<String> namespaces, String strType) static voidprivate static StringBuilderappendTypeName(boolean bWithEnclosingType, boolean bIncludeModule, StringBuilder sb, IType paramType, Set<IType> visited) private static booleanareAllTypesBlocks(List<? extends IType> types) static booleanprivate static booleanprivate static booleanareTypeVariablesEquivalent(TypeVariableType possible, TypeVariableType inferred) static ITypeboundTypes(IType type, List<IType> typesToBound) static ITypeboundTypes(IType type, List<IType> typesToBound, boolean bKeepTypeVars) private static BooleancompareWithDeclarationSiteVariance(IType to, IType from, int iIndex) static ITypederiveParameterizedTypeFromContext(IType type, IType contextType) static booleanstatic booleanenclosingTypeInstanceInScope(IType type, IGosuClassInternal inner) private static ITypefindActualDeclaringType(IType ownersType, IType declaringType) static ITypefindGreatestLowerBound(IType t1, IType t2) static ITypefindLeastUpperBound(List<? extends IType> types) private static ITypefindLeastUpperBoundImpl(List<? extends IType> types, Set<IType> resolvingTypes) findLubForBlockTypes(List<? extends IBlockType> types, Set<IType> resolvingTypes) private static intfindNthPositionOfString(int n, StringBuilder sb, String str) findParameterizationLUBS(List<? extends IType> currentTypes, Set<IType> lubSet, Set<IType> resolvingTypes) static ITypefindParameterizedStructureType(IType structureType, IType from) static ITypefindParameterizedType(IType sourceType, IType rawGenericType) Finds a parameterized type in the ancestry of a given type.static ITypefindParameterizedType(IType sourceType, IType rawGenericType, boolean bForAssignability) static ITypefindParameterizedType_Reverse(IType sourceType, IType targetType) static ITypefindParameterizedTypeInHierarchy(IType sourceType, IType rawGenericType) (package private) static StringfixSunInnerClassBug(String type) static ITypegetActualType(IType type, TypeVarToTypeMap actualParamByVarName) static ITypegetActualType(IType type, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars) static ITypegetActualType(IType type, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars, Set<IType> visited) static ITypegetActualType(IAsmType type, TypeVarToTypeMap actualParamByVarName) static ITypegetActualType(IAsmType type, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars, LinkedHashSet<IAsmType> recursiveTypes) static ITypegetActualType(Type type, TypeVarToTypeMap actualParamByVarName) static ITypegetActualType(Type type, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars) static ITypegetActualType(Type type, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars, LinkedHashSet<Type> recursiveTypes) getArrayVersionsOfEachType(Set componentTypes) private static intstatic ITypegetBoxedTypeFromPrimitiveType(IType primitiveType) static ITypegetConcreteType(IType type) static ITypegetCoreType(IType type) static ITypestatic ITypestatic ITypestatic ITypegetDefaultParameterizedTypeWithTypeVars(IType type, TypeVarToTypeMap map, Set<IType> visited) static ITypestatic ITypegetExpandableComponentType(IType type, boolean bCore) static ITypegetFunctionalInterface(IFunctionType funcType) private static intstatic ITypestatic StringgetNameOfParams(IType[] paramTypes, boolean bRelative, boolean bWithEnclosingType) static StringgetNameOfParams(IType[] paramTypes, boolean bRelative, boolean bWithEnclosingType, boolean bIncludeModule) getNamespacesFromTypeNames(Set<? extends CharSequence> typeNames, Set<String> namespaces) static StringgetNameWithBoundQualifiedTypeVariables(IType type, boolean includeModules) static StringgetNameWithQualifiedTypeVariables(IType type, boolean includeModules) static ITypegetOuterMostEnclosingClass(IType innerClass) static IJavaClassInfogetOuterMostEnclosingClass(IJavaClassInfo innerClass) static <E extends IType>
EgetPureGenericType(E type) static ITypegetRootType(IType type) static ITypegetTopLevelType(IType type) static List<ITypeVariableType>getTypeVariables(IType type) static booleangetTypeVariables(IType type, Predicate<ITypeVariableType> cb) static booleanhasTypeVariable(IType type) private static ITypeinferringType(IType type, List<IType> currentlyInferringTypes, boolean bKeepTypeVars) static voidinferTypeVariableTypesFromGenParamTypeAndConcreteType(IType genParamType, IType argType, TypeVarToTypeMap inferenceMap) static voidinferTypeVariableTypesFromGenParamTypeAndConcreteType(IType genParamType, IType argType, TypeVarToTypeMap inferenceMap, HashSet<ITypeVariableType> inferredInCallStack, boolean bReverse) static voidinferTypeVariableTypesFromGenParamTypeAndConcreteType_Reverse(IType genParamType, IType argType, TypeVarToTypeMap inferenceMap) private static booleanisAWideningConversion(IType to, IType from) private static booleanstatic booleanisDelegatableInterface(IType declaringType, IType iface) static booleanisEvalProgram(IType type) static booleanisExpandable(IType type) static booleanisParameterizedType(IType type) static booleanisParameterizedWith(IType type, TypeVariableType typeVar) static booleanisRecursiveType(IType declaringClass) static booleanisRecursiveType(ITypeVariableType subject, IType... types) static booleanisRecursiveType(IJavaType javaType) static booleanisRecursiveTypeFromBase(IType rootType) static booleanstatic ITypeprivate static ITypestatic ITypemakeParameteredType(IType genType, TypeVarToTypeMap inferenceMap) private static TypeVarToTypeMapmapActualTypeByVarName(IType ownersType) private static TypeVarToTypeMapmapGenericTypeByVarName(IType ownersType) static TypeVarToTypeMapmapTypeByVarName(IType ownersType, IType declaringType) private static TypemaybeGetLowerBound(WildcardType type, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars, LinkedHashSet<Type> recursiveTypes) static ITypeparseType(String strParameterizedTypeName, TypeVarToTypeMap actualParamByVarName) static ITypeparseType(String strParameterizedTypeName, TypeVarToTypeMap actualParamByVarName, ITypeUsesMap typeUsesMap) static ITypeLiteralExpressionparseTypeLiteral(String strParameterizedTypeName, TypeVarToTypeMap actualParamByVarName, ITypeUsesMap typeUsesMap) private static voidpruneNonLUBs(Set<IType> typeSet) (package private) static voidremoveDuplicateClassName(StringBuilder sb, int dollarSignPosition) (package private) static booleanstatic ITypestatic ITypestatic ITypereplaceTypeVariableTypeParametersWithBoundingTypes(IType type, IType enclType) private static ITyperesolveParameterizedType(IType parameterizedType, TypeVarToTypeMap actualParamByVarName) private static booleansameAsDefaultProxiedType(IType to, IType from) private static ITypesolveType(IType genParamType, IType argType, TypeVarToTypeMap inferenceMap, boolean bReverse, ITypeVariableType tvType, IType type)
-
Field Details
-
ASSIGNABILITY_CACHE
-
DEFAULT_ASSIGNABILITY_CACHE_SIZE
private static final int DEFAULT_ASSIGNABILITY_CACHE_SIZE- See Also:
-
-
Constructor Details
-
TypeLord
public TypeLord()
-
-
Method Details
-
getAssignabilityCacheSize
private static int getAssignabilityCacheSize() -
getAllClassesInClassHierarchyAsIntrinsicTypes
-
getAllClassesInClassHierarchyAsIntrinsicTypes
-
encloses
-
enclosingTypeInstanceInScope
-
getArrayVersionsOfEachType
-
getActualType
-
getActualType
public static IType getActualType(Type type, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars) -
getActualType
public static IType getActualType(Type type, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars, LinkedHashSet<Type> recursiveTypes) -
maybeGetLowerBound
private static Type maybeGetLowerBound(WildcardType type, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars, LinkedHashSet<Type> recursiveTypes) -
getActualType
-
getActualType
public static IType getActualType(IAsmType type, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars, LinkedHashSet<IAsmType> recursiveTypes) -
isContravariantWildcardOnFunctionalInterface
private static boolean isContravariantWildcardOnFunctionalInterface(AsmWildcardType typeArg, String fqn) -
getActualType
-
getActualType
public static IType getActualType(IType type, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars) -
getActualType
public static IType getActualType(IType type, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars, Set<IType> visited) -
isParameterizedWith
-
parseType
public static IType parseType(String strParameterizedTypeName, TypeVarToTypeMap actualParamByVarName) -
parseType
public static IType parseType(String strParameterizedTypeName, TypeVarToTypeMap actualParamByVarName, ITypeUsesMap typeUsesMap) -
parseTypeLiteral
public static ITypeLiteralExpression parseTypeLiteral(String strParameterizedTypeName, TypeVarToTypeMap actualParamByVarName, ITypeUsesMap typeUsesMap) throws ParseResultsException - Throws:
ParseResultsException
-
resolveParameterizedType
private static IType resolveParameterizedType(IType parameterizedType, TypeVarToTypeMap actualParamByVarName) -
mapTypeByVarName
-
makeParameteredType
-
findActualDeclaringType
-
mapActualTypeByVarName
-
mapGenericTypeByVarName
-
getNameWithQualifiedTypeVariables
-
getNameWithBoundQualifiedTypeVariables
-
getNameOfParams
-
getNameOfParams
-
_getNameOfParams
-
appendTypeName
private static StringBuilder appendTypeName(boolean bWithEnclosingType, boolean bIncludeModule, StringBuilder sb, IType paramType, Set<IType> visited) -
isDelegatableInterface
-
findParameterizedStructureType
-
getFunctionalInterface
-
findParameterizedType
Finds a parameterized type in the ancestry of a given type. For instance, given the type for ArrayList<Person> as the sourceType and List as the rawGenericType, returns List<Person>.- Parameters:
sourceType- The type to search in.rawGenericType- The raw generic type of the parameterized type to search for e.g., List is the raw generic type of List<String>.- Returns:
- A parameterization of rawGenericType corresponding with the type params of sourceType.
-
findParameterizedType
-
findParameterizedType_Reverse
-
findParameterizedTypeInHierarchy
-
addAllClassesInClassHierarchy
-
addAllClassesInClassHierarchy
private static void addAllClassesInClassHierarchy(IJavaClassInfo entityClass, Set<IJavaClassInfo> set) -
addAllClassesInClassHierarchy
-
addAllClassesInClassHierarchy
-
getPureGenericType
-
deriveParameterizedTypeFromContext
-
makeDefaultParameterizedType
-
replaceTypeVariableTypeParametersWithBoundingTypes
-
replaceTypeVariableTypeParametersWithBoundingTypes
-
replaceRawGenericTypesWithDefaultParameterizedTypes
-
getDefaultParameterizedType
-
makeDefaultParameterizedTypeForCompoundType
-
getDefaultParameterizedTypeWithTypeVars
-
getDefaultParameterizedTypeWithTypeVars
-
getDefaultParameterizedTypeWithTypeVars
public static IType getDefaultParameterizedTypeWithTypeVars(IType type, TypeVarToTypeMap map, Set<IType> visited) -
isRecursiveTypeFromBase
-
isRecursiveType
-
_isRecursiveType
-
isSubtype
-
fixSunInnerClassBug
-
findNthPositionOfString
-
removeDuplicateClassName
-
repeatsWithDot
-
areGenericOrParameterizedTypesAssignable
-
areGenericOrParameterizedTypesAssignableInternal
-
compareWithDeclarationSiteVariance
-
sameAsDefaultProxiedType
-
getNamespacesFromTypeNames
-
addNamespace
-
getRootType
-
findGreatestLowerBound
-
findLeastUpperBound
-
findLeastUpperBoundImpl
-
findLubForBlockTypes
-
areAllTypesBlocks
-
getLeastUpperBoundForPrimitiveTypes
-
getIndex
-
isAWideningConversion
-
findParameterizationLUBS
-
pruneNonLUBs
-
isRecursiveType
-
isRecursiveType
-
_isRecursiveType
private static boolean _isRecursiveType(ITypeVariableType subject, Set<IType> visited, IType... types) -
getOuterMostEnclosingClass
-
getOuterMostEnclosingClass
-
isParameterizedType
-
isEvalProgram
-
addReferencedTypeVarsThatAreNotInMap
-
hasTypeVariable
-
getTypeVariables
-
getTypeVariables
-
isExpandable
-
getExpandableComponentType
-
getExpandableComponentType
-
inferTypeVariableTypesFromGenParamTypeAndConcreteType
public static void inferTypeVariableTypesFromGenParamTypeAndConcreteType(IType genParamType, IType argType, TypeVarToTypeMap inferenceMap) -
inferTypeVariableTypesFromGenParamTypeAndConcreteType_Reverse
public static void inferTypeVariableTypesFromGenParamTypeAndConcreteType_Reverse(IType genParamType, IType argType, TypeVarToTypeMap inferenceMap) -
inferTypeVariableTypesFromGenParamTypeAndConcreteType
public static void inferTypeVariableTypesFromGenParamTypeAndConcreteType(IType genParamType, IType argType, TypeVarToTypeMap inferenceMap, HashSet<ITypeVariableType> inferredInCallStack, boolean bReverse) -
solveType
private static IType solveType(IType genParamType, IType argType, TypeVarToTypeMap inferenceMap, boolean bReverse, ITypeVariableType tvType, IType type) -
getConcreteType
-
getCoreType
-
getBoxedTypeFromPrimitiveType
-
boundTypes
-
boundTypes
-
inferringType
-
areTypeVariablesEquivalent
private static boolean areTypeVariablesEquivalent(TypeVariableType possible, TypeVariableType inferred) -
getTopLevelType
-