Re: Optional vs Nullable

2017-08-25 Thread Piotr Nowojski
Chesney you are looking at this in wrong way. With Optionals, your proposed myMethod wouldn’t be allowed by our code style/convention. It should look like this: public void myMethod(Optional parameter) { checkNotNull(parameter, “parameter is null”); if (parameter.isPresent()) {

Re: Optional vs Nullable

2017-08-25 Thread Dawid Wysakowicz
I agree with Chesnay, that Optional is not so perfect especially in places other than return value. Some other problems I could see: 1. Optional is a generic type, and generic types not always behave well with the TypeInformation due to type erasure. 2. Optionals due not work well with Reflecti

Re: Optional vs Nullable

2017-08-25 Thread Chesnay Schepler
I think you're overselling optional a little bit. The unfortunate fact is that any Optional /can still be null itself/. As such, if there a method accepts an Optional it still has to check whether it is null, /and in addition whether it contains a null. /i.e. public void myMethod(Optional

Optional vs Nullable

2017-08-24 Thread Piotr Nowojski
Hi, Since we switched to Java 8, I would like to start a discussion about a deprecating usage of @Nullable parameters and return values in Flink and enforcing strict ban on nulls in those places. I just think that having a very explicit way, enforced by a static type checking mechanism of optio