RFR: 8294942: Compiler implementation for Record Patterns (Second Preview)
Jan Lahoda
jlahoda at openjdk.org
Sun Oct 30 18:52:32 UTC 2022
This is a partial implementation of [JEP 432: Record Patterns (Second Preview)](https://openjdk.org/jeps/432) and [JEP 433: Pattern Matching for switch (Fourth Preview)](https://openjdk.org/jeps/433). Namely, it implements:
- removal of named record patterns
- (preview) type inference for type test and record patterns
- cleaner switch case specification (e.g. no combination of `null` constants and type test patterns)
- fixing exhaustiveness of certain switches
The patch does not contain support for record patterns in enhanced for statements, that is [part of a separate pull request](https://github.com/openjdk/jdk/pull/10798).
For more information on the changes please see:
- the JEPs: [JEP 432](https://openjdk.org/jeps/432) and [JEP 433](https://openjdk.org/jeps/433)
- the CSRs: [JEP 432 - JDK-8294944](https://bugs.openjdk.org/browse/JDK-8294944) and [JEP 433 - JDK-8294946](https://bugs.openjdk.org/browse/JDK-8294946)
- the current [specification draft](https://cr.openjdk.java.net/~gbierman/jep432%2b433/jep432+433-20221018/specs/patterns-switch-record-patterns-jls.html#jls-14.14.2) (note the draft does not yet include details on type inference)
Any feedback is welcome.
Thanks!
-------------
Commit messages:
- Fixing test.
- Cleanup.
- Some more cleanup.
- Various cleanup and adjustments to specification updates.
- 8294942: Compiler implementation for Record Patterns (Second Preview)
Changes: https://git.openjdk.org/jdk/pull/10814/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10814&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8294942
Stats: 1465 lines in 38 files changed: 1081 ins; 277 del; 107 mod
Patch: https://git.openjdk.org/jdk/pull/10814.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/10814/head:pull/10814
PR: https://git.openjdk.org/jdk/pull/10814
More information about the compiler-dev
mailing list