RFR: 8336492: Regression in lambda serialization [v5]

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Jul 29 14:31:18 UTC 2024


On Mon, 29 Jul 2024 09:43:49 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java line 405:
>> 
>>> 403: 
>>> 404:             apportionTypeAnnotations(tree,
>>> 405:                     owner::getInitTypeAttributes,
>> 
>> not sure that this is semantically the same as before
>
>> not sure that this is semantically the same as before
> 
> Yeah, this is a bit tricky. Basically, the issue with type annotations is that they are encoded in different places depending on the case. E.g. a local variable inside a static/instance initializer has the type annotation recorded in the _class symbol_ (!!). There's also different methods to fetch type annotations, depending on whether it was a normal type annotation, or one in a static/instance initializer.
> 
> The general idea is that we try to figure out the symbol that "owns" the type annotation while visiting, and then move all lambda annotations from that owner onto the new lambda method symbol.

Should be better after [this push](https://github.com/openjdk/jdk/pull/20349/commits/29910e6c0bae0b75e386169e114a4849ed931436)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20349#discussion_r1695337011


More information about the compiler-dev mailing list