Skip to content

Commit bc84ff2

Browse files
atorralbaigfoo
authored andcommitted
Improve docs of LiveLiteral
Also remove transitive closure from calls
1 parent 3836d15 commit bc84ff2

File tree

1 file changed

+11
-2
lines changed
  • java/ql/lib/semmle/code/java/frameworks/android

1 file changed

+11
-2
lines changed

java/ql/lib/semmle/code/java/frameworks/android/Compose.qll

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,19 @@ class LiveLiteral extends MethodAccess {
1414
not this.getEnclosingCallable() instanceof LiveLiteralMethod
1515
}
1616

17-
/** Gets the constant value that backs this live literal. */
17+
/**
18+
* Live literal classes consist of the following:
19+
* - A private field holding the constant value that backs this live literal.
20+
* - A private getter to access the constant value.
21+
* - A public getter that either calls the private getter and returns its result or,
22+
* if live literals are activated, returns the value of a dynamic state object that is initialized with
23+
* the constant value.
24+
*
25+
* This predicate gets the constant value held by the private field.
26+
*/
1827
CompileTimeConstantExpr getValue() {
1928
result =
20-
any(ReturnStmt r | this.getMethod().calls*(r.getEnclosingCallable()))
29+
any(ReturnStmt r | this.getMethod().calls(r.getEnclosingCallable()))
2130
.getResult()
2231
.(VarAccess)
2332
.getVariable()

0 commit comments

Comments
 (0)