RFR: 8354323: Safeguard SwitchBootstraps.typeSwitch when used outside the compiler [v2]
Aggelos Biboudis
abimpoudis at openjdk.org
Tue May 13 09:25:12 UTC 2025
On Tue, 13 May 2025 09:14:28 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java line 725:
>>
>>> 723:
>>> 724: private static boolean isNotValidPair(Class<?> selectorType, Object caseLabel) {
>>> 725: return (selectorType == boolean.class && caseLabel != boolean.class && caseLabel != Boolean.class) ||
>>
>> What happens if `caseLabel` is a reference class? E.g. a `boolean` selector is incompatible with `String`.
>
> `(selectorType == boolean.class && caseLabel != boolean.class && caseLabel != Boolean.class)` -> true so it is not a valid pair. Do you think it is wrong?
e.g., https://github.com/openjdk/jdk/pull/25090/commits/7b030bee3e23206c030970f6c24be3bcb5241361
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25090#discussion_r2086343743
More information about the core-libs-dev
mailing list