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 void
addAllClassesInClassHierarchy
(IType type, Set<IType> set) static void
addAllClassesInClassHierarchy
(IType type, Set<IType> set, boolean bForce) private static void
addAllClassesInClassHierarchy
(IJavaClassInfo entityClass, Set<IJavaClassInfo> set) static void
addAllClassesInClassHierarchy
(Class entityClass, Set<Class> set) static void
addNamespace
(Set<String> namespaces, String strType) static void
private static StringBuilder
appendTypeName
(boolean bWithEnclosingType, boolean bIncludeModule, StringBuilder sb, IType paramType, Set<IType> visited) private static boolean
areAllTypesBlocks
(List<? extends IType> types) static boolean
private static boolean
private static boolean
areTypeVariablesEquivalent
(TypeVariableType possible, TypeVariableType inferred) static IType
boundTypes
(IType type, List<IType> typesToBound) static IType
boundTypes
(IType type, List<IType> typesToBound, boolean bKeepTypeVars) private static Boolean
compareWithDeclarationSiteVariance
(IType to, IType from, int iIndex) static IType
deriveParameterizedTypeFromContext
(IType type, IType contextType) static boolean
static boolean
enclosingTypeInstanceInScope
(IType type, IGosuClassInternal inner) private static IType
findActualDeclaringType
(IType ownersType, IType declaringType) static IType
findGreatestLowerBound
(IType t1, IType t2) static IType
findLeastUpperBound
(List<? extends IType> types) private static IType
findLeastUpperBoundImpl
(List<? extends IType> types, Set<IType> resolvingTypes) findLubForBlockTypes
(List<? extends IBlockType> types, Set<IType> resolvingTypes) private static int
findNthPositionOfString
(int n, StringBuilder sb, String str) findParameterizationLUBS
(List<? extends IType> currentTypes, Set<IType> lubSet, Set<IType> resolvingTypes) static IType
findParameterizedStructureType
(IType structureType, IType from) static IType
findParameterizedType
(IType sourceType, IType rawGenericType) Finds a parameterized type in the ancestry of a given type.static IType
findParameterizedType
(IType sourceType, IType rawGenericType, boolean bForAssignability) static IType
findParameterizedType_Reverse
(IType sourceType, IType targetType) static IType
findParameterizedTypeInHierarchy
(IType sourceType, IType rawGenericType) (package private) static String
fixSunInnerClassBug
(String type) static IType
getActualType
(IType type, TypeVarToTypeMap actualParamByVarName) static IType
getActualType
(IType type, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars) static IType
getActualType
(IType type, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars, Set<IType> visited) static IType
getActualType
(IAsmType type, TypeVarToTypeMap actualParamByVarName) static IType
getActualType
(IAsmType type, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars, LinkedHashSet<IAsmType> recursiveTypes) static IType
getActualType
(Type type, TypeVarToTypeMap actualParamByVarName) static IType
getActualType
(Type type, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars) static IType
getActualType
(Type type, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars, LinkedHashSet<Type> recursiveTypes) getArrayVersionsOfEachType
(Set componentTypes) private static int
static IType
getBoxedTypeFromPrimitiveType
(IType primitiveType) static IType
getConcreteType
(IType type) static IType
getCoreType
(IType type) static IType
static IType
static IType
static IType
getDefaultParameterizedTypeWithTypeVars
(IType type, TypeVarToTypeMap map, Set<IType> visited) static IType
static IType
getExpandableComponentType
(IType type, boolean bCore) static IType
getFunctionalInterface
(IFunctionType funcType) private static int
static IType
static String
getNameOfParams
(IType[] paramTypes, boolean bRelative, boolean bWithEnclosingType) static String
getNameOfParams
(IType[] paramTypes, boolean bRelative, boolean bWithEnclosingType, boolean bIncludeModule) getNamespacesFromTypeNames
(Set<? extends CharSequence> typeNames, Set<String> namespaces) static String
getNameWithBoundQualifiedTypeVariables
(IType type, boolean includeModules) static String
getNameWithQualifiedTypeVariables
(IType type, boolean includeModules) static IType
getOuterMostEnclosingClass
(IType innerClass) static IJavaClassInfo
getOuterMostEnclosingClass
(IJavaClassInfo innerClass) static <E extends IType>
EgetPureGenericType
(E type) static IType
getRootType
(IType type) static IType
getTopLevelType
(IType type) static List<ITypeVariableType>
getTypeVariables
(IType type) static boolean
getTypeVariables
(IType type, Predicate<ITypeVariableType> cb) static boolean
hasTypeVariable
(IType type) private static IType
inferringType
(IType type, List<IType> currentlyInferringTypes, boolean bKeepTypeVars) static void
inferTypeVariableTypesFromGenParamTypeAndConcreteType
(IType genParamType, IType argType, TypeVarToTypeMap inferenceMap) static void
inferTypeVariableTypesFromGenParamTypeAndConcreteType
(IType genParamType, IType argType, TypeVarToTypeMap inferenceMap, HashSet<ITypeVariableType> inferredInCallStack, boolean bReverse) static void
inferTypeVariableTypesFromGenParamTypeAndConcreteType_Reverse
(IType genParamType, IType argType, TypeVarToTypeMap inferenceMap) private static boolean
isAWideningConversion
(IType to, IType from) private static boolean
static boolean
isDelegatableInterface
(IType declaringType, IType iface) static boolean
isEvalProgram
(IType type) static boolean
isExpandable
(IType type) static boolean
isParameterizedType
(IType type) static boolean
isParameterizedWith
(IType type, TypeVariableType typeVar) static boolean
isRecursiveType
(IType declaringClass) static boolean
isRecursiveType
(ITypeVariableType subject, IType... types) static boolean
isRecursiveType
(IJavaType javaType) static boolean
isRecursiveTypeFromBase
(IType rootType) static boolean
static IType
private static IType
static IType
makeParameteredType
(IType genType, TypeVarToTypeMap inferenceMap) private static TypeVarToTypeMap
mapActualTypeByVarName
(IType ownersType) private static TypeVarToTypeMap
mapGenericTypeByVarName
(IType ownersType) static TypeVarToTypeMap
mapTypeByVarName
(IType ownersType, IType declaringType) private static Type
maybeGetLowerBound
(WildcardType type, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars, LinkedHashSet<Type> recursiveTypes) static IType
parseType
(String strParameterizedTypeName, TypeVarToTypeMap actualParamByVarName) static IType
parseType
(String strParameterizedTypeName, TypeVarToTypeMap actualParamByVarName, ITypeUsesMap typeUsesMap) static ITypeLiteralExpression
parseTypeLiteral
(String strParameterizedTypeName, TypeVarToTypeMap actualParamByVarName, ITypeUsesMap typeUsesMap) private static void
pruneNonLUBs
(Set<IType> typeSet) (package private) static void
removeDuplicateClassName
(StringBuilder sb, int dollarSignPosition) (package private) static boolean
static IType
static IType
static IType
replaceTypeVariableTypeParametersWithBoundingTypes
(IType type, IType enclType) private static IType
resolveParameterizedType
(IType parameterizedType, TypeVarToTypeMap actualParamByVarName) private static boolean
sameAsDefaultProxiedType
(IType to, IType from) private static IType
solveType
(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
-