> 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:

  Enhance test with lambdas created as method references

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/10024/files
  - new: https://git.openjdk.org/jdk/pull/10024/files/1f551d1d..dd268934

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10024&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10024&range=00-01

  Stats: 30 lines in 2 files changed: 12 ins; 16 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/10024.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10024/head:pull/10024

PR: https://git.openjdk.org/jdk/pull/10024

Reply via email to