[jdk20] RFR: 8300195: Fall-through issue occurs when using record pattern in switch statements [v2]

Jan Lahoda jlahoda at openjdk.org
Wed Jan 18 10:29:36 UTC 2023


> When converting pattern matching switches, cases with common prefix tests are factored out into separate sub-switches. But, when this happens, the cases generated are the statement cases, even if the original cases where rule cases. So, this may lead to an unintended fall through. The proposal here is to inject breaks with correct targets as needed.
> 
> Alternatively, we could keep the kind of the cases, but that is more tricky, as the cases must break the main switch, not the nested ones.

Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:

  Fixing test on Windows.

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

Changes:
  - all: https://git.openjdk.org/jdk20/pull/109/files
  - new: https://git.openjdk.org/jdk20/pull/109/files/4f7b2fa3..5ecb6eda

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

  Stats: 3 lines in 1 file changed: 2 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk20/pull/109.diff
  Fetch: git fetch https://git.openjdk.org/jdk20 pull/109/head:pull/109

PR: https://git.openjdk.org/jdk20/pull/109


More information about the compiler-dev mailing list