It’s not easy to know without a bit of context :sm...
# arrow
p
It’s not easy to know without a bit of context 😄
Trying to flatMap { it.records.toOption() } .flatMap { it.firstOption() } until i get to the message
that is null
Umm, the issues was:
Copy code
val message = ObjectMapper().writeValueAsString(null)
Option.fromNullable(message)
Some(null)
p
.flatMap { it.firstOption() }
if the first record is null it should be
Some(null)
sadly. Try
it.filter { it != null }.firstOption()
in your casee message is
String!
, right? After being nullchecked it should become
String
j
Seems, that now is right. Still this behaviour also happens in Scala. This -->
Copy code
val message = ObjectMapper().writeValueAsString(null)
i obtain Some(null) when
Copy code
Option(message)
(Scala) or
Copy code
Option.fromNullable(message)
(Kotlin)
p
Wait, how do you check that it’s
Some(null)
, by println the value or with the debugger?
Because
writeValueAsString(null)
seems to me like something that’ll return a string
"null"
, which then gets printed as
Some(value = "\"null\"")
and that may be correct and te corro a gorrazos
j
With the repl
Yep, you are right 🙁 😞
p
hahaahhahaha okay
well, bug found, crisis averted