RFR: 8209633: Avoid creating WeakEntry wrappers when looking up cached MethodType (original) (raw)

mandy chung mandy.chung at oracle.com
Fri Aug 17 17:07:55 UTC 2018


On 8/17/18 7:38 AM, Peter Levart wrote:

On 08/17/2018 04:32 PM, Claes Redestad wrote: Hi Peter,

On 2018-08-17 16:04, Peter Levart wrote: Hi Claes,

Nice trick.

+1

You made MethodType(s) and WeakEntry(s) holding them equal, respecting the equals()/hashCode() contract. When WeakEntry looses the referent it is left equal to itself only, which is enough for expunging it from map.

Good summary. Do you think we need a few comments to spell out these intricacies? Yes, perhaps just pointers from the two equals() methods to each other, explaining that they are actually one method which is split into two unrelated classes.

It'd be worth to document this as javadoc of these two equals methods (that's probably what you are thinking).

Mandy



More information about the core-libs-dev mailing list