davisusanibar commented on code in PR #37723:
URL: https://github.com/apache/arrow/pull/37723#discussion_r1434385293
##########
java/memory/memory-core/src/main/java/org/apache/arrow/memory/ArrowBuf.java:
##########
@@ -736,7 +739,7 @@ public void getBytes(long index, byte[] dst, int dstIndex,
int length) {
if (length != 0) {
// copy "length" bytes from this ArrowBuf starting at addr(index) address
// into dst byte array at dstIndex onwards
- MemoryUtil.UNSAFE.copyMemory(null, addr(index), dst,
MemoryUtil.BYTE_ARRAY_BASE_OFFSET + dstIndex, length);
+ MemoryUtil.copyMemory(null, addr(index), dst,
MemoryUtil.BYTE_ARRAY_BASE_OFFSET + dstIndex, length);
Review Comment:
Sure, when we implement CheckerFramework then at compile time some
validation are executed (eg: nullness validation). This is the example of error
message when we are trying to consume Unsafe library.
```
arrow-memory-core: Compilation failure
[ERROR]
/java/memory/memory-core/src/main/java/org/apache/arrow/memory/ArrowBuf.java:[740,35]
error: [argument] incompatible argument for parameter srcBase of
Unsafe.copyMemory.
[ERROR] found : null (NullType)
[ERROR] required: @Initialized @NonNull Object
```
We are not in a position to fork or modify the third dependency, so we need
to add some kind of @SuppressWarning annotation.
Because UNSAFE.copyMemory is used at several places, we create a proxy and
apply the exclusion in MemoryUtil.copyMemory, which then calls
UNSAFE.copyMemory.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]