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.

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

Depends on: https://git.openjdk.org/jdk/pull/11019

Commit messages:
 - Refactor cast operator to enum

Changes: https://git.openjdk.org/jdk/pull/11397/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11397&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8297733
  Stats: 82 lines in 2 files changed: 56 ins; 14 del; 12 mod
  Patch: https://git.openjdk.org/jdk/pull/11397.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11397/head:pull/11397

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

Reply via email to