Hi Sebastien,
First thing to say, you impress me with all this work ! Thank you very much !
I've been working with Scala for almost three years, and I really appreciate the functional code style. This involves the use of Optionals among other things you mention like map, flapMap etc. Looking at the performance test, it seems Optionals are not an issue, so it's more a matter of coding style and design in most of the cases.
After my experience with scala, I believe that if Optional do indeed avoid NullpointerException, they introduce NoSuchElemenException. Because the coding style with functional programming is more than a matter of Optionals Yes or No. It's very different from imperative programming and this will be hard to do really "as it should" in infinispan code base. So in the end, there will be moments where we will be calling "get" to an empty Optional, leading to the kind of bugs you listed before involving NullPointerException. At least, this is the case in my experience, specially coming from years of Java coding and with such a huge code base.
But I think it's good to use Optionals, specially on return types (not in method parameters).
So 1+ to use Optionals, and +1 to decide clearly how and when and following which coding style rules we should introduce them in our public APIs, internal APIs and codebase in general.
My 2 cents,
Katia