- Notifications
You must be signed in to change notification settings - Fork7
Closed
Labels
Description
Expected behaviour:
A field typed withOption will throw a NullPointerException if you attempt to setnull on an immutable object's field using the appropriate.withSomeValue(null) method.
Actual behaviour:
The field will be set withSome(null) and no exception will be thrown.
I'm not actually 100% sure this is a bug but it's inconsistent with the behaviour for java.lang.Optional fields: those will throw an exception if you try to set a null. It's also in my opinion less safe:Some(null) is highly unexpected.
The vavr library itself supportsSome(null) deliberately, which has had somesignificant previous discussion. I'm not sure if this applies to this library though.
I'll write a minimal reproduction of the issue if it helps.