The null check will be removed as part of the next jsr166 integration.
http://cr.openjdk.java.net/~martin/webrevs/jdk/jsr166-integration/miscellaneous/index.html
On Wed, Jul 4, 2018 at 2:42 AM, Zheka Kozlov wrote:
> I noticed dead code in java.util.HashMap.merge():
>
> public V merge(K key, V va
On 07/04/2018 09:22 AM, Zheka Kozlov wrote:
> Oh yes, you are right. Then this is not dead code, just a useless null
> check.
My vague recollection is that the check was there to ensure that the
block was identical to those in the other methods when considering ways
to factor it out (none of which
Just as a note, it is reasonable to make value “final” so that value can not be
nulled out between the test and its use.
Cheers,
— Jim
> On Jul 4, 2018, at 10:22 AM, Zheka Kozlov wrote:
>
> Oh yes, you are right. Then this is not dead code, just a useless null
> check.
>
> 2018-07-04 19:55
Oh yes, you are right. Then this is not dead code, just a useless null
check.
2018-07-04 19:55 GMT+07:00 Scott Palmer :
> On Jul 4, 2018, at 5:42 AM, Zheka Kozlov wrote:
> >
> > I noticed dead code in java.util.HashMap.merge():
> >
> > public V merge(K key, V value,
> > BiFunct
On Jul 4, 2018, at 5:42 AM, Zheka Kozlov wrote:
>
> I noticed dead code in java.util.HashMap.merge():
>
> public V merge(K key, V value,
> BiFunction
> remappingFunction) {
>if (value == null)
>throw new NullPointerException();
>
>...
>
>if (value != null)
I noticed dead code in java.util.HashMap.merge():
public V merge(K key, V value,
BiFunction
remappingFunction) {
if (value == null)
throw new NullPointerException();
...
if (value != null) { *// Condition ' value != null' is always true*
if (t != nu