Package jadx.core.dex.nodes.utils
Class TypeUtils
- java.lang.Object
-
- jadx.core.dex.nodes.utils.TypeUtils
-
public class TypeUtils extends java.lang.Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable ArgTypecheckForUnknownTypeVars(MethodNode mth, ArgType checkType)Search for unknown type vars at current method.booleancontainsUnknownTypeVar(MethodNode mth, ArgType type)ArgTypeexpandTypeVariables(ClassNode cls, ArgType type)ArgTypeexpandTypeVariables(MethodNode mth, ArgType type)java.util.List<ArgType>getClassGenerics(ArgType type)@Nullable ClassTypeVarsAttrgetClassTypeVars(ArgType type)java.util.Set<ArgType>getKnownTypeVarsAtMethod(MethodNode mth)java.util.Map<ArgType,ArgType>getTypeVariablesMapping(ArgType clsType)java.util.Map<ArgType,ArgType>getTypeVarMappingForInvoke(BaseInvokeNode invokeInsn)@Nullable ArgTypereplaceClassGenerics(ArgType instanceType, ArgType typeWithGeneric)Replace generic types intypeWithGenericusing instance types
Example:instanceType: Set<String>typeWithGeneric: Iterator<E>return: Iterator<String>@Nullable ArgTypereplaceClassGenerics(ArgType instanceType, ArgType genericSourceType, ArgType typeWithGeneric)@Nullable ArgTypereplaceMethodGenerics(BaseInvokeNode invokeInsn, IMethodDetails details, ArgType typeWithGeneric)@Nullable ArgTypereplaceTypeVariablesUsingMap(ArgType replaceType, java.util.Map<ArgType,ArgType> replaceMap)voidvisitSuperTypes(ArgType type, java.util.function.BiConsumer<ArgType,ArgType> consumer)
-
-
-
Constructor Detail
-
TypeUtils
public TypeUtils(RootNode rootNode)
-
-
Method Detail
-
getClassTypeVars
@Nullable public @Nullable ClassTypeVarsAttr getClassTypeVars(ArgType type)
-
expandTypeVariables
public ArgType expandTypeVariables(MethodNode mth, 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 intypeWithGenericusing 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)
-
getTypeVarMappingForInvoke
public java.util.Map<ArgType,ArgType> getTypeVarMappingForInvoke(BaseInvokeNode invokeInsn)
-
replaceMethodGenerics
@Nullable public @Nullable ArgType replaceMethodGenerics(BaseInvokeNode invokeInsn, IMethodDetails details, ArgType typeWithGeneric)
-
replaceTypeVariablesUsingMap
@Nullable public @Nullable ArgType replaceTypeVariablesUsingMap(ArgType replaceType, java.util.Map<ArgType,ArgType> replaceMap)
-
-