RFR: 8262889: Compiler implementation for Record Patterns [v4]

Vicente Romero vromero at openjdk.java.net
Mon May 9 15:12:03 UTC 2022


On Fri, 6 May 2022 17:40:25 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

>> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 4217:
>> 
>>> 4215:         }
>>> 4216:         ListBuffer<BindingSymbol> outBindings = new ListBuffer<>();
>>> 4217:         List<Type> recordTypes = expectedRecordTypes;
>> 
>> nit: probably a matter of style but why not reusing the already declared `expectedRecordTypes` declaring a new variable seems unnecessary
>
> Please note the full `expectedRecordTypes` are used for error reporting, but the reference to `List` in `recordTypes` is overwritten in the loop (at the time of an error report, it may not longer point to the full expected types, and hence cannot be used for error reporting).

Ok I see, thanks

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

PR: https://git.openjdk.java.net/jdk/pull/8516


More information about the compiler-dev mailing list