RFR (S) 8073479: Replace obj.getClass hacks with Objects.requireNonNull

Aleksey Shipilev aleksey.shipilev at oracle.com
Thu Feb 19 15:16:29 UTC 2015


Okay, I see
 https://bugs.openjdk.java.net/browse/JDK-8042127

...but there is no analysis what's actually going on, so I tend to doubt
what the issue is about. Let me quickly follow up there.

-Aleksey.

On 02/19/2015 06:05 PM, Vitaly Davidovich wrote:
> There was a thread some months back on this and I think it was shown
> that profile pollution does impact this.  If the requireNonNull sees
> nulls it won't use implicit null check.
> 
> sent from my phone
> 
> On Feb 19, 2015 10:03 AM, "Aleksey Shipilev"
> <aleksey.shipilev at oracle.com <mailto:aleksey.shipilev at oracle.com>> wrote:
> 
>     Hi Peter,
> 
>     On 02/19/2015 05:59 PM, Peter Levart wrote:
>     > On 02/19/2015 03:51 PM, Aleksey Shipilev wrote:
>     >> Hi,
>     >>
>     >> Please review and sponsor this cleanup fix:
>     >>    http://cr.openjdk.java.net/~shade/8073479/webrev.00/
>     <http://cr.openjdk.java.net/%7Eshade/8073479/webrev.00/>
>     >>    https://bugs.openjdk.java.net/browse/JDK-8073479
>     >>
>     >> Summary: use Objects.requireNonNull instead of object.getClass to
>     check
>     >> for nullity.
>     >>
>     >> Testing:
>     >>    - jdk9-dev build on Linux x86_64/release
>     >>    - JPRT (modulo some freetype and javac failures)
>     >>
>     >> Thank you,
>     >> -Aleksey.
>     >>
>     >> P.S. I am going to submit another one against langtools, should it be
>     >> reviewed on this list as well?
>     >>
>     >
>     > Hi Aleksey,
>     >
>     > Is profile pollution problem already fixed? Can Objects.requireNonNull
>     > be used in performance critical code without fear of performance
>     > regression?
> 
>     What profile pollution? Objects.requireNonNull is a static method. See
>     also the link in bug description:
>       http://cr.openjdk.java.net/~shade/scratch/NullChecks.java
>     <http://cr.openjdk.java.net/%7Eshade/scratch/NullChecks.java>
> 
>     -Aleksey.
> 





More information about the core-libs-dev mailing list