JDK-8291769 : Translation of switch with record patterns could be improved
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 20
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-08-03
  • Updated: 2025-07-19
  • Resolved: 2022-12-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 20
20 b27Fixed
Related Reports
Causes :  
Description
Currently, record patterns in switches are implemented effectively as guards. This does not scale very well for long switches, where the same evaluations may be done many times. It would be better to factor out the common prefixes, and created nested switches.
Comments
Changeset: 2300ed45 Author: Jan Lahoda <jlahoda@openjdk.org> Date: 2022-12-05 12:04:23 +0000 URL: https://git.openjdk.org/jdk/commit/2300ed458dcda568afad818d2d3133e545a58ad5
05-12-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/9746 Date: 2022-08-04 14:55:43 +0000
04-08-2022