[foreign-memaccess] Integrated: 8256466: MemoryLayout factories do not guard against null layouts
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Fri Nov 20 18:03:16 UTC 2020
On Thu, 19 Nov 2020 17:11:49 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> After starting some of the work to improve NPE handling on foreign-abi, I realized that what I was doing was indeed mechanical, and very amenable to a single, centralized test which sends null into all reference-accepting API methods.
>
> The new test, `TestNull` takes care of this task; it is much easier to maintain, as, moving forward, we only need to add new classes to the tests, or add methods to the exclude list.
>
> For each method featuring at least one reference type, the test creates some default values for the non-reference parameters, and then a bunch of replacements for the reference parameter. The replacement could simply be `null`, but in the case of arrays and collections more complex replacements are provided (e.g. arrays and collections with null elements).
>
> Both replacements and default values can be easily added by tweaking some of the test static initializers. An exclusion list is also provided for those APIs which are deliberately null-friendly.
>
> This patch also reverts the test changes from yesterday's PR, and also some of the null-related tests which has been added in the past.
This pull request has now been integrated.
Changeset: cbdce31b
Author: Maurizio Cimadamore <mcimadamore at openjdk.org>
URL: https://git.openjdk.java.net/panama-foreign/commit/cbdce31b
Stats: 554 lines in 14 files changed: 226 ins; 327 del; 1 mod
8256466: MemoryLayout factories do not guard against null layouts
Reviewed-by: jvernee, chegar
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/397
More information about the panama-dev
mailing list