Class MethodNode

All Implemented Interfaces:
IRenameNode, ICodeAnnotation, ICodeNodeRef, IJadxAttribute, IAttributeNode, ILineAttributeNode, ICodeNode, IDexNode, ILoadable, IMethodDetails, IUsageInfoNode, Comparable<MethodNode>

public class MethodNode extends NotificationAttrNode implements IMethodDetails, ILoadable, ICodeNode, Comparable<MethodNode>
  • Field Details

    • LOG

      private static final org.slf4j.Logger LOG
    • EMPTY_INSN_ARRAY

      private static final InsnNode[] EMPTY_INSN_ARRAY
    • mthInfo

      private final MethodInfo mthInfo
    • parentClass

      private final ClassNode parentClass
    • accFlags

      private AccessInfo accFlags
    • codeReader

      private final ICodeReader codeReader
    • insnsCount

      private final int insnsCount
    • noCode

      private boolean noCode
    • regsCount

      private int regsCount
    • argsStartReg

      private int argsStartReg
    • loaded

      private boolean loaded
    • retType

      private ArgType retType
    • argTypes

      private List<ArgType> argTypes
    • typeParameters

      private List<ArgType> typeParameters
    • thisArg

      private RegisterArg thisArg
    • argsList

      private List<RegisterArg> argsList
    • instructions

      @Nullable private @Nullable InsnNode[] instructions
    • blocks

      private List<BlockNode> blocks
    • blocksMaxCId

      private int blocksMaxCId
    • enterBlock

      private BlockNode enterBlock
    • exitBlock

      private BlockNode exitBlock
    • sVars

      private List<SSAVar> sVars
    • exceptionHandlers

      private List<ExceptionHandler> exceptionHandlers
    • loops

      private List<LoopInfo> loops
    • region

      private Region region
    • useIn

      private List<MethodNode> useIn
    • unresolvedUsed

      private List<MethodInfo> unresolvedUsed
    • methodsUsed

      private Set<MethodNode> methodsUsed
    • callsSelf

      private boolean callsSelf
    • javaNode

      private JavaMethod javaNode
  • Constructor Details

  • Method Details

    • build

      public static MethodNode build(ClassNode classNode, IMethodData methodData)
    • unload

      public void unload()
      Description copied from interface: ILoadable
      Free resources
      Specified by:
      unload in interface ILoadable
    • updateTypes

      public void updateTypes(List<ArgType> argTypes, ArgType retType)
    • updateTypeParameters

      public void updateTypeParameters(List<ArgType> typeParameters)
    • load

      public void load() throws DecodeException
      Description copied from interface: ILoadable
      On demand loading
      Specified by:
      load in interface ILoadable
      Throws:
      DecodeException
    • reload

      public void reload()
    • initArguments

      private void initArguments(List<ArgType> args)
    • getArgsStartPos

      private int getArgsStartPos(List<ArgType> args)
    • getArgTypes

      @NotNull public @NotNull List<ArgType> getArgTypes()
      Specified by:
      getArgTypes in interface IMethodDetails
    • updateArgTypes

      public void updateArgTypes(List<ArgType> newArgTypes, String comment)
    • containsGenericArgs

      public boolean containsGenericArgs()
    • getReturnType

      @NotNull public @NotNull ArgType getReturnType()
      Specified by:
      getReturnType in interface IMethodDetails
    • updateReturnType

      public void updateReturnType(ArgType type)
    • isVoidReturn

      public boolean isVoidReturn()
    • collectArgNodes

      public List<VarNode> collectArgNodes()
    • getArgRegs

      public List<RegisterArg> getArgRegs()
    • getAllArgRegs

      public List<RegisterArg> getAllArgRegs()
    • getThisArg

      @Nullable public @Nullable RegisterArg getThisArg()
    • skipFirstArgument

      public void skipFirstArgument()
    • getTypeParameters

      public List<ArgType> getTypeParameters()
      Specified by:
      getTypeParameters in interface IMethodDetails
    • getName

      public String getName()
    • getAlias

      public String getAlias()
    • getDeclaringClass

      public ClassNode getDeclaringClass()
      Specified by:
      getDeclaringClass in interface ICodeNode
    • getParentClass

      public ClassNode getParentClass()
    • getTopParentClass

      public ClassNode getTopParentClass()
    • isNoCode

      public boolean isNoCode()
    • getInstructions

      public InsnNode[] getInstructions()
    • unloadInsnArr

      public void unloadInsnArr()
    • initBasicBlocks

      public void initBasicBlocks()
    • finishBasicBlocks

      public void finishBasicBlocks()
    • getBasicBlocks

      public List<BlockNode> getBasicBlocks()
    • setBasicBlocks

      public void setBasicBlocks(List<BlockNode> blocks)
    • updateBlockPositions

      public void updateBlockPositions()
    • getNextBlockCId

      public int getNextBlockCId()
    • getEnterBlock

      public BlockNode getEnterBlock()
    • setEnterBlock

      public void setEnterBlock(BlockNode enterBlock)
    • getExitBlock

      public BlockNode getExitBlock()
    • setExitBlock

      public void setExitBlock(BlockNode exitBlock)
    • getPreExitBlocks

      public List<BlockNode> getPreExitBlocks()
    • isPreExitBlock

      public boolean isPreExitBlock(BlockNode block)
    • resetLoops

      public void resetLoops()
    • registerLoop

      public void registerLoop(LoopInfo loop)
    • getLoopForBlock

      @Nullable public @Nullable LoopInfo getLoopForBlock(BlockNode block)
    • getAllLoopsForBlock

      public List<LoopInfo> getAllLoopsForBlock(BlockNode block)
    • getLoopsCount

      public int getLoopsCount()
    • getLoops

      public Iterable<LoopInfo> getLoops()
    • addExceptionHandler

      public ExceptionHandler addExceptionHandler(ExceptionHandler handler)
    • clearExceptionHandlers

      public boolean clearExceptionHandlers()
    • getExceptionHandlers

      public Iterable<ExceptionHandler> getExceptionHandlers()
    • isNoExceptionHandlers

      public boolean isNoExceptionHandlers()
    • getExceptionHandlersCount

      public int getExceptionHandlersCount()
    • getThrows

      public List<ArgType> getThrows()
      Specified by:
      getThrows in interface IMethodDetails
    • isArgsOverloaded

      public boolean isArgsOverloaded()
      Return true if exists method with same name and arguments count
    • isConstructor

      public boolean isConstructor()
    • isDefaultConstructor

      public boolean isDefaultConstructor()
    • getRegsCount

      public int getRegsCount()
    • getArgsStartReg

      public int getArgsStartReg()
    • makeSyntheticRegArg

      public RegisterArg makeSyntheticRegArg(ArgType type)
      Create new fake register arg.
    • makeSyntheticRegArg

      public RegisterArg makeSyntheticRegArg(ArgType type, String name)
    • makeNewSVar

      public SSAVar makeNewSVar(@NotNull @NotNull RegisterArg assignArg)
    • makeNewSVar

      public SSAVar makeNewSVar(int regNum, int version, @NotNull @NotNull RegisterArg assignArg)
    • getNextSVarVersion

      private int getNextSVarVersion(int regNum)
    • removeSVar

      public void removeSVar(SSAVar var)
    • getSVars

      public List<SSAVar> getSVars()
    • getRawAccessFlags

      public int getRawAccessFlags()
      Specified by:
      getRawAccessFlags in interface IMethodDetails
    • getAccessFlags

      public AccessInfo getAccessFlags()
      Specified by:
      getAccessFlags in interface ICodeNode
    • setAccessFlags

      public void setAccessFlags(AccessInfo newAccessFlags)
      Specified by:
      setAccessFlags in interface ICodeNode
    • getRegion

      public Region getRegion()
    • setRegion

      public void setRegion(Region region)
    • root

      public RootNode root()
      Specified by:
      root in interface IDexNode
    • typeName

      public String typeName()
      Specified by:
      typeName in interface IDexNode
    • getInputFileName

      public String getInputFileName()
      Specified by:
      getInputFileName in interface IDexNode
    • getMethodInfo

      public MethodInfo getMethodInfo()
      Specified by:
      getMethodInfo in interface IMethodDetails
    • getMethodCodeOffset

      public long getMethodCodeOffset()
    • getDebugInfo

      @Nullable public @Nullable IDebugInfo getDebugInfo()
    • ignoreMethod

      public void ignoreMethod()
    • rename

      public void rename(String newName)
      Specified by:
      rename in interface IRenameNode
    • countInsns

      public long countInsns()
      Calculate instructions count at current stage
    • getInsnsCount

      public int getInsnsCount()
      Raw instructions count in method bytecode
    • getCodeStr

      public String getCodeStr()
      Returns method code with comments and annotations
    • isVarArg

      public boolean isVarArg()
      Specified by:
      isVarArg in interface IMethodDetails
    • isLoaded

      public boolean isLoaded()
    • getCodeReader

      @Nullable public @Nullable ICodeReader getCodeReader()
    • getUseIn

      public List<MethodNode> getUseIn()
      Specified by:
      getUseIn in interface IUsageInfoNode
    • setUseIn

      public void setUseIn(List<MethodNode> useIn)
    • addUsed

      public void addUsed(MethodNode used)
    • setUsed

      public void setUsed(List<MethodNode> methodsUsed)
    • getUsed

      public Set<MethodNode> getUsed()
    • getUnresolvedUsed

      public List<MethodInfo> getUnresolvedUsed()
    • setUnresolvedUsed

      public void setUnresolvedUsed(List<MethodInfo> unresolvedUsed)
    • setCallsSelf

      public void setCallsSelf(boolean callsSelf)
    • callsSelf

      public boolean callsSelf()
    • removeInvalidMethodsUsed

      private void removeInvalidMethodsUsed()
    • getJavaNode

      public JavaMethod getJavaNode()
    • setJavaNode

      @Internal public void setJavaNode(JavaMethod javaNode)
    • getAnnType

      public ICodeAnnotation.AnnType getAnnType()
      Specified by:
      getAnnType in interface ICodeAnnotation
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(@NotNull @NotNull MethodNode o)
      Specified by:
      compareTo in interface Comparable<MethodNode>
    • toAttrString

      public String toAttrString()
      Specified by:
      toAttrString in interface IJadxAttribute
      Specified by:
      toAttrString in interface IMethodDetails
    • toString

      public String toString()
      Overrides:
      toString in class Object