RFR: 8340145: Problem with generic pattern matching results in internal compiler error

Aggelos Biboudis abimpoudis at openjdk.org
Mon Oct 21 12:07:23 UTC 2024


In the following code, when calculating recursively the covered binding patterns, the nested case assumed that the direct supertype of `T2` will always be represented by a `ClassSymbol`. This PR intervenes the erasure calculation.


static <T, T2 extends T> T unwrapOrElse(Option<T2> option, T defaultValue) {
  return switch (option) {
     case Option.Some(T2 value) -> value;
     case Option.None<T2> _ -> defaultValue;
  };
}

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

Commit messages:
 - 8340145: Problem with generic pattern matching results in internal compiler error

Changes: https://git.openjdk.org/jdk/pull/21606/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=21606&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8340145
  Stats: 50 lines in 2 files changed: 49 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/21606.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21606/head:pull/21606

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


More information about the compiler-dev mailing list