Expand description
The condition language of findrefs rules and callgraph endpoints.
rule := part ( '&' part )*
part := [ '!' ] KIND ':' value
value := ['=' | '*'] '{' rule '}' calls method only: calls of the methods whose code matches the rule
| ['=' | '*'] '@' PATH calls method only: calls of the methods listed in a file
| TEXT calls method: a method target, e.g. Lc;->m(I)V
| TEXT the other KINDs' own syntax, e.g. a regex
calls := ( '[' constraint ( ',' constraint )* ']' )*
constraint := ( 'arg' N | 'this' ) ( '=' | '==' ) arg
| 'ret' ( '=' | '==' ) ( 'used' | 'unused' )
arg := '*' | INT | 'true' | 'false' | 'null' | '"' TEXT '"' | '~' REGEX
| 'param' [ K ] | 'class:' TYPE | 'new:' TYPE | 'ret:' METHOD | 'field:' FIELDA rule of one positive part is that condition; several parts make a
compound (Query::All) whose ! parts are its none list. TEXT runs
to the next & outside {} / (), or to the } closing the enclosing
body; \ keeps the next character from ending it (string:a\&b is the
regex a\&b).
A {rule} or @PATH set also takes the calls that may dispatch to its
methods (Query::Virtual): those naming a method on a supertype of its
class, or on a subclass inheriting it. A supertype method more than
DEFAULT_FAN_OUT classes define is
not followed (the search notes it); * in front follows every one, =
keeps only the calls naming the set’s methods themselves.
Constraints keep the calls whose values they accept (Query::Call):
argN is the Nth declared parameter of the called method (from 0),
this its receiver, paramK the calling method’s own pK (smali
numbering), ret: / field: the result of a call / a field read the
target matches. Values are what the call site may hold: = keeps a site
the analysis cannot decide (marked ?), == drops it. * only shows
the values. A REGEX runs to the next , / ] outside () / {}, or is
quoted like TEXT (\", \\ escape).
Functions§
- has_
constraints - Whether a method target carries call constraints (
X[arg0=1]). - method_
set - The methods of an
@file: one per line, blank lines and#comments skipped. A line may be any method target spelling, or a line findrefs or callgraph printed: its firstLcls;->name...token is the method. - parse_
condition_ in - Parse one condition (a rule of a single part without
!). - parse_
rule_ in - Parse a rule (see the module docs).
@PATHfiles are read relative todir(the current directory whenNone).