RFR: JDK-8304439: Subscription based listeners [v2]
Michael Strauß
mstrauss at openjdk.org
Tue Apr 18 00:07:55 UTC 2023
On Tue, 18 Apr 2023 00:04:27 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:
> Just took a quick look.
>
> Ideally, we would not split the world into subscriptions and listeners. Adding a return type to `addListener` and `removeListener` is source compatible, but not binary. Is this something that we strictly can't do? Is the disruption factor too high?
I would say it's not really source-compatible, as the change would be forced on every `Observable` or `ObservableValue` implementation. I'm also not too sure whether this would actually be a sensible API: why have a `removeListener` method at all, when `addListener` returns a subscription? The distinction between `addListener/removeListener` and `subscribe` seems to make more sense to me, and can be retrofitted without any new implementation requirements.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1069#issuecomment-1512258452
More information about the openjfx-dev
mailing list