RFR: 8042906: Remove use of reflection in ORB
Daniel Fuchs
daniel.fuchs at oracle.com
Mon May 12 12:46:58 UTC 2014
Hi Mark,
AFAIKS computeIfAbsent does what we want:
<http://docs.oracle.com/javase/8/docs/api/java/util/Map.html#computeIfAbsent-K-java.util.function.Function->
It seems that putIfAbsent would not though. This is indeed confusing.
I wish putIfAbsent had been specified similarly to
computeIfAbsent...
best regards,
-- daniel
ConcurrentHashMap seems to have something more
On 5/12/14 1:33 PM, Mark Sheppard wrote:
> If I read the javdoc correctly neither computeIfAbsent nor putIfAbsent
> seem to match the
> previous semantics of the if statement?
>
> computeIfAbsent: "If the value for the specified key is present and
> non-null, attempts to compute a new mapping given the key and its
> current mapped value."
> or
> "If the specified key is not already associated with a value (or is
> mapped to |null|), attempts to compute its value using the given mapping
> function and enters it into this map unless |null|. "
> my interpretation is this is relevant if value if there exist a value
> and you want to update?
>
> putIfAbsent: "If the specified key is not already associated with a
> value (or is mapped to |null|) associates it with the given value and
> returns |null|, else returns the current value."
> in this case we can have null value returned
>
> previous semantics were if the PM doesn't exist then instantiate and
> cache it in the hashtable. return the PM - no null value returned
>
> maybe I'm misinterpreting the docs
>
> regards
> Mark
> On 12/05/2014 08:52, Seán Coffey wrote:
>> Good tip Alan/Chris.
>>
>> I'll make that change and push.
>>
>> Regards,
>> Sean.
>>
>> On 12 May 2014 07:17:04 GMT+01:00, Alan Bateman
>> <Alan.Bateman at oracle.com> wrote:
>>> On 11/05/2014 21:56, Seán Coffey wrote:
>>>> Now that JDK 8 is the official build bootstrap JDK for JDK 9, we can
>>>> remove use of reflection in ORB code to access the applet context.
>>>>
>>>> bug report : https://bugs.openjdk.java.net/browse/JDK-8042906
>>>> webrev : http://cr.openjdk.java.net/~coffeys/webrev.8042906/webrev/
>>> I agree with Chris that computeIfAbsent is best here, that was also the
>>>
>>> suggestion back in early April before the bootstrapping issue came up.
>>> In any case, it's good you are re-visiting this to clean it up.
>>>
>>> -Alan
>
More information about the core-libs-dev
mailing list