Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Option type fields allow nulls #27

Closed
Assignees
io7m
Labels
@MFAshby

Description

@MFAshby

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp