RFR: 8297733: Refactor Cast binding to enum

Maurizio Cimadamore mcimadamore at openjdk.org
Tue Nov 29 21:30:21 UTC 2022


On Mon, 28 Nov 2022 20:13:35 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> Refactor the cast binding to an enum, which clearly enumerates all supported conversions.
> 
> This also fixes a bug where `java/foreign/normalize/TestNormalize` was failing when running in interpreted mode (`-Djdk.internal.foreign.DowncallLinker.USE_SPEC=false`), for conversions from `int` to `byte` because the `explicitCast` method handle that was used only considers the least significant bit, while we want to look at all of the least significant byte.
> 
> As mentioned in the JBS issue, doing this will also make it easier going forward to support multiple conversions with the same from and to types, but requiring different semantics.
> 
> Testing: jdk_foreign test suite.

Looks good

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

Marked as reviewed by mcimadamore (Reviewer).

PR: https://git.openjdk.org/jdk/pull/11397


More information about the core-libs-dev mailing list