diff options
author | Yigit Boyar <yboyar@google.com> | 2019-10-03 16:12:46 -0700 |
---|---|---|
committer | TreeHugger Robot <treehugger-gerrit@google.com> | 2019-10-08 21:10:34 +0000 |
commit | 103e4e323372565802ecb09ee689b77f43acc92e (patch) | |
tree | cb4eacc7ccd6cc6108ffa63aa16eae72561cad2a /compiler/src/main/kotlin/android/databinding/tool | |
parent | bff339917a58bccd30775d866fe12f67af166682 (diff) | |
download | data-binding-103e4e323372565802ecb09ee689b77f43acc92e.tar.gz |
Detect recursive structures in data binding
This CL fixes two bugs in data binding both related to recursive
data structures.
If you provide data binding a class that looks like Foo<T : Foo> or
Foo : LiveData<T : Foo>, it would go into a stackoverflow or OOM
trying to parse it since it would land back into the same class
as it tries to resolve values.
This CL fixes it by adding a tracker into such code and bails out
with whatever information it can.
For cases where the class in question is observable
(e.g. class Foo : LiveData<Foo>), we crash with a message since
data binding will try to create foo.getValue().getValue()...
For cases where it is a normal class (which we won't try to unwrap),
we work as desired.
There is possibly more of these but i can only reproduce these 3
cases so didn't want to overzealously add more coverage without
having a repro case.
Bug: 141633235
Bug: 140999936
Test: RecursiveLayoutTest (TestApp), RecursiveObservableTest
(compileation test)
Change-Id: I9977a1c8ae7c726b924550783d48049e89ca227c
Diffstat (limited to 'compiler/src/main/kotlin/android/databinding/tool')
0 files changed, 0 insertions, 0 deletions