Closed GoogleCodeExporter closed 9 years ago
Hmm... the problem with doing this is that we don't currently store anything at
all when an object has no @Subscribe methods, because we only need to store
event type -> subscriber mappings. Having to add a whole new Set<Object> for
everything that's been passed to register just to make this work seems
undesirable to me, though it wouldn't be the end of the world. It does seem
slightly preferable for unregister to be throwing an exception if the object
was never passed to register regardless of whether or not it has an @Subscribe
method though.
Original comment by cgdecker@google.com
on 6 Jan 2014 at 6:16
> Having to add a whole new Set<Object> for everything that's been passed to
register
It would be enough to store the non-subscribers. However, they may constitute
the majority as it's common to register all newly created objects without any
thoughts.
There's an asymmetry in the behavior: While `unregister` seems to try to
protect people from accidentally passing a wrong object, `register` accepts
everything and even allows registering twice (which is a no-op). Assuming
there's a good reason for un-registering throwing (which I personally doubt),
the same reason should apply for re-registering.
Original comment by Maaarti...@gmail.com
on 8 Jan 2014 at 7:50
This issue has been migrated to GitHub.
It can be found at https://github.com/google/guava/issues/<issue id>
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:10
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:17
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:07
Original issue reported on code.google.com by
stephan...@gmail.com
on 6 Jan 2014 at 10:22