[jdk20u] RFR: 8301858: Verification error when compiling switch with record patterns

Jan Lahoda jlahoda at openjdk.org
Mon Feb 20 08:36:31 UTC 2023


Original PR:
https://github.com/openjdk/jdk/pull/12438

Description from the original PR:
When unrolling/translating record patterns with an unconditional case, we were translating the last/innermost case to `case null, default` skipping the initialization of a bound variable `o` in the example below:


switch (..) {
  case R1(Object o):
                  return meth_O(o); 
}
=> 
switch (..) {
   case R1: 
      switch(..) {
        case null, default:
                        return meth_O(o);
      }
}


This PR addresses that by emitting the correct label instead of default.

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

Commit messages:
 - Backport 3b05a94c36e5d54693694c2e9950eca42626962b

Changes: https://git.openjdk.org/jdk20u/pull/6/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk20u&pr=6&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8301858
  Stats: 17 lines in 2 files changed: 13 ins; 0 del; 4 mod
  Patch: https://git.openjdk.org/jdk20u/pull/6.diff
  Fetch: git fetch https://git.openjdk.org/jdk20u pull/6/head:pull/6

PR: https://git.openjdk.org/jdk20u/pull/6


More information about the jdk-updates-dev mailing list