apache / datasketches-memory

High performance native memory access for Java.
https://datasketches.apache.org
Apache License 2.0
118 stars 27 forks source link

Remove handles #172

Closed leerho closed 1 year ago

leerho commented 1 year ago

This is the next phase of changes required to make the Java8 code compatible with the Java 17 Panama Foreign Function and Memory Access API. In this phase I had to redesign the hierarchy to eliminate the 8 types of Handles and HandleImpls, because Panama uses a completely different approach. This touched many of the classes.

Also, in this phase I converted nearly all the "asserts" into "checks" (i.e., thrown exceptions). And to improve clarity with these exceptions I converted many of the common IllegalArgumentExceptions into dedicated exceptions that more clearly communicate the cause, e.g., MemoryBoundsException, MemoryCloseException, MemoryInvalidException, ReadOnlyException, etc. Many of these changes impacted the test code, which had to be updated. And in that process I also cleaned up the test code, removing some duplicate or meaningless tests.

There is still more work to be done, specifically I have to remove some of the capabilities that Panama does not support, such as getAndAddLong(..), compareAndSwapLong(..), getAndSetLong(..), putCharsToUtf8(..), etc.

Please bear with me as I complete this overall task.