-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
jfx24, jfx26
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
Mappings on ObservableValues never pass through nulls, even if null is a valid instance of the parameterized type and wouldn't be for the mapped type.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Declare nullable ObservableValue, map it to non-null ObservableValue
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
mapped ObservableValue never contains null
ACTUAL -
null is casted to result type
---------- BEGIN SOURCE ----------
ObservableValue<@Nullable String> input = new SimpleObjectProperty<>(null);
ObservableValue<@NotNull Integer> output = input.map(text -> {
if (text == null) {
return 0;
} else {
return text.length();
}
});
assertEquals(0, output.getValue());
---------- END SOURCE ----------
Mappings on ObservableValues never pass through nulls, even if null is a valid instance of the parameterized type and wouldn't be for the mapped type.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Declare nullable ObservableValue, map it to non-null ObservableValue
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
mapped ObservableValue never contains null
ACTUAL -
null is casted to result type
---------- BEGIN SOURCE ----------
ObservableValue<@Nullable String> input = new SimpleObjectProperty<>(null);
ObservableValue<@NotNull Integer> output = input.map(text -> {
if (text == null) {
return 0;
} else {
return text.length();
}
});
assertEquals(0, output.getValue());
---------- END SOURCE ----------