com.android.dx.cf.code
Class ConcreteMethod

java.lang.Object
  extended by com.android.dx.cf.code.ConcreteMethod
All Implemented Interfaces:
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 Summary
ConcreteMethod(Method method, ClassFile cf, boolean keepLines, boolean keepLocals)
          Constructs an instance.
ConcreteMethod(Method method, int accessFlags, CstString sourceFile, boolean keepLines, boolean keepLocals)
           
 
Method Summary
 int getAccessFlags()
          Get the field access_flags.
 boolean getAccSuper()
          Gets whether the class that this method is part of is defined with ACC_SUPER.
 AttributeList getAttributes()
          Get the field attributes (along with attributes_count).
 ByteCatchList getCatches()
          Gets the exception table.
 BytecodeArray getCode()
          Gets the bytecode array.
 CstType getDefiningClass()
          Get the defining class.
 CstString getDescriptor()
          Get the field descriptor_index of the member.
 Prototype getEffectiveDescriptor()
          Get the effective method descriptor, which includes, if necessary, a first this parameter.
 LineNumberList getLineNumbers()
          Gets the line number list.
 LocalVariableList getLocalVariables()
          Gets the local variable list.
 int getMaxLocals()
          Gets the number of locals.
 int getMaxStack()
          Gets the maximum stack size.
 CstString getName()
          Get the field name_index of the member.
 CstNat getNat()
          Get the name and type associated with this member.
 SourcePosition makeSourcePosistion(int offset)
          Returns a SourcePosition instance corresponding to the given bytecode offset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConcreteMethod

public ConcreteMethod(Method method,
                      ClassFile cf,
                      boolean keepLines,
                      boolean keepLocals)
Constructs an instance.

Parameters:
method - non-null; the method to be based on
cf - 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)

ConcreteMethod

public ConcreteMethod(Method method,
                      int accessFlags,
                      CstString sourceFile,
                      boolean keepLines,
                      boolean keepLocals)
Method Detail

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 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

getAccSuper

public boolean getAccSuper()
Gets whether the class that this method is part of is defined with ACC_SUPER.

Returns:
the ACC_SUPER value

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


Copyright © 2015. All rights reserved.