[jdk19] RFR: 8290455: jck test api/java_lang/foreign/VaList/Empty.html fails on some platforms

Maurizio Cimadamore mcimadamore at openjdk.org
Thu Jul 21 12:15:45 UTC 2022


The javadoc for `Linker` states that some operations throw `UnsupportedOperationException` when called on an unsupported platform. These operations are:

* `Linker::nativeLinker`
* `VaList::empty`
* `VaList::make`
* `VaList::ofAddress`

While the code throws an UOE as required, since the exception is thrown in a static initialized, it gets wrapped in an `ExceptionInInitializerError`.

The solution is to set the `CABI` value to `null` if the platform is unknown. Then, when clients call the `CABI.current()` method, we can throw at that point, which will result in the behavior requested by the API spec.

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

Commit messages:
 - Add test
 - Initial push

Changes: https://git.openjdk.org/jdk19/pull/150/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk19&pr=150&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8290455
  Stats: 89 lines in 3 files changed: 67 ins; 7 del; 15 mod
  Patch: https://git.openjdk.org/jdk19/pull/150.diff
  Fetch: git fetch https://git.openjdk.org/jdk19 pull/150/head:pull/150

PR: https://git.openjdk.org/jdk19/pull/150


More information about the core-libs-dev mailing list