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
ConstructorsConstructorDescriptionConcreteMethod(Method method, ClassFile classFile, boolean keepLines, boolean keepLocals) Constructs an instance. -
Method Summary
Modifier and TypeMethodDescriptionintGet 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_indexof the member.Get the effective method descriptor, which includes, if necessary, a firstthisparameter.Gets the line number list.Gets the local variable list.intGets the number of locals.intGets the maximum stack size.getName()Get the fieldname_indexof the member.getNat()Get the name and type associated with this member.Gets the source file associated with the method if known.final booleanTests whether the method is being defined on an interface.final booleanTests whether the method is being defined is declared as static.makeSourcePosistion(int offset) Returns aSourcePositioninstance 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
-
getName
-
getDescriptor
Get the fielddescriptor_indexof the member. This is just a convenient shorthand forgetNat().getDescriptor().- Specified by:
getDescriptorin interfaceMember- Returns:
non-null;the descriptor
-
getAccessFlags
public int getAccessFlags()Get the fieldaccess_flags.- Specified by:
getAccessFlagsin interfaceMember- Returns:
- the access flags
-
getAttributes
Get the fieldattributes(along withattributes_count).- Specified by:
getAttributesin interfaceHasAttribute- Specified by:
getAttributesin interfaceMember- Returns:
non-null;the constant pool
-
getDefiningClass
Get the defining class.- Specified by:
getDefiningClassin interfaceMember- Returns:
non-null;the defining class
-
getEffectiveDescriptor
Get the effective method descriptor, which includes, if necessary, a firstthisparameter.- Specified by:
getEffectiveDescriptorin 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
-
getCatches
-
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 aSourcePositioninstance corresponding to the given bytecode offset.- Parameters:
offset->= 0;the bytecode offset- Returns:
non-null;an appropriate instance
-