> Removes the preview implementation of Primitive Types in Patterns, > `instanceof`, and `switch` from JDK 28. The withdrawn feature is rejected > even with `--enable-preview`. > > The compiler changes restore the pre-preview rules while preserving > subsequent fixes (listed on the CSR). JShell, diagnostics, and affected > regression tests are updated accordingly. > > I would like to explicitely mention the two components described on the CSR > (for symmetry): > > 1. `SwitchBootstraps.typeSwitch` no longer performs exact numeric conversions > or accepts `Long`, `Float`, `Double`, or `Boolean` constant labels. It also > rejects `void.class` labels. Primitive selector descriptors and primitive > class labels remain accepted through boxing and matching via their wrapper > classs, preserving compatibility with non-preview record-pattern binaries > generated by JDK 23-27. I documented this in the JavaDoc of `typeSwitch` as > well. This behavior is tested anew in > `SwitchBootstrapsTest::testPrimitiveTypeCompatibility` and > `NoPrimitivesAsCaseLabelsFor21::findPrimitiveBootstrapArguments`. > > 1. `ExactConversionsSupport` and all its public methods are retained; > references to the withdrawn preview specification are removed. > > Since this removal is not merely a `git revert`. The removal preserves the > fixes. The restored rules are adapted to the current compiler. No > functionality should be lost. > > Among the tests there is a new one `PrimitivePatternsRemoved` covering all > eight primitive types, extended `instanceof` forms. It runs with preview > disabled and enabled, and with `--release 21` and `22`. > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai).
Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision: Address review ------------- Changes: - all: https://git.openjdk.org/jdk/pull/33919/files - new: https://git.openjdk.org/jdk/pull/33919/files/d73128ae..c9ff88e9 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=33919&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=33919&range=00-01 Stats: 36 lines in 5 files changed: 16 ins; 16 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/33919.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/33919/head:pull/33919 PR: https://git.openjdk.org/jdk/pull/33919
