How to reproduce :
Option.of(/*any value*/)
.map(/*any method that produces null on the first value*/)
.map(/*whatever*/) //<--- it crashes here, NPE
The reason is the map method creates a Some, whatever the value is null or not. Maybe the map method should use Option.of instead of Option.some ?
Hi @Pyeroh, thank you for your question! In fact recently there were similar question and always I answered: Option behaves correct, Optional is broken.
I've done a blog post today because I think your question will not be the last one regarding Some(null):
http://blog.javaslang.io/the-agonizing-death-of-an-astronaut/~~
Update: http://blog.vavr.io/the-agonizing-death-of-an-astronaut/
I will close this ticket. Please don't hesitate to ask me any further questions!
Thank you for your answer, I'll comment your blog post ;)
May any future dev encountering this problem get all the information he needs with this ticket!
Link is now broken, new address is here :
http://blog.vavr.io/the-agonizing-death-of-an-astronaut/