Please review this fix for `Set.ofLazy` and `Map.ofLazy` behaviour.

When looking up an object that is equal to a stored candidate but is a 
different instance,
`Set.contains()` and `Map.get()` pass the lookup argument to the computing 
function instead of the stored candidate.

This change stores the candidates in an array and uses the lookup index to 
retrieve the corresponding candidate before calling the computing function.

Regression tests have been added for both `Set` and `Map` to verify that the 
computing function receives the stored candidate.

Tests:
- `LazySetTest`
- `tier1`

---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

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

Commit messages:
 - 8398559: Set.ofLazy evaluates the lookup argument instead of the stored 
candidate

Changes: https://git.openjdk.org/jdk/pull/34144/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=34144&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8398559
  Stats: 41 lines in 3 files changed: 38 ins; 1 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/34144.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/34144/head:pull/34144

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

Reply via email to