Integrated: 8375571: Compiler crash when using record pattern matching with a generic type parameter shadowing a record class
Jan Lahoda
jlahoda at openjdk.org
Fri Jan 30 06:18:38 UTC 2026
On Mon, 26 Jan 2026 09:06:19 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
> Consider code like:
>
> <T> void typeVarTest(T p) {
> if (p instanceof T(int i) && i == 0); //T is a type variable
> }
>
>
> The `T` in the deconstruction pattern will be resolve to `TypeVariableSymbol`, which has kind `TYP`, but is not `ClassSymbol`, so the cast will fail. Using `instanceof ClassSymbol` would work better, which is what this PR is doing.
This pull request has now been integrated.
Changeset: 9fef14a6
Author: Jan Lahoda <jlahoda at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/9fef14a6d3124fae3ad8b24dac5103aa611d4edb
Stats: 30 lines in 3 files changed: 7 ins; 1 del; 22 mod
8375571: Compiler crash when using record pattern matching with a generic type parameter shadowing a record class
Reviewed-by: vromero
-------------
PR: https://git.openjdk.org/jdk/pull/29407
More information about the compiler-dev
mailing list