RFR: 8292914: Introduce a system property that enables stable names for lambda proxy classes [v3]
Strahinja Stanojevic
duke at openjdk.org
Tue Oct 18 07:31:07 UTC 2022
On Thu, 15 Sep 2022 11:50:57 GMT, Strahinja Stanojevic <duke at openjdk.org> wrote:
>> This PR introduces a system property that creates stable names for the lambda classes in the JDK. Instead of using an atomic counter in the lambda name, we can use a 32-bit hash after `$$Lambda$`. Thus, the name becomes `lambdaCapturingClass$$Lambda$hashValue`.
>> Parameters used to create a stable part of the name (hash value) are a superset of the parameters used for lambda class archiving when the CDS dumping option is enabled. During the stable name creation process,
>> all the common parameters are in the same form as in the low-level implementation (C part of the code) of the archiving process.
>> We concatenate all of those parameters in one string `hashData`. We calculate the long hash value for `hashData` in the same manner as the `java.lang.StringUTF16#hashCode` does, and then we hash that value using `Long.toString(longHashValue, Character.MAX_RADIX)`. The desired length for this hash is equal to the length of the `Long.toString(Long.MAX_VALUE, Character.MAX_RADIX)`.
>> Sometimes, the calculated hash value is shorter than the desired length, so we pad it with the character `#` to hit it. Appending `#` only affects the hash length, but not its stability.
>>
>> Link to the related issue: https://bugs.openjdk.org/browse/JDK-8292914
>
> Strahinja Stanojevic has updated the pull request incrementally with one additional commit since the last revision:
>
> Add additional parameter to hashCode, because in Scala, lambda can be serializable without implementing Serializable interface
Hello, any news regarding this PR? Is there anything else I should do on my side?
-------------
PR: https://git.openjdk.org/jdk/pull/10024
More information about the core-libs-dev
mailing list