What is the right behavior according to JLS when methodReferenceOfNullObject()
is invoked?
- throw a
NullPointerException
(Oracle Java Compiler) or assign supplier to
result
thougho
isnull
(Eclipse Java Compiler)public void methodReferenceOfNullObject() { Object o = nullReference(); Supplier<String> result = o::toString; // <-- point of interest ... } private Object nullReference() { return null; }