RFR: 7903877: jextract exception handling in downcall wrappers

Nizar Benalla nbenalla at openjdk.org
Mon Apr 28 15:29:00 UTC 2025


On Mon, 28 Apr 2025 13:28:28 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> Can I please get a review for this patch to improve the exception handling in downcall wrappers, if the exception is reachable then throwing an exception is better than catching an exception and turning them into an `AssertionError`.
>> 
>> TIA
>
> test/jtreg/generator/reachableException/TestReachableException.java line 106:
> 
>> 104:             Class<?> exceptionClass = future.get(5, TimeUnit.SECONDS);
>> 105:             assertEquals(WrongThreadException.class, exceptionClass,
>> 106:                     "Exception should be WrongThreadException, not wrapped in AssertionError");
> 
> Isn't this already checked by `testWrongThreadAccess`?

`testWrongThreadAccess` is meant to check that an exception is thrown and `testExceptionType` checks that it was a `WrongThreadException`.

I could make the check `assertInstanceOf(WrongThreadException.class, thrown` more lenient

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

PR Review Comment: https://git.openjdk.org/jextract/pull/282#discussion_r2063919622


More information about the jextract-dev mailing list