Class ConcreteMethod

java.lang.Object
com.android.dx.cf.code.ConcreteMethod
All Implemented Interfaces:
HasAttribute, Member, Method

public final class ConcreteMethod extends Object implements Method
Container for all the giblets that make up a concrete Java bytecode method. It implements Method, so it provides all the original access (by delegation), but it also constructs and keeps useful versions of stuff extracted from the method's Code attribute.
  • Constructor Details

    • ConcreteMethod

      public ConcreteMethod(Method method, ClassFile classFile, boolean keepLines, boolean keepLocals)
      Constructs an instance.
      Parameters:
      method - non-null; the method to be based on
      classFile - non-null; the class file that contains this method
      keepLines - whether to keep the line number information (if any)
      keepLocals - whether to keep the local variable information (if any)
  • Method Details

    • getSourceFile

      public CstString getSourceFile()
      Gets the source file associated with the method if known.
      Returns:
      {null-ok;} the source file defining the method if known, null otherwise.
    • isDefaultOrStaticInterfaceMethod

      public final boolean isDefaultOrStaticInterfaceMethod()
      Tests whether the method is being defined on an interface.
      Returns:
      true if the method is being defined on an interface.
    • isStaticMethod

      public final boolean isStaticMethod()
      Tests whether the method is being defined is declared as static.
      Returns:
      true if the method is being defined is declared as static.
    • getNat

      public CstNat getNat()
      Get the name and type associated with this member. This is a combination of the fields name_index and descriptor_index in the original classfile, interpreted via the constant pool.
      Specified by:
      getNat in interface Member
      Returns:
      non-null; the name and type
    • getName

      public CstString getName()
      Get the field name_index of the member. This is just a convenient shorthand for getNat().getName().
      Specified by:
      getName in interface Member
      Returns:
      non-null; the name
    • getDescriptor

      public CstString getDescriptor()
      Get the field descriptor_index of the member. This is just a convenient shorthand for getNat().getDescriptor().
      Specified by:
      getDescriptor in interface Member
      Returns:
      non-null; the descriptor
    • getAccessFlags

      public int getAccessFlags()
      Get the field access_flags.
      Specified by:
      getAccessFlags in interface Member
      Returns:
      the access flags
    • getAttributes

      public AttributeList getAttributes()
      Get the field attributes (along with attributes_count).
      Specified by:
      getAttributes in interface HasAttribute
      Specified by:
      getAttributes in interface Member
      Returns:
      non-null; the constant pool
    • getDefiningClass

      public CstType getDefiningClass()
      Get the defining class.
      Specified by:
      getDefiningClass in interface Member
      Returns:
      non-null; the defining class
    • getEffectiveDescriptor

      public Prototype getEffectiveDescriptor()
      Get the effective method descriptor, which includes, if necessary, a first this parameter.
      Specified by:
      getEffectiveDescriptor in interface Method
      Returns:
      non-null; the effective method descriptor
    • getMaxStack

      public int getMaxStack()
      Gets the maximum stack size.
      Returns:
      >= 0; the maximum stack size
    • getMaxLocals

      public int getMaxLocals()
      Gets the number of locals.
      Returns:
      >= 0; the number of locals
    • getCode

      public BytecodeArray getCode()
      Gets the bytecode array.
      Returns:
      non-null; the bytecode array
    • getCatches

      public ByteCatchList getCatches()
      Gets the exception table.
      Returns:
      non-null; the exception table
    • getLineNumbers

      public LineNumberList getLineNumbers()
      Gets the line number list.
      Returns:
      non-null; the line number list
    • getLocalVariables

      public LocalVariableList getLocalVariables()
      Gets the local variable list.
      Returns:
      non-null; the local variable list
    • makeSourcePosistion

      public SourcePosition makeSourcePosistion(int offset)
      Returns a SourcePosition instance corresponding to the given bytecode offset.
      Parameters:
      offset - >= 0; the bytecode offset
      Returns:
      non-null; an appropriate instance