RFR: 8336492: Regression in lambda serialization [v3]

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Jul 29 17:10:38 UTC 2024


On Fri, 26 Jul 2024 20:50:53 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add more docs to CaptureScanner, and make fields private/final
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java line 1239:
> 
>> 1237:                     ret.pos = sym.pos;
>> 1238:                     // Set ret.data. Same as case LOCAL_VAR above.
>> 1239:                     if (sym.isExceptionParameter()) {
> 
> not a change from your patch but, do we really need to set this exception parameter thing for a method param? Also this could be a TypeMetadata. Also, there is no test affected if this `if` with its block is removed so either unnecessary, me thinks, or we need more tests

I'm not 100% sure, but eyeballing the code, I see that `sym.isExceptionParameter` is used in the backend (e.g. `Code`) so I'd suspect that a failure in doing this would lead to issues when generating bytecode, which I suspect is why this code was added in the first place. But, while that seems useful for a local variable declared inside a lambda, I don't see how a lambda parameter can itself be an exception parameter...

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

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


More information about the compiler-dev mailing list