Open ben-manes opened 1 year ago
I see, the code is currently shared between primitive types and object types. Probably adding a conditional check for null would solve the problem.
(Provided that all that stuff is entirely unnatural and I'm perfectly sure everybody is carefully avoiding relying on those dark corners of the API.)
This was shown in a recent Java Collections Puzzlers. The JavaDoc for
Map.putIfAbsent
states the following.The
computeIfAbsent
method has similar wording and fails in this scenario.I have requested that this peculiarity of the api be added to Guava's testlib.