File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
java/ql/lib/semmle/code/java/frameworks/android Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -25,12 +25,11 @@ class LiveLiteral extends MethodAccess {
25
25
* This predicate gets the constant value held by the private field.
26
26
*/
27
27
CompileTimeConstantExpr getValue ( ) {
28
- result =
29
- any ( ReturnStmt r | this .getMethod ( ) .calls ( r .getEnclosingCallable ( ) ) )
30
- .getResult ( )
31
- .( VarAccess )
32
- .getVariable ( )
33
- .getInitializer ( )
28
+ exists ( MethodAccess getterCall , VarAccess va |
29
+ methodReturns ( this .getMethod ( ) , getterCall ) and
30
+ methodReturns ( getterCall .getMethod ( ) , va ) and
31
+ result = va .getVariable ( ) .getInitializer ( )
32
+ )
34
33
}
35
34
36
35
override string toString ( ) { result = this .getValue ( ) .toString ( ) }
@@ -40,3 +39,10 @@ class LiveLiteral extends MethodAccess {
40
39
class LiveLiteralMethod extends Method {
41
40
LiveLiteralMethod ( ) { this .getDeclaringType ( ) .getName ( ) .matches ( "LiveLiterals$%" ) }
42
41
}
42
+
43
+ private predicate methodReturns ( Method m , Expr res ) {
44
+ exists ( ReturnStmt r |
45
+ r .getResult ( ) = res and
46
+ r .getEnclosingCallable ( ) = m
47
+ )
48
+ }
You can’t perform that action at this time.
0 commit comments