Package org.jf.dexlib2.builder
Class MutableMethodImplementation
- java.lang.Object
-
- org.jf.dexlib2.builder.MutableMethodImplementation
-
- All Implemented Interfaces:
MethodImplementation
public class MutableMethodImplementation extends java.lang.Object implements MethodImplementation
-
-
Constructor Summary
Constructors Constructor Description MutableMethodImplementation(int registerCount)MutableMethodImplementation(MethodImplementation methodImplementation)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCatch(java.lang.String type, Label from, Label to, Label handler)voidaddCatch(Label from, Label to, Label handler)voidaddCatch(TypeReference type, Label from, Label to, Label handler)voidaddInstruction(int index, BuilderInstruction instruction)voidaddInstruction(BuilderInstruction instruction)java.lang.Iterable<? extends DebugItem>getDebugItems()Get a list of debug items for this method.java.util.List<BuilderInstruction>getInstructions()Gets the instructions in this method.intgetRegisterCount()Gets the number of registers in this method.java.util.List<BuilderTryBlock>getTryBlocks()Gets a list of the try blocks defined for this method.LabelnewLabelForAddress(int codeAddress)LabelnewLabelForIndex(int instructionIndex)LabelnewSwitchPayloadReferenceLabel(MethodLocation switchLocation, int[] codeAddressToIndex, int codeAddress)voidremoveInstruction(int index)voidreplaceInstruction(int index, BuilderInstruction replacementInstruction)voidswapInstructions(int index1, int index2)
-
-
-
Constructor Detail
-
MutableMethodImplementation
public MutableMethodImplementation(@Nonnull MethodImplementation methodImplementation)
-
MutableMethodImplementation
public MutableMethodImplementation(int registerCount)
-
-
Method Detail
-
getRegisterCount
public int getRegisterCount()
Description copied from interface:MethodImplementationGets the number of registers in this method.- Specified by:
getRegisterCountin interfaceMethodImplementation- Returns:
- The number of register in this method.
-
getInstructions
@Nonnull public java.util.List<BuilderInstruction> getInstructions()
Description copied from interface:MethodImplementationGets the instructions in this method.- Specified by:
getInstructionsin interfaceMethodImplementation- Returns:
- An Iterable of the instructions in this method
-
getTryBlocks
@Nonnull public java.util.List<BuilderTryBlock> getTryBlocks()
Description copied from interface:MethodImplementationGets a list of the try blocks defined for this method. Try blocks may overlap freely, and do not need to be strictly nested, as in java. This is a more relaxed requirement than specified by the dex format, where try blocks may not overlap, and must be specified in ascending order. When writing to a dex file, the try blocks will be massaged into the appropriate format. In any region where there are overlapping try blocks, set of exception handlers for the overlapping region will consist of the union of all handlers in any try block that covers that region. If multiple overlapping try blocks define a handler for the same exception type, or define a catch-all handler, then those duplicate handlers must use the same handler offset.- Specified by:
getTryBlocksin interfaceMethodImplementation- Returns:
- A list of the TryBlock items
-
getDebugItems
@Nonnull public java.lang.Iterable<? extends DebugItem> getDebugItems()
Description copied from interface:MethodImplementationGet a list of debug items for this method. This generally matches the semantics of the debug_info_item in the dex specification, although in an easier to digest form. The addresses of the DebugItems in the returned list will be in non-descending order.- Specified by:
getDebugItemsin interfaceMethodImplementation- Returns:
- A list of DebugInfo items
-
addCatch
public void addCatch(@Nullable TypeReference type, @Nonnull Label from, @Nonnull Label to, @Nonnull Label handler)
-
addCatch
public void addCatch(@Nullable java.lang.String type, @Nonnull Label from, @Nonnull Label to, @Nonnull Label handler)
-
addInstruction
public void addInstruction(int index, BuilderInstruction instruction)
-
addInstruction
public void addInstruction(@Nonnull BuilderInstruction instruction)
-
replaceInstruction
public void replaceInstruction(int index, @Nonnull BuilderInstruction replacementInstruction)
-
removeInstruction
public void removeInstruction(int index)
-
swapInstructions
public void swapInstructions(int index1, int index2)
-
newLabelForAddress
@Nonnull public Label newLabelForAddress(int codeAddress)
-
newLabelForIndex
@Nonnull public Label newLabelForIndex(int instructionIndex)
-
newSwitchPayloadReferenceLabel
@Nonnull public Label newSwitchPayloadReferenceLabel(@Nonnull MethodLocation switchLocation, @Nonnull int[] codeAddressToIndex, int codeAddress)
-
-