RFR: 8364751: ConstantBootstraps.explicitCast contradictory specification for null-to-primitive
Chen Liang
liach at openjdk.org
Sun Aug 10 01:17:54 UTC 2025
ConstantBootstraps.explicitCast behaves like a snippet of code in its specification. However, in the rest of the nominal spec, it incorrectly assumes a null `value` and a primitive `dstType` results in a ClassCastException instead of the zero value of that primitive type. This is inconsistent with that snippet and the actual code behavior.
The specification is fixed, the test for `explicitCast` is merged into the main `ConstantBootstraps` test, and a new unit test case for `value = null` and `dstType = char.class` is added, verifying the outcome is `'u0000'`.
-------------
Commit messages:
- Update and consolidate tests
- 8364751: ConstantBootstraps.explicitCast violates doc contracts for null-to-int
Changes: https://git.openjdk.org/jdk/pull/26714/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26714&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8364751
Stats: 131 lines in 3 files changed: 43 ins; 79 del; 9 mod
Patch: https://git.openjdk.org/jdk/pull/26714.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/26714/head:pull/26714
PR: https://git.openjdk.org/jdk/pull/26714
More information about the core-libs-dev
mailing list