Class TypeUtils


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

      • TypeUtils

        public TypeUtils​(RootNode rootNode)
    • Method Detail

      • getClassGenerics

        public java.util.List<ArgType> getClassGenerics​(ArgType type)
      • getKnownTypeVarsAtMethod

        public java.util.Set<ArgType> getKnownTypeVarsAtMethod​(MethodNode mth)
      • checkForUnknownTypeVars

        @Nullable
        public @Nullable ArgType checkForUnknownTypeVars​(MethodNode mth,
                                                         ArgType checkType)
        Search for unknown type vars at current method. Return only first.
        Returns:
        unknown type var, null if not found
      • containsUnknownTypeVar

        public boolean containsUnknownTypeVar​(MethodNode mth,
                                              ArgType type)
      • replaceClassGenerics

        @Nullable
        public @Nullable ArgType replaceClassGenerics​(ArgType instanceType,
                                                      ArgType typeWithGeneric)
        Replace generic types in typeWithGeneric using instance types
        Example:
        • instanceType: Set<String>
        • typeWithGeneric: Iterator<E>
        • return: Iterator<String>
      • replaceClassGenerics

        @Nullable
        public @Nullable ArgType replaceClassGenerics​(ArgType instanceType,
                                                      ArgType genericSourceType,
                                                      ArgType typeWithGeneric)
      • getTypeVariablesMapping

        public java.util.Map<ArgType,​ArgType> getTypeVariablesMapping​(ArgType clsType)
      • replaceTypeVariablesUsingMap

        @Nullable
        public @Nullable ArgType replaceTypeVariablesUsingMap​(ArgType replaceType,
                                                              java.util.Map<ArgType,​ArgType> replaceMap)
      • visitSuperTypes

        public void visitSuperTypes​(ArgType type,
                                    java.util.function.BiConsumer<ArgType,​ArgType> consumer)