Package com.android.dx.cf.code
Class ConcreteMethod
java.lang.Object
com.android.dx.cf.code.ConcreteMethod
- All Implemented Interfaces:
HasAttribute
,Member
,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
ConstructorDescriptionConcreteMethod
(Method method, ClassFile classFile, boolean keepLines, boolean keepLocals) Constructs an instance. -
Method Summary
Modifier and TypeMethodDescriptionint
Get the fieldaccess_flags
.Get the fieldattributes
(along withattributes_count
).Gets the exception table.getCode()
Gets the bytecode array.Get the defining class.Get the fielddescriptor_index
of the member.Get the effective method descriptor, which includes, if necessary, a firstthis
parameter.Gets the line number list.Gets the local variable list.int
Gets the number of locals.int
Gets the maximum stack size.getName()
Get the fieldname_index
of the member.getNat()
Get the name and type associated with this member.Gets the source file associated with the method if known.final boolean
Tests whether the method is being defined on an interface.final boolean
Tests whether the method is being defined is declared as static.makeSourcePosistion
(int offset) Returns aSourcePosition
instance corresponding to the given bytecode offset.
-
Constructor Details
-
ConcreteMethod
Constructs an instance.- Parameters:
method
-non-null;
the method to be based onclassFile
-non-null;
the class file that contains this methodkeepLines
- whether to keep the line number information (if any)keepLocals
- whether to keep the local variable information (if any)
-
-
Method Details
-
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
Get the name and type associated with this member. This is a combination of the fieldsname_index
anddescriptor_index
in the original classfile, interpreted via the constant pool. -
getName
Get the fieldname_index
of the member. This is just a convenient shorthand forgetNat().getName()
. -
getDescriptor
Get the fielddescriptor_index
of the member. This is just a convenient shorthand forgetNat().getDescriptor()
.- Specified by:
getDescriptor
in interfaceMember
- Returns:
non-null;
the descriptor
-
getAccessFlags
public int getAccessFlags()Get the fieldaccess_flags
.- Specified by:
getAccessFlags
in interfaceMember
- Returns:
- the access flags
-
getAttributes
Get the fieldattributes
(along withattributes_count
).- Specified by:
getAttributes
in interfaceHasAttribute
- Specified by:
getAttributes
in interfaceMember
- Returns:
non-null;
the constant pool
-
getDefiningClass
Get the defining class.- Specified by:
getDefiningClass
in interfaceMember
- Returns:
non-null;
the defining class
-
getEffectiveDescriptor
Get the effective method descriptor, which includes, if necessary, a firstthis
parameter.- Specified by:
getEffectiveDescriptor
in interfaceMethod
- 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
Gets the bytecode array.- Returns:
non-null;
the bytecode array
-
getCatches
Gets the exception table.- Returns:
non-null;
the exception table
-
getLineNumbers
Gets the line number list.- Returns:
non-null;
the line number list
-
getLocalVariables
Gets the local variable list.- Returns:
non-null;
the local variable list
-
makeSourcePosistion
Returns aSourcePosition
instance corresponding to the given bytecode offset.- Parameters:
offset
->= 0;
the bytecode offset- Returns:
non-null;
an appropriate instance
-