RFR: 8364991: Incorrect not-exhaustive error [v3]

Vicente Romero vromero at openjdk.org
Wed Oct 15 17:16:29 UTC 2025


On Wed, 15 Oct 2025 13:28:58 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

>> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java line 805:
>> 
>>> 803:             }
>>> 804:             Set<PatternDescription> patterns = patternSet;
>>> 805:             Map<PatternDescription, Set<PatternDescription>> replaces = new IdentityHashMap<>();
>> 
>> why using IdentityHashMap here? won't this imply, potentially, having duplicated info in this map? I'm sure there is a good reason for this but not clear to me at first glance. It seems like we need to preserve like the `position` of the element being replaced.
>> 
>> Also if the implementation depends on this DS we should probably document it.
>
> Yes, the identity map is intentional. It is entirely possible two equivalent types are produced from two different originating pattern sets, and when backtracking, we want to use the correct set. That is achieve by using the identity search. I've added a comment:
> https://github.com/openjdk/jdk/pull/27247/commits/51b7fc283e88ac5947cfebfce6609704c360e235
> 
> Thanks!

thanks for adding the comment!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27247#discussion_r2433326470


More information about the compiler-dev mailing list