RFR: 8364751: ConstantBootstraps.explicitCast contradictory specification for null-to-primitive [v4]
Chen Liang
liach at openjdk.org
Fri Aug 29 14:38:55 UTC 2025
On Fri, 29 Aug 2025 13:37:23 GMT, Chen Liang <liach at openjdk.org> wrote:
>> 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'`.
>
> Chen Liang has updated the pull request incrementally with one additional commit since the last revision:
>
> Update src/java.base/share/classes/java/lang/invoke/ConstantBootstraps.java
>
> Co-authored-by: Jorn Vernee <JornVernee at users.noreply.github.com>
Thanks for the reviews!
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26714#issuecomment-3237248432
More information about the core-libs-dev
mailing list