[foreign-abi] RFR: 8239780: FunctionDescriptor factories and combinators should check whether return layout is null

Jorn Vernee jvernee at openjdk.java.net
Thu Sep 17 11:59:08 UTC 2020


On Thu, 17 Sep 2020 10:45:28 GMT, Athijegannathan Sundararajan <sundar at openjdk.org> wrote:

>> Hi,
>> 
>> I'm going through the foreign-abi JBS issues and taking care of some of the open ones.
>> 
>> This PR adds null checking to the MemoryLayouts passed to the FunctionDescriptor factories and adapter methods,
>> together with a simple test.
>> I've also added an adapter for dropping the return layout, since with the null check, it is no longer possible to pass
>> `null` to drop the return layout. I think having the explicit check, and a separate combinator for dropping the return
>> layout instead will be better for avoiding accidental nulls being used.  Thanks,
>> Jorn
>
> test/jdk/java/foreign/TestFunctionDescriptor.java line 60:
> 
>> 58:         fd.changeReturnLayout(null); // should throw
>> 59:     }
>> 60:
> 
> Test for dropReturnLayout missing?

I can add that. We don't have any tests that just test FunctionDescriptor currently, so I went only with the tests that
look for the NPE.

I'll add some basic API tests as well.

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

PR: https://git.openjdk.java.net/panama-foreign/pull/330


More information about the panama-dev mailing list