Closed GoogleCodeExporter closed 8 years ago
Since the subscription is to weak reference (in a weak list), better not to
provide anonymous class in this way. Rather, create a variable holding that
observer instance would prevent this.
Original comment by gueei....@gmail.com
on 18 Jul 2012 at 4:08
I don't think api "users" should know about the internal design being a weak
list to use it well. In this case, for each observable we subscribed to, we
need to bother to keep the reference alive so the subscription works.
I think the subscription should stay alive as long as the observable is (or
until we manually unsuscribe). Right now, it make pollutions for every
subscription we do in our view model, without talking about the risk of
forgetting to keep a reference and making the code unstable. For exemple, I
have 10 observers of this kind at the top on only 1 view model (I know I could
have a collection of observers but still...) :
@SuppressWarnings("unused")
private Observer _myDummyObserver;
Also, it seems a lot more natural to use the anonymous class (they are also
used this way in test testInnerField_Notification_OA_OB_OC for exemple).
Original comment by instri...@hotmail.com
on 19 Jul 2012 at 2:28
Original issue reported on code.google.com by
instri...@hotmail.com
on 18 Jul 2012 at 1:26