Top Description Fields Constructors Methods
org.droidparts.dexmaker.dx.dex.code

public final Class StdCatchBuilder

extends Object
implements CatchBuilder
Class Inheritance
All Implemented Interfaces
org.droidparts.dexmaker.dx.dex.code.CatchBuilder
Imports
org.droidparts.dexmaker.dx.rop.code.BasicBlock, .BasicBlockList, .RopMethod, org.droidparts.dexmaker.dx.rop.cst.CstType, org.droidparts.dexmaker.dx.rop.type.Type, .TypeList, org.droidparts.dexmaker.dx.util.IntList, java.util.ArrayList, .HashSet

Constructor of CatchTable instances from RopMethod and associated data.

Field Summary

Modifier and TypeField and Description
private final BlockAddresses
addresses

non-null; address objects for each block

private static final int
MAX_CATCH_RANGE

the maximum range of a single catch handler, in code units

private final RopMethod
method

non-null; method to build the list for

private final int[]
order

non-null; block output order

Constructor Summary

AccessConstructor and Description
public
StdCatchBuilder(RopMethod
non-null; method to build the list for
method
,
int[]
non-null; block output order
order
,
BlockAddresses
non-null; address objects for each block
addresses
)

Constructs an instance.

Method Summary

Modifier and TypeMethod and Description
public CatchTable
build()

Implements org.droidparts.dexmaker.dx.dex.code.CatchBuilder.build.

Builds and returns the catch table for this instance.
public static CatchTable

Returns:

non-null; the constructed table
build
(RopMethod
non-null; method to build the list for
method
,
int[]
non-null; block output order
order
,
BlockAddresses
non-null; address objects for each block
addresses
)

Builds and returns the catch table for a given method.

public HashSet<Type>
getCatchTypes()

Implements org.droidparts.dexmaker.dx.dex.code.CatchBuilder.getCatchTypes.

Gets the set of catch types associated with this instance.
private static CatchHandlerList

Returns:

non-null; array of entries
handlersFor
(BasicBlock
non-null; block to get entries for
block
,
BlockAddresses
non-null; address objects for each block
addresses
)

Makes the CatchHandlerList for the given basic block.

public boolean
hasAnyCatches()

Implements org.droidparts.dexmaker.dx.dex.code.CatchBuilder.hasAnyCatches.

Gets whether this instance has any catches at all (either typed or catch-all).
private static CatchTable.Entry
makeEntry(BasicBlock
non-null; the start block for the range (inclusive)
start
,
BasicBlock
non-null; the start block for the range (also inclusive)
end
,
CatchHandlerList
non-null; the handlers for the range
handlers
,
BlockAddresses
non-null; address objects for each block
addresses
)

Makes a CatchTable#Entry for the given block range and handlers.

private static boolean

Returns:

true if the range is valid as a catch range
rangeIsValid
(BasicBlock
non-null; the start block for the range (inclusive)
start
,
BasicBlock
non-null; the start block for the range (also inclusive)
end
,
BlockAddresses
non-null; address objects for each block
addresses
)

Gets whether the address range for the given two blocks is valid for a catch handler.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

addressesback to summary
private final BlockAddresses addresses

non-null; address objects for each block

MAX_CATCH_RANGEback to summary
private static final int MAX_CATCH_RANGE

the maximum range of a single catch handler, in code units

methodback to summary
private final RopMethod method

non-null; method to build the list for

orderback to summary
private final int[] order

non-null; block output order

Constructor Detail

StdCatchBuilderback to summary
public StdCatchBuilder(RopMethod method, int[] order, BlockAddresses addresses)

Constructs an instance. It merely holds onto its parameters for a subsequent call to build.

Parameters
method:RopMethod

non-null; method to build the list for

order:int[]

non-null; block output order

addresses:BlockAddresses

non-null; address objects for each block

Method Detail

buildback to summary
public CatchTable build()

Implements org.droidparts.dexmaker.dx.dex.code.CatchBuilder.build.

Doc from org.droidparts.dexmaker.dx.dex.code.CatchBuilder.build.

Builds and returns the catch table for this instance.

Returns:CatchTable

non-null; the constructed table

buildback to summary
public static CatchTable build(RopMethod method, int[] order, BlockAddresses addresses)

Builds and returns the catch table for a given method.

Parameters
method:RopMethod

non-null; method to build the list for

order:int[]

non-null; block output order

addresses:BlockAddresses

non-null; address objects for each block

Returns:CatchTable

non-null; the constructed table

getCatchTypesback to summary
public HashSet<Type> getCatchTypes()

Implements org.droidparts.dexmaker.dx.dex.code.CatchBuilder.getCatchTypes.

Doc from org.droidparts.dexmaker.dx.dex.code.CatchBuilder.getCatchTypes.

Gets the set of catch types associated with this instance.

Returns:HashSet<Type>

non-null; the set of catch types

handlersForback to summary
private static CatchHandlerList handlersFor(BasicBlock block, BlockAddresses addresses)

Makes the CatchHandlerList for the given basic block.

Parameters
block:BasicBlock

non-null; block to get entries for

addresses:BlockAddresses

non-null; address objects for each block

Returns:CatchHandlerList

non-null; array of entries

hasAnyCatchesback to summary
public boolean hasAnyCatches()

Implements org.droidparts.dexmaker.dx.dex.code.CatchBuilder.hasAnyCatches.

Doc from org.droidparts.dexmaker.dx.dex.code.CatchBuilder.hasAnyCatches.

Gets whether this instance has any catches at all (either typed or catch-all).

Returns:boolean

whether this instance has any catches at all

makeEntryback to summary
private static CatchTable.Entry makeEntry(BasicBlock start, BasicBlock end, CatchHandlerList handlers, BlockAddresses addresses)

Makes a CatchTable#Entry for the given block range and handlers.

Parameters
start:BasicBlock

non-null; the start block for the range (inclusive)

end:BasicBlock

non-null; the start block for the range (also inclusive)

handlers:CatchHandlerList

non-null; the handlers for the range

addresses:BlockAddresses

non-null; address objects for each block

rangeIsValidback to summary
private static boolean rangeIsValid(BasicBlock start, BasicBlock end, BlockAddresses addresses)

Gets whether the address range for the given two blocks is valid for a catch handler. This is true as long as the covered range is under 65536 code units.

Parameters
start:BasicBlock

non-null; the start block for the range (inclusive)

end:BasicBlock

non-null; the start block for the range (also inclusive)

addresses:BlockAddresses

non-null; address objects for each block

Returns:boolean

true if the range is valid as a catch range