On Thu, 22 Jan 2026 11:45:08 GMT, Liam Miller-Cushon <[email protected]> wrote:

>> See [JDK-8208752: Calling a deserialized Lambda might fail with 
>> ClassCastException](https://bugs.openjdk.org/browse/JDK-8208752).
>> 
>> Lambda deserialization currently does not consider 
>> `SerializedLambda#getInstantiatedMethodType` when deserializing lambdas, 
>> which can lead to method references that differ only in 
>> `getInstantiatedMethodType` being merged into the same lambda instance, and 
>> can result in `ClassCastException`s like the one reported in the bug.
>> 
>> This depends on the fix for [JDK-8374654: Inconsistent handling of lambda 
>> deserialization for Object method references on 
>> interfaces](https://bugs.openjdk.org/browse/JDK-8374654) in 
>> https://github.com/openjdk/jdk/pull/29075.
>
> Liam Miller-Cushon has updated the pull request with a new target base due to 
> a merge or a rebase. The pull request now contains nine commits:
> 
>  - Merge branch 'JDK-8374654' into JDK-8208752
>  - Test cleanup
>  - Updates for --debug=dumpLambdaDeserializationStats
>  - Merge branch 'JDK-8374654' into JDK-8208752
>  - Merge branch 'JDK-8374654' into JDK-8208752
>  - Update test
>  - Merge branch 'JDK-8374654' into JDK-8208752
>  - Don't rely on the iteration order of Map.of entries
>  - 8208752: Calling a deserialized Lambda might fail with ClassCastException

Thanks, I agree with not doing #29075 separately first to avoid a breakage. 
However doing this one first also doesn't work, this change by itself would 
regress `tools/javac/lambda/SerializableObjectMethods.java` and 
`tools/javac/lambda/LambdaLambdaSerialized.java`. Currently those tests rely on 
lambdas being incorrectly merged together, and with this fix they no longer get 
merged because they have different target types, but then they don't 
deserialize because the `getImplClass` doesn't match. Those test failures were 
what led me down the path of that other fix: 
https://bugs.openjdk.org/browse/JDK-8208752?focusedId=14636922&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-14636922

So I think maybe we should just merge both of these changes into a single fix? 
I will update the PR if that makes sense.

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

PR Comment: https://git.openjdk.org/jdk/pull/28943#issuecomment-3785351727

Reply via email to