Package org.jf.dexlib2.immutable
Class ImmutableMethodImplementation
- java.lang.Object
-
- org.jf.dexlib2.immutable.ImmutableMethodImplementation
-
- All Implemented Interfaces:
MethodImplementation
public class ImmutableMethodImplementation extends java.lang.Object implements MethodImplementation
-
-
Field Summary
Fields Modifier and Type Field Description protected com.google.common.collect.ImmutableList<? extends ImmutableDebugItem>
debugItems
protected com.google.common.collect.ImmutableList<? extends ImmutableInstruction>
instructions
protected int
registerCount
protected com.google.common.collect.ImmutableList<? extends ImmutableTryBlock>
tryBlocks
-
Constructor Summary
Constructors Constructor Description ImmutableMethodImplementation(int registerCount, com.google.common.collect.ImmutableList<? extends ImmutableInstruction> instructions, com.google.common.collect.ImmutableList<? extends ImmutableTryBlock> tryBlocks, com.google.common.collect.ImmutableList<? extends ImmutableDebugItem> debugItems)
ImmutableMethodImplementation(int registerCount, java.lang.Iterable<? extends Instruction> instructions, java.util.List<? extends TryBlock<? extends ExceptionHandler>> tryBlocks, java.lang.Iterable<? extends DebugItem> debugItems)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.common.collect.ImmutableList<? extends ImmutableDebugItem>
getDebugItems()
Get a list of debug items for this method.com.google.common.collect.ImmutableList<? extends ImmutableInstruction>
getInstructions()
Gets the instructions in this method.int
getRegisterCount()
Gets the number of registers in this method.com.google.common.collect.ImmutableList<? extends ImmutableTryBlock>
getTryBlocks()
Gets a list of the try blocks defined for this method.static ImmutableMethodImplementation
of(MethodImplementation methodImplementation)
-
-
-
Field Detail
-
registerCount
protected final int registerCount
-
instructions
@Nonnull protected final com.google.common.collect.ImmutableList<? extends ImmutableInstruction> instructions
-
tryBlocks
@Nonnull protected final com.google.common.collect.ImmutableList<? extends ImmutableTryBlock> tryBlocks
-
debugItems
@Nonnull protected final com.google.common.collect.ImmutableList<? extends ImmutableDebugItem> debugItems
-
-
Constructor Detail
-
ImmutableMethodImplementation
public ImmutableMethodImplementation(int registerCount, @Nullable java.lang.Iterable<? extends Instruction> instructions, @Nullable java.util.List<? extends TryBlock<? extends ExceptionHandler>> tryBlocks, @Nullable java.lang.Iterable<? extends DebugItem> debugItems)
-
ImmutableMethodImplementation
public ImmutableMethodImplementation(int registerCount, @Nullable com.google.common.collect.ImmutableList<? extends ImmutableInstruction> instructions, @Nullable com.google.common.collect.ImmutableList<? extends ImmutableTryBlock> tryBlocks, @Nullable com.google.common.collect.ImmutableList<? extends ImmutableDebugItem> debugItems)
-
-
Method Detail
-
of
@Nullable public static ImmutableMethodImplementation of(@Nullable MethodImplementation methodImplementation)
-
getRegisterCount
public int getRegisterCount()
Description copied from interface:MethodImplementation
Gets the number of registers in this method.- Specified by:
getRegisterCount
in interfaceMethodImplementation
- Returns:
- The number of register in this method.
-
getInstructions
@Nonnull public com.google.common.collect.ImmutableList<? extends ImmutableInstruction> getInstructions()
Description copied from interface:MethodImplementation
Gets the instructions in this method.- Specified by:
getInstructions
in interfaceMethodImplementation
- Returns:
- An Iterable of the instructions in this method
-
getTryBlocks
@Nonnull public com.google.common.collect.ImmutableList<? extends ImmutableTryBlock> getTryBlocks()
Description copied from interface:MethodImplementation
Gets 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:
getTryBlocks
in interfaceMethodImplementation
- Returns:
- A list of the TryBlock items
-
getDebugItems
@Nonnull public com.google.common.collect.ImmutableList<? extends ImmutableDebugItem> getDebugItems()
Description copied from interface:MethodImplementation
Get 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:
getDebugItems
in interfaceMethodImplementation
- Returns:
- A list of DebugInfo items
-
-