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 {
2525 * This predicate gets the constant value held by the private field.
2626 */
2727 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+ )
3433 }
3534
3635 override string toString ( ) { result = this .getValue ( ) .toString ( ) }
@@ -40,3 +39,10 @@ class LiveLiteral extends MethodAccess {
4039class LiveLiteralMethod extends Method {
4140 LiveLiteralMethod ( ) { this .getDeclaringType ( ) .getName ( ) .matches ( "LiveLiterals$%" ) }
4241}
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