findVariable
public @Nullable Element findVariable(@ReadOnly String reference,
@Nullable TreePath path)
Finds the variable referenced in the passed String
.
This method may only operate on variable references, e.g. local
variables, parameters, fields.
The reference string may be either an single Java identifier (e.g. "field")
or dot-separated identifiers (e.g. "Collections.EMPTY_LIST").
The method adheres to all the rules of Java's scoping (while also
considering the imports) for name resolution.
- Parameters:
reference
- the variable reference stringpath
- the tree path to the local scope
- Returns:
- the variable reference