A DESCRIPTION OF THE PROBLEM :
The code example in the JavaDoc of the method ObservableValue#when doesn't compile. The code example is reproduced below. None of the calls to the method setValue compile. The problem is that the variables `condition` and `longLivedProperty` are declared with the type ObservableValue, which doesn't have a `setValue` method. They should be of type `Property`. Or their declaration should use a `var`, like it's done for similar variables in code examples in the JavaDoc of the methods `map` and `orElse`.
```
ObservableValue<Boolean> condition = new SimpleBooleanProperty(true);
ObservableValue<String> longLivedProperty = new SimpleStringProperty("A");
ObservableValue<String> whenProperty = longLivedProperty.when(condition);
// observe whenProperty, which will in turn observe longLivedProperty
whenProperty.addListener((ov, old, current) -> System.out.println(current));
longLivedProperty.setValue("B"); // "B" is printed
condition.setValue(false);
// After condition becomes false, whenProperty stops observing longLivedProperty; condition
// and whenProperty may now be eligible for GC despite being observed by the ChangeListener
longLivedProperty.setValue("C"); // nothing is printed
longLivedProperty.setValue("D"); // nothing is printed
condition.setValue(true); // longLivedProperty is observed again, and "D" is printed
```
The code example in the JavaDoc of the method ObservableValue#when doesn't compile. The code example is reproduced below. None of the calls to the method setValue compile. The problem is that the variables `condition` and `longLivedProperty` are declared with the type ObservableValue, which doesn't have a `setValue` method. They should be of type `Property`. Or their declaration should use a `var`, like it's done for similar variables in code examples in the JavaDoc of the methods `map` and `orElse`.
```
ObservableValue<Boolean> condition = new SimpleBooleanProperty(true);
ObservableValue<String> longLivedProperty = new SimpleStringProperty("A");
ObservableValue<String> whenProperty = longLivedProperty.when(condition);
// observe whenProperty, which will in turn observe longLivedProperty
whenProperty.addListener((ov, old, current) -> System.out.println(current));
longLivedProperty.setValue("B"); // "B" is printed
condition.setValue(false);
// After condition becomes false, whenProperty stops observing longLivedProperty; condition
// and whenProperty may now be eligible for GC despite being observed by the ChangeListener
longLivedProperty.setValue("C"); // nothing is printed
longLivedProperty.setValue("D"); // nothing is printed
condition.setValue(true); // longLivedProperty is observed again, and "D" is printed
```