On Tue, 27 Jul 2021 23:15:10 GMT, Michael Strauß <mstra...@openjdk.org> wrote:
> Based on previous discussions, this PR attempts to improve the JavaFX > property system by enforcing correct API usage in several cases that are > outlined below. It also streamlines the API by deprecating untyped APIs in > favor of typed APIs that better express intent. > > ### 1. Behavioral changes for regular bindings > > var target = new SimpleObjectProperty(bean, "target"); > var source = new SimpleObjectProperty(bean, "source"); > target.bind(source); > target.bindBidirectional(source); > > _Before:_ `RuntimeException` --> "bean.target: A bound value cannot be set." > _After:_ `IllegalStateException` --> "bean.target: Bidirectional binding > cannot target a bound property." > > > var target = new SimpleObjectProperty(bean, "target"); > var source = new SimpleObjectProperty(bean, "source"); > var other = new SimpleObjectProperty(bean, "other"); > source.bind(other); > target.bindBidirectional(source); > > _Before:_ no error > _After:_ `IllegalArgumentException` --> "bean.source: Bidirectional binding > cannot target a bound property." > > > var target = new SimpleObjectProperty(bean, "target"); > var source = new SimpleObjectProperty(bean, "source"); > target.bindBidirectional(source); > target.bind(source); > > _Before:_ no error > _After:_ `IllegalStateException` --> "bean.target: Cannot bind a property > that is targeted by a bidirectional binding." > > > ### 2. Behavioral changes for content bindings > > var target = new SimpleListProperty(bean, "target"); > var source = new SimpleListProperty(bean, "source"); > target.bindContent(source); > target.bindContentBidirectional(source); > > _Before:_ no error > _After:_ `IllegalStateException` --> "bean.target: Bidirectional content > binding cannot target a bound collection." > > > var target = new SimpleListProperty(bean, "target"); > var source = new SimpleListProperty(bean, "source"); > var other = new SimpleListProperty(); > source.bindContent(other); > target.bindContentBidirectional(source); > > _Before:_ no error > _After:_ `IllegalArgumentException` --> "bean.source: Bidirectional content > binding cannot target a bound collection." > > > var target = new SimpleListProperty(bean, "target"); > var source = new SimpleListProperty(bean, "source"); > target.bindContentBidirectional(source); > target.bindContent(source); > > _Before:_ no error > _After:_ `IllegalStateException` --> "bean.target: Cannot bind a collection > that is targeted by a bidirectional content binding." > > > var target = new SimpleListProperty(bean, "target"); > var source = new SimpleListProperty(bean, "source"); > target.bindContent(source); > targ... This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.org/jfx/pull/590