RFR: 8221723: Avoid storing zero to String.hash
Claes Redestad
claes.redestad at oracle.com
Mon Apr 1 13:33:24 UTC 2019
On 2019-04-01 15:28, Claes Redestad wrote:
> On 2019-04-01 15:17, Pavel Rappo wrote:
>>> On 1 Apr 2019, at 13:36, Claes Redestad <claes.redestad at oracle.com>
>>> wrote:
>>>
>>> Makes sense?
>>
>> It does, thanks. I wonder though what portion of strings in a typical
>> app has a
>> calculated `hash` of 0? My naive estimate would be 1E-9. Unless I'm
>> mistaken,
>> is that really of concern?
>>
>
> Specifically I'm looking at an archiving RFE that is blocked by the fact
> that interned empty String literals loses identity when archived and
> reconstituted, and there exists code that does identity comparisons on
> such interned empty String, e.g.:
>
> http://hg.openjdk.java.net/jdk/jdk/file/d02f1f4ff3a6/src/java.base/share/classes/java/util/ResourceBundle.java#l3455
>
RFE in question: https://bugs.openjdk.java.net/browse/JDK-8221701
Technically we could special-case the empty String, but I much prefer
a more general solution like this + JDK-8221724
/Claes
More information about the core-libs-dev
mailing list