RFR: 8298590: Refactor LambdaForm constructors

Jorn Vernee jvernee at openjdk.org
Mon Dec 12 18:31:36 UTC 2022


Refactor LambdaForm constructors into static factories.

In the new code, there's only 1 constructor, which simply initializes all fields. Multiple factory methods are built on top of this, which add various argument validation/pre-processing and post processing of the constructed lambda forms.

In the LambdaFrom class itself, it is easier to see which LF creation goes through which checks due to names of factory, or if all checks are bypassed by calling the constructor.

New factories can easily be added that bypass all the checks in the existing factories and just call the root constructor if they so wish to (we likely want to add several for lazy lambda form resolution https://bugs.openjdk.org/browse/JDK-8288041).

Additionally: replaced some default values literals with named constants so it's easy to see that it's just the default value for that arg at the call site.

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

Commit messages:
 - minor touch ups
 - Refactor LambdaForm constructors

Changes: https://git.openjdk.org/jdk/pull/11612/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11612&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8298590
  Stats: 97 lines in 8 files changed: 32 ins; 13 del; 52 mod
  Patch: https://git.openjdk.org/jdk/pull/11612.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11612/head:pull/11612

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


More information about the core-libs-dev mailing list