RFR: 7903656: Variadic invoker class names are not mangled

Jorn Vernee jvernee at openjdk.org
Fri Feb 9 11:26:04 UTC 2024


On Fri, 9 Feb 2024 08:52:55 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> This PR fixes an issue with the variadic invoker nested class names that are not mangled correctly. This might create issues for case-insensitive file systems.
>> 
>> While working on this, I noticed also that the current test we have for variadic classes (TestPrintf) was not executing as expected, because of a typo in a data provider. After fixing the test code, the test started to fail.
>> 
>> One of the test cases was expecting an `IllegalArgumentException` when passing an int value to a double variadic parameter. But, as we use a method handle argument spreader, no exception is throw, and the value is instead silently converted. I tweaked the test a bit, to create a situation where no conversion is possible, and I noticed that the call failed with `ClassCastException`, but that exception is not handled by the variadic invoker code, so I fixed that as well.
>
> src/main/java/org/openjdk/jextract/impl/HeaderFileBuilder.java line 593:
> 
>> 591: 
>> 592:     private String newHolderClassName(String javaName) {
>> 593:         String holderClassName = javaName;
> 
> Strictly speaking, this change is not necessary - but since we emit nested classes with same name as other members for variadic functions too, I don't really see a reason to append the `$constant` prefix to the nested constant class here.

I agree. As long as we can de-conflict the names with extra `$` it should be fine.

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

PR Review Comment: https://git.openjdk.org/jextract/pull/203#discussion_r1484188518


More information about the jextract-dev mailing list