Class TypeLord

java.lang.Object
gw.internal.gosu.parser.TypeLord

public class TypeLord extends Object
  • Field Details

  • Constructor Details

    • TypeLord

      public TypeLord()
  • Method Details

    • getAssignabilityCacheSize

      private static int getAssignabilityCacheSize()
    • getAllClassesInClassHierarchyAsIntrinsicTypes

      public static Set<IType> getAllClassesInClassHierarchyAsIntrinsicTypes(IJavaClassInfo cls)
    • getAllClassesInClassHierarchyAsIntrinsicTypes

      public static Set<IType> getAllClassesInClassHierarchyAsIntrinsicTypes(IType type)
    • encloses

      public static boolean encloses(IType type, IType inner)
    • enclosingTypeInstanceInScope

      public static boolean enclosingTypeInstanceInScope(IType type, IGosuClassInternal inner)
    • getArrayVersionsOfEachType

      public static Set<IType> getArrayVersionsOfEachType(Set componentTypes)
    • getActualType

      public static IType getActualType(Type type, TypeVarToTypeMap actualParamByVarName)
    • 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

      public static IType getActualType(IAsmType type, TypeVarToTypeMap actualParamByVarName)
    • getActualType

      public static IType getActualType(IAsmType type, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars, LinkedHashSet<IAsmType> recursiveTypes)
    • isContravariantWildcardOnFunctionalInterface

      private static boolean isContravariantWildcardOnFunctionalInterface(AsmWildcardType typeArg, String fqn)
    • getActualType

      public static IType getActualType(IType type, TypeVarToTypeMap actualParamByVarName)
    • 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

      public static boolean isParameterizedWith(IType type, TypeVariableType typeVar)
    • 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

      public static TypeVarToTypeMap mapTypeByVarName(IType ownersType, IType declaringType)
    • makeParameteredType

      public static IType makeParameteredType(IType genType, TypeVarToTypeMap inferenceMap)
    • findActualDeclaringType

      private static IType findActualDeclaringType(IType ownersType, IType declaringType)
    • mapActualTypeByVarName

      private static TypeVarToTypeMap mapActualTypeByVarName(IType ownersType)
    • mapGenericTypeByVarName

      private static TypeVarToTypeMap mapGenericTypeByVarName(IType ownersType)
    • getNameWithQualifiedTypeVariables

      public static String getNameWithQualifiedTypeVariables(IType type, boolean includeModules)
    • getNameWithBoundQualifiedTypeVariables

      public static String getNameWithBoundQualifiedTypeVariables(IType type, boolean includeModules)
    • getNameOfParams

      public static String getNameOfParams(IType[] paramTypes, boolean bRelative, boolean bWithEnclosingType)
    • getNameOfParams

      public static String getNameOfParams(IType[] paramTypes, boolean bRelative, boolean bWithEnclosingType, boolean bIncludeModule)
    • _getNameOfParams

      private static String _getNameOfParams(IType[] paramTypes, boolean bRelative, boolean bWithEnclosingType, boolean bIncludeModule, Set<IType> visited)
    • appendTypeName

      private static StringBuilder appendTypeName(boolean bWithEnclosingType, boolean bIncludeModule, StringBuilder sb, IType paramType, Set<IType> visited)
    • isDelegatableInterface

      public static boolean isDelegatableInterface(IType declaringType, IType iface)
    • findParameterizedStructureType

      public static IType findParameterizedStructureType(IType structureType, IType from)
    • getFunctionalInterface

      public static IType getFunctionalInterface(IFunctionType funcType)
    • findParameterizedType

      public static IType findParameterizedType(IType sourceType, IType rawGenericType)
      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

      public static IType findParameterizedType(IType sourceType, IType rawGenericType, boolean bForAssignability)
    • findParameterizedType_Reverse

      public static IType findParameterizedType_Reverse(IType sourceType, IType targetType)
    • findParameterizedTypeInHierarchy

      public static IType findParameterizedTypeInHierarchy(IType sourceType, IType rawGenericType)
    • addAllClassesInClassHierarchy

      public static void addAllClassesInClassHierarchy(Class entityClass, Set<Class> set)
    • addAllClassesInClassHierarchy

      private static void addAllClassesInClassHierarchy(IJavaClassInfo entityClass, Set<IJavaClassInfo> set)
    • addAllClassesInClassHierarchy

      public static void addAllClassesInClassHierarchy(IType type, Set<IType> set)
    • addAllClassesInClassHierarchy

      public static void addAllClassesInClassHierarchy(IType type, Set<IType> set, boolean bForce)
    • getPureGenericType

      public static <E extends IType> E getPureGenericType(E type)
    • deriveParameterizedTypeFromContext

      public static IType deriveParameterizedTypeFromContext(IType type, IType contextType)
    • makeDefaultParameterizedType

      public static IType makeDefaultParameterizedType(IType type)
    • replaceTypeVariableTypeParametersWithBoundingTypes

      public static IType replaceTypeVariableTypeParametersWithBoundingTypes(IType type)
    • replaceTypeVariableTypeParametersWithBoundingTypes

      public static IType replaceTypeVariableTypeParametersWithBoundingTypes(IType type, IType enclType)
    • replaceRawGenericTypesWithDefaultParameterizedTypes

      public static IType replaceRawGenericTypesWithDefaultParameterizedTypes(IType type)
    • getDefaultParameterizedType

      public static IType getDefaultParameterizedType(IType type)
    • makeDefaultParameterizedTypeForCompoundType

      private static IType makeDefaultParameterizedTypeForCompoundType(IType type)
    • getDefaultParameterizedTypeWithTypeVars

      public static IType getDefaultParameterizedTypeWithTypeVars(IType type)
    • getDefaultParameterizedTypeWithTypeVars

      public static IType getDefaultParameterizedTypeWithTypeVars(IType type, TypeVarToTypeMap map)
    • getDefaultParameterizedTypeWithTypeVars

      public static IType getDefaultParameterizedTypeWithTypeVars(IType type, TypeVarToTypeMap map, Set<IType> visited)
    • isRecursiveTypeFromBase

      public static boolean isRecursiveTypeFromBase(IType rootType)
    • isRecursiveType

      public static boolean isRecursiveType(IType declaringClass)
    • _isRecursiveType

      private static boolean _isRecursiveType(IType declaringClass, Set<IType> visited)
    • isSubtype

      public static boolean isSubtype(IType subtype, IType supertype)
    • fixSunInnerClassBug

      static String fixSunInnerClassBug(String type)
    • findNthPositionOfString

      private static int findNthPositionOfString(int n, StringBuilder sb, String str)
    • removeDuplicateClassName

      static void removeDuplicateClassName(StringBuilder sb, int dollarSignPosition)
    • repeatsWithDot

      static boolean repeatsWithDot(StringBuilder sb)
    • areGenericOrParameterizedTypesAssignable

      public static boolean areGenericOrParameterizedTypesAssignable(IType to, IType from)
    • areGenericOrParameterizedTypesAssignableInternal

      private static boolean areGenericOrParameterizedTypesAssignableInternal(IType to, IType from)
    • compareWithDeclarationSiteVariance

      private static Boolean compareWithDeclarationSiteVariance(IType to, IType from, int iIndex)
    • sameAsDefaultProxiedType

      private static boolean sameAsDefaultProxiedType(IType to, IType from)
    • getNamespacesFromTypeNames

      public static Set<String> getNamespacesFromTypeNames(Set<? extends CharSequence> typeNames, Set<String> namespaces)
    • addNamespace

      public static void addNamespace(Set<String> namespaces, String strType)
    • getRootType

      public static IType getRootType(IType type)
    • findGreatestLowerBound

      public static IType findGreatestLowerBound(IType t1, IType t2)
    • findLeastUpperBound

      public static IType findLeastUpperBound(List<? extends IType> types)
    • findLeastUpperBoundImpl

      private static IType findLeastUpperBoundImpl(List<? extends IType> types, Set<IType> resolvingTypes)
    • findLubForBlockTypes

      private static Set<IType> findLubForBlockTypes(List<? extends IBlockType> types, Set<IType> resolvingTypes)
    • areAllTypesBlocks

      private static boolean areAllTypesBlocks(List<? extends IType> types)
    • getLeastUpperBoundForPrimitiveTypes

      public static IType getLeastUpperBoundForPrimitiveTypes(IType t0, IType t1)
    • getIndex

      private static int getIndex(IType type)
    • isAWideningConversion

      private static boolean isAWideningConversion(IType to, IType from)
    • findParameterizationLUBS

      private static Set<IType> findParameterizationLUBS(List<? extends IType> currentTypes, Set<IType> lubSet, Set<IType> resolvingTypes)
    • pruneNonLUBs

      private static void pruneNonLUBs(Set<IType> typeSet)
    • isRecursiveType

      public static boolean isRecursiveType(IJavaType javaType)
    • isRecursiveType

      public static boolean isRecursiveType(ITypeVariableType subject, IType... types)
    • _isRecursiveType

      private static boolean _isRecursiveType(ITypeVariableType subject, Set<IType> visited, IType... types)
    • getOuterMostEnclosingClass

      public static IJavaClassInfo getOuterMostEnclosingClass(IJavaClassInfo innerClass)
    • getOuterMostEnclosingClass

      public static IType getOuterMostEnclosingClass(IType innerClass)
    • isParameterizedType

      public static boolean isParameterizedType(IType type)
    • isEvalProgram

      public static boolean isEvalProgram(IType type)
    • addReferencedTypeVarsThatAreNotInMap

      public static void addReferencedTypeVarsThatAreNotInMap(IType type, TypeVarToTypeMap map)
    • hasTypeVariable

      public static boolean hasTypeVariable(IType type)
    • getTypeVariables

      public static List<ITypeVariableType> getTypeVariables(IType type)
    • getTypeVariables

      public static boolean getTypeVariables(IType type, Predicate<ITypeVariableType> cb)
    • isExpandable

      public static boolean isExpandable(IType type)
    • getExpandableComponentType

      public static IType getExpandableComponentType(IType type)
    • getExpandableComponentType

      public static IType getExpandableComponentType(IType type, boolean bCore)
    • 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

      public static IType getConcreteType(IType type)
    • getCoreType

      public static IType getCoreType(IType type)
    • getBoxedTypeFromPrimitiveType

      public static IType getBoxedTypeFromPrimitiveType(IType primitiveType)
    • boundTypes

      public static IType boundTypes(IType type, List<IType> typesToBound)
    • boundTypes

      public static IType boundTypes(IType type, List<IType> typesToBound, boolean bKeepTypeVars)
    • inferringType

      private static IType inferringType(IType type, List<IType> currentlyInferringTypes, boolean bKeepTypeVars)
    • areTypeVariablesEquivalent

      private static boolean areTypeVariablesEquivalent(TypeVariableType possible, TypeVariableType inferred)
    • getTopLevelType

      public static IType getTopLevelType(IType type)