diff options
author | Yigit Boyar <yboyar@google.com> | 2018-10-15 11:21:44 -0700 |
---|---|---|
committer | Yigit Boyar <yboyar@google.com> | 2019-01-08 02:58:24 +0000 |
commit | 0faac69771294e38126e82eb7c38bd9146dd1820 (patch) | |
tree | 5a8838a839f71b70662e3edf171dde335d23fc76 /compiler/src/main/java/android/databinding | |
parent | c1c4f46b41afaed79f2e4cf132eb925603d6345f (diff) | |
download | data-binding-0faac69771294e38126e82eb7c38bd9146dd1820.tar.gz |
Fix two way binding for field access expressions
This CL fixes a bug in FIeldAccessExpr's two way resolution logic.
FieldAccessExpr is the last stop in two way resolution as it is
either targeted to a view (check for two way) or not (nothing to do).
But this breaks in cases where it might have nested access levels.
e.g. textView.text.length has a nested FieldAccessExpr which is
two way (textView.text) but the target for the parent is textView.text
which is a FieldAccessExpression.
Previous logic was stopping resolution when it is not ViewAccess but
it should've continued to call the parent to check nested items.
Bug: 116536168
Test: TwoWayBetweenViewsTest
Change-Id: I74e9c62ee21fc06f6128c6baaebde21496c495b9
Diffstat (limited to 'compiler/src/main/java/android/databinding')
-rw-r--r-- | compiler/src/main/java/android/databinding/tool/expr/FieldAccessExpr.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/src/main/java/android/databinding/tool/expr/FieldAccessExpr.java b/compiler/src/main/java/android/databinding/tool/expr/FieldAccessExpr.java index 88017f5b..078457b1 100644 --- a/compiler/src/main/java/android/databinding/tool/expr/FieldAccessExpr.java +++ b/compiler/src/main/java/android/databinding/tool/expr/FieldAccessExpr.java @@ -319,7 +319,8 @@ public class FieldAccessExpr extends MethodBaseExpr { public Expr resolveTwoWayExpressions(Expr parent) { final Expr child = getTarget(); if (!(child instanceof ViewFieldExpr)) { - return this; + // fallback to default logic to check sub expressions + return super.resolveTwoWayExpressions(parent); } final ViewFieldExpr expr = (ViewFieldExpr) child; final BindingTarget bindingTarget = expr.getBindingTarget(); |