HubSpot / algebra

Simple abstract data types (wrapping derive4j) in Java
Apache License 2.0
15 stars 7 forks source link

Return Result.ok(null) #47

Open prokoks121 opened 2 weeks ago

prokoks121 commented 2 weeks ago

If I want to return Result.ok and enter null as a value, for certain methods such as isOk, ifOk and similar, a nullPointerException is obtained.

java.lang.NullPointerException: null at java.base/java.util.Objects.requireNonNull(Objects.java:233) ~[na:na] at java.base/java.util.Optional.of(Optional.java:113) ~[na:na] at com.hubspot.algebra.Results.lambda$getOk$3(Results.java:46) ~[algebra-1.5.jar:1.5] at com.hubspot.algebra.Results$Ok.match(Results.java:104) ~[algebra-1.5.jar:1.5] at com.hubspot.algebra.Results.getOk(Results.java:45) ~[algebra-1.5.jar:1.5] at com.hubspot.algebra.Result.isOk(Result.java:32) ~[algebra-1.5.jar:1.5]

prokoks121 commented 2 weeks ago

Additional isOk throw exception because it uses : /**