Both the Foreign Memory Access and the Foreign Linker APIs leave something to be desired when it comes to handling NPEs - first, most of the API javadoc is oblivious to NPEs being thrown. Secondly, not all API method implementations add expicit NPE checks - with the result of NPE often being thrown very deep in the call chain - if at all. Third, test for API coverage of nulls is ad-hoc.
This patch rectifies all these issues. To increase coverage for null injected into APIs, this patch introduces a new framework for testing an API in bulk, so that all methods are reflectively called with some values replaced with nulls, so that all combinations are tried. I've also added, as part of this patch, a test to cover the statics in MemoryAccess which were not covered throughly. ------------- Commit messages: - Add NPE checks in foreign ABI - Merge branch 'master' into npe-fixes - Fix memory access NPEs cont'd - Fix memory access NPEs - Merge branch 'master' into npe-fixes - make base() method abstract in HeapMemorySegmentImpl - Create specialized subclasses for all the heap segment cases Changes: https://git.openjdk.java.net/jdk/pull/1388/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1388&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8256865 Stats: 1111 lines in 32 files changed: 939 ins; 137 del; 35 mod Patch: https://git.openjdk.java.net/jdk/pull/1388.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/1388/head:pull/1388 PR: https://git.openjdk.java.net/jdk/pull/1388