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). ------------- Commit messages: - 8397218: Remove Preview Implementation for Primitive Types in Patterns, instanceof, and switch Changes: https://git.openjdk.org/jdk/pull/33919/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=33919&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8397218 Stats: 5082 lines in 71 files changed: 722 ins; 4221 del; 139 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
