RFR: 8305582: Compiler crash when compiling record patterns with var [v2]

Aggelos Biboudis abimpoudis at openjdk.org
Fri May 19 09:18:52 UTC 2023


On Thu, 18 May 2023 16:28:47 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add more tests
>
> 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?

I think so, yes:

https://github.com/openjdk/jdk/blob/master/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L846-L869

Initially I thought I could capture this situation before line 816, but then I wouldn't be able to flow an erroneous type from parsing (`types.createErrorType(tree.record.type);`).

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

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


More information about the compiler-dev mailing list