Any::isNull check

Vitaly Davidovich vitalyd at gmail.com
Wed Dec 16 15:42:01 UTC 2015


What's the use case of using Any.isNull when you don't know you're working
with reference types? I'd expect comparison would be x.equals(T.default) in
the generic context.

On Wednesday, December 16, 2015, Paul Benedict <pbenedict at apache.org> wrote:

> When a method is specialized for values, Any::isNull can only return
> "false", which means if(Any.isNull(o)) can only ever have one outcome --
> the other code branch can be discarded by the compiler. I know it's too
> early to talk about optimizations :-) but will javac be smart enough to
> recognize this optimization? Is it on your list for the future?
>
> Cheers,
> Paul
>


-- 
Sent from my phone


More information about the valhalla-dev mailing list