RFR: 8305582: Compiler crash when compiling record patterns with var

Vicente Romero vromero at openjdk.org
Thu May 18 16:31:52 UTC 2023


On Tue, 4 Apr 2023 17:34:27 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:

> While `var` is not allowed in record pattern position the compiler was not checking it. This PR address this issue, by introducing the relevant error symbols and error types.
> 
> e.g., `if (o instanceof ColoredPoint(var(var x, var y), var c)) { }`

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 4199:

> 4197:         Type site;
> 4198: 
> 4199:         if (tree.deconstructor == null) {

my question here would be, this situation can only happen if there are `var`(s) in the record pattern?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13331#discussion_r1198031790


More information about the compiler-dev mailing list