Class TraverserController
java.lang.Object
jadx.core.dex.visitors.finaly.traverser.TraverserController
Responsible for determining if two distinct subgraphs are the same within a graph by comparing
all blocks and their instructions.
This is used for identifying duplicated instructions for extracting finally blocks.
The terms "finally" and "candidate" are used to represent the two distinct subgraphs explored
by this controller; the "finally" subgraph, which is the subgraph which is what is being used
as a finally block, and the "candidate" subgraph, which is the subgraph which is being
compared to the "finally" subgraph to see if they are the same. There is only ever one
"finally" subgraph, however it is run against multiple different "candidate" subgraphs depending
on the complexity of the try catch block that this is being run for.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTraverserController(@Nullable Function<TraverserState, Boolean> stateAbortCondition) -
Method Summary
Modifier and TypeMethodDescriptionadvance(TraverserActivePathState state, AtomicReference<TraverserState> previousFinallyState, AtomicReference<TraverserState> previousCandidateState) Processes a singular traverser state once.private booleanadvanceSingleState(TraverserActivePathState activePathState, TraverserState singleState, boolean hasReadyToCompare) Advances a singular state once.process(TraverserActivePathState state) Processes a traverser path state using from aTraverserActivePathState.private static List<TraverserActivePathState> processHandlerImplementations(TraverserActivePathState state, AbstractBlockTraverserHandler handler)
-
Field Details
-
stateAbortCondition
-
-
Constructor Details
-
TraverserController
public TraverserController() -
TraverserController
public TraverserController(@Nullable @Nullable Function<TraverserState, Boolean> stateAbortCondition)
-
-
Method Details
-
processHandlerImplementations
private static List<TraverserActivePathState> processHandlerImplementations(TraverserActivePathState state, AbstractBlockTraverserHandler handler) throws TraverserException - Throws:
TraverserException
-
process
public List<TraverserActivePathState> process(TraverserActivePathState state) throws TraverserException Processes a traverser path state using from aTraverserActivePathState. This function will continue evaluating an active path until either:- The state abort condition is met by both "finally" and "candidate" path, if there is one.
- The path state of either the "finally" or "candidate" path has terminated.
- The path has began a comparison of two blocks which have already been compared.
- The "finally" and "candidate" states, on two different executions of
advance(jadx.core.dex.visitors.finaly.traverser.state.TraverserActivePathState, java.util.concurrent.atomic.AtomicReference<jadx.core.dex.visitors.finaly.traverser.state.TraverserState>, java.util.concurrent.atomic.AtomicReference<jadx.core.dex.visitors.finaly.traverser.state.TraverserState>), did not change.
- Throws:
TraverserException
-
advance
public List<TraverserActivePathState> advance(TraverserActivePathState state, AtomicReference<TraverserState> previousFinallyState, AtomicReference<TraverserState> previousCandidateState) throws TraverserException Processes a singular traverser state once.- Throws:
TraverserException
-
advanceSingleState
private boolean advanceSingleState(TraverserActivePathState activePathState, TraverserState singleState, boolean hasReadyToCompare) throws TraverserException Advances a singular state once.- Returns:
- Whether this state has been aborted by the state abort function.
- Throws:
TraverserException
-