On Thu, 28 Aug 2025 17:45:30 GMT, Chen Liang <li...@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 with a new target base due to a merge 
> or a rebase. The incremental webrev excludes the unrelated changes brought in 
> by the merge/rebase. The pull request contains six additional commits since 
> the last revision:
> 
>  - Update throws clause per CSR review
>  - Merge branch 'master' of https://github.com/openjdk/jdk into 
> doc/constboot-cast
>  - Update wording and rendering again
>  - Merge branch 'master' of https://github.com/openjdk/jdk into 
> doc/constboot-cast
>  - Update and consolidate tests
>  - 8364751: ConstantBootstraps.explicitCast violates doc contracts for 
> null-to-int

src/java.base/share/classes/java/lang/invoke/ConstantBootstraps.java line 414:

> 412:      * @return the converted value
> 413:      * @throws ClassCastException when {@code dstType} is {@code void}; 
> when
> 414:      *         {@code dstType} is reference, and the reference cast 
> fails; or

Suggestion:

     *         {@code dstType} is a reference type, and the reference cast 
fails; or

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/26714#discussion_r2309790161

Reply via email to