Analyzing Data Flow
IntelliJ IDEA provides Dataflow Analysis features to help you with code archeology - better understand the inherited project code, interpret complicated parts of the code, find bottlenecks in the source, and more.
- See where do values assigned to a variable come from.
- Find out what are all possible values the variable can have.
- Find out what are the places this expression\variable\method parameter can flow into.
- Reveal places where potential
If you want to trace back the value passed to a parameter at caret, you can create a slice view of the source code using the command. Moreover, using command you can find the places an expression can flow into. The results of each dataflow analysis are displayed in the dedicated tabs of the Analyze Dataflow tool window.
To analyze dataflow to/from a symbol
- Open the desired file for editing.
- Place the caret at the symbol to be analyzed (expression\variable\method parameter).
- On the main menu, or on the context menu, choose or depending on your purposes.
- Specify the analysis scope and select, whether you want to ignore all values coming from the test code.
- Click OK. Review the analysis results in the dedicated Analyze Dataflow tool window.
Dataflow Analysis Results
The following sections briefly describe how to "read" the dataflow analysis results.
Dataflow to Here
- The values in this view flow in the following direction:
the value for the field
this.authType = authTypeassignment statement in
SingleSignOnMessage.setAuthType()method called from
authTypeparameter and so on.
- Expand the tree to dig in the chain of assignments and method calls that lead to the symbol in question.
- Nodes with gray background denote duplicates (the usages that are already present in the tree in another location).