On Thu, 19 Nov 2026 15:05:32 GMT, Maurizio Cimadamore <[email protected]>
wrote:
>> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java line 4913:
>>
>>> 4911: Type existingPatternType =
>>> types.erasure(existingPattern.type);
>>> 4912: Type currentPatternType =
>>> types.erasure(currentPattern.type);
>>> 4913: if (existingPatternType.isPrimitive() ^
>>> currentPatternType.isPrimitive()) {
>>
>> replace `^` with `!=` ?
>
> There's others too...
It comes verbatim from JDK-8289196: Pattern domination not working properly for
record patterns, committed on 7 July 2022 in
[8dd94a2c14f](https://github.com/openjdk/jdk/commit/8dd94a2c14f7456b3eaf3e02f38d9e114eb8acc3),
before the first primitive patterns preview. JDK-8303374, the first primitive
patterns preview, had already removed the XOR check from Check.patternDominated
so it didn't propagate.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/33919#discussion_r4630648583