RFR: 8294943: Implement record patterns in enhanced for [v5]

Vicente Romero vromero at openjdk.org
Mon Nov 7 18:09:37 UTC 2022


On Mon, 7 Nov 2022 12:17:29 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Adding a field here seemed like a reasonable compromise to me. It will make `JCEnhancedForLoop` bigger, but presumably, there won't be that many instances of this class. I'd be more concerned if we were adding a new field to all `JCTree`s, `Symbol`s or `Type`s.
>> 
>> Alternatives would include re-computing the element type in `Flow`, which also feels a bit wasteful, or doing exhaustiveness checks in `Attr`, which is tricky, because exhaustiveness is mostly handled in `Flow`.
>
> We also capture fields like these in other cases; e.g. varargs method calls have their `elementType` set, and functional expressions (like lambdas) have their target type set in the same way. So I think this is good.

ok sounds good to me

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

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


More information about the compiler-dev mailing list