Class TypeLord


  • public class TypeLord
    extends java.lang.Object
    • Constructor Detail

      • TypeLord

        public TypeLord()
    • Method Detail

      • getAssignabilityCacheSize

        private static int getAssignabilityCacheSize()
      • getAllClassesInClassHierarchyAsIntrinsicTypes

        public static java.util.Set<IType> getAllClassesInClassHierarchyAsIntrinsicTypes​(IJavaClassInfo cls)
      • getAllClassesInClassHierarchyAsIntrinsicTypes

        public static java.util.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 java.util.Set<IType> getArrayVersionsOfEachType​(java.util.Set componentTypes)
      • getActualType

        public static IType getActualType​(java.lang.reflect.Type type,
                                          TypeVarToTypeMap actualParamByVarName)
      • getActualType

        public static IType getActualType​(java.lang.reflect.Type type,
                                          TypeVarToTypeMap actualParamByVarName,
                                          boolean bKeepTypeVars)
      • getActualType

        public static IType getActualType​(java.lang.reflect.Type type,
                                          TypeVarToTypeMap actualParamByVarName,
                                          boolean bKeepTypeVars,
                                          java.util.LinkedHashSet<java.lang.reflect.Type> recursiveTypes)
      • maybeGetLowerBound

        private static java.lang.reflect.Type maybeGetLowerBound​(java.lang.reflect.WildcardType type,
                                                                 TypeVarToTypeMap actualParamByVarName,
                                                                 boolean bKeepTypeVars,
                                                                 java.util.LinkedHashSet<java.lang.reflect.Type> recursiveTypes)
      • getActualType

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

        private static boolean isContravariantWildcardOnFunctionalInterface​(AsmWildcardType typeArg,
                                                                            java.lang.String fqn)
      • getActualType

        public static IType getActualType​(IType type,
                                          TypeVarToTypeMap actualParamByVarName,
                                          boolean bKeepTypeVars)
      • getActualType

        public static IType getActualType​(IType type,
                                          TypeVarToTypeMap actualParamByVarName,
                                          boolean bKeepTypeVars,
                                          java.util.Set<IType> visited)
      • isParameterizedWith

        public static boolean isParameterizedWith​(IType type,
                                                  TypeVariableType typeVar)
      • parseType

        public static IType parseType​(java.lang.String strParameterizedTypeName,
                                      TypeVarToTypeMap actualParamByVarName)
      • resolveParameterizedType

        private static IType resolveParameterizedType​(IType parameterizedType,
                                                      TypeVarToTypeMap actualParamByVarName)
      • findActualDeclaringType

        private static IType findActualDeclaringType​(IType ownersType,
                                                     IType declaringType)
      • mapGenericTypeByVarName

        private static TypeVarToTypeMap mapGenericTypeByVarName​(IType ownersType)
      • getNameWithQualifiedTypeVariables

        public static java.lang.String getNameWithQualifiedTypeVariables​(IType type,
                                                                         boolean includeModules)
      • getNameWithBoundQualifiedTypeVariables

        public static java.lang.String getNameWithBoundQualifiedTypeVariables​(IType type,
                                                                              boolean includeModules)
      • getNameOfParams

        public static java.lang.String getNameOfParams​(IType[] paramTypes,
                                                       boolean bRelative,
                                                       boolean bWithEnclosingType)
      • getNameOfParams

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

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

        private static java.lang.StringBuilder appendTypeName​(boolean bWithEnclosingType,
                                                              boolean bIncludeModule,
                                                              java.lang.StringBuilder sb,
                                                              IType paramType,
                                                              java.util.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​(java.lang.Class entityClass,
                                                         java.util.Set<java.lang.Class> set)
      • addAllClassesInClassHierarchy

        private static void addAllClassesInClassHierarchy​(IJavaClassInfo entityClass,
                                                          java.util.Set<IJavaClassInfo> set)
      • addAllClassesInClassHierarchy

        public static void addAllClassesInClassHierarchy​(IType type,
                                                         java.util.Set<IType> set)
      • addAllClassesInClassHierarchy

        public static void addAllClassesInClassHierarchy​(IType type,
                                                         java.util.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,
                                                                    java.util.Set<IType> visited)
      • isRecursiveTypeFromBase

        public static boolean isRecursiveTypeFromBase​(IType rootType)
      • isRecursiveType

        public static boolean isRecursiveType​(IType declaringClass)
      • _isRecursiveType

        private static boolean _isRecursiveType​(IType declaringClass,
                                                java.util.Set<IType> visited)
      • isSubtype

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

        static java.lang.String fixSunInnerClassBug​(java.lang.String type)
      • findNthPositionOfString

        private static int findNthPositionOfString​(int n,
                                                   java.lang.StringBuilder sb,
                                                   java.lang.String str)
      • removeDuplicateClassName

        static void removeDuplicateClassName​(java.lang.StringBuilder sb,
                                             int dollarSignPosition)
      • repeatsWithDot

        static boolean repeatsWithDot​(java.lang.StringBuilder sb)
      • areGenericOrParameterizedTypesAssignable

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

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

        private static java.lang.Boolean compareWithDeclarationSiteVariance​(IType to,
                                                                            IType from,
                                                                            int iIndex)
      • sameAsDefaultProxiedType

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

        public static java.util.Set<java.lang.String> getNamespacesFromTypeNames​(java.util.Set<? extends java.lang.CharSequence> typeNames,
                                                                                 java.util.Set<java.lang.String> namespaces)
      • addNamespace

        public static void addNamespace​(java.util.Set<java.lang.String> namespaces,
                                        java.lang.String strType)
      • getRootType

        public static IType getRootType​(IType type)
      • findGreatestLowerBound

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

        public static IType findLeastUpperBound​(java.util.List<? extends IType> types)
      • findLeastUpperBoundImpl

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

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

        private static boolean areAllTypesBlocks​(java.util.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 java.util.Set<IType> findParameterizationLUBS​(java.util.List<? extends IType> currentTypes,
                                                                     java.util.Set<IType> lubSet,
                                                                     java.util.Set<IType> resolvingTypes)
      • pruneNonLUBs

        private static void pruneNonLUBs​(java.util.Set<IType> typeSet)
      • isRecursiveType

        public static boolean isRecursiveType​(IJavaType javaType)
      • _isRecursiveType

        private static boolean _isRecursiveType​(ITypeVariableType subject,
                                                java.util.Set<IType> visited,
                                                IType... types)
      • 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 boolean getTypeVariables​(IType type,
                                               java.util.function.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,
                                                                                 java.util.HashSet<ITypeVariableType> inferredInCallStack,
                                                                                 boolean bReverse)
      • 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,
                                       java.util.List<IType> typesToBound)
      • boundTypes

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

        private static IType inferringType​(IType type,
                                           java.util.List<IType> currentlyInferringTypes,
                                           boolean bKeepTypeVars)
      • getTopLevelType

        public static IType getTopLevelType​(IType type)