Hi Garret,

for null checking we have our own solution, see org.apache.wicket.util.lang.Args#notNull().

We've discussed Optional on this list before but didn't came to a positive decision.

Regards
Sven


On 07/13/2014 05:19 PM, Garret Wilson wrote:
On 7/13/2014 3:19 AM, Peter Henderson wrote:
...
​For null checking I'd prefer if the api changed so that nullable arguments
are replaced with an Optional<value>.

We've been experimenting using Java 8's Optional<> in our project, and we have mixed feelings. It may be useful in some circumstances, but our tentative opinion is that not quite a panacea. And if you don't propagate its use throughout the framework, its benefit is diminished, because you have to keep converting back and forth between nullable and Optional<> paradigms.

But even accepting the value of Optional<>, its use won't obviate the need for null checking, as we'll need to check the Optional<> instances themselves for null before storing them for later. So we'll still need something like Guava's Preconditions.checkNotNull().

Garret

Reply via email to