diff options
author | Colin Cross <ccross@android.com> | 2018-10-30 11:12:40 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2018-11-01 15:33:43 -0700 |
commit | 7664db57a53476f84f46128d6258c476433e7734 (patch) | |
tree | 3051722967d7e366594b8c84f1ffb76780985f33 | |
parent | 2942be007a08fd597b9886c23e2298cd40fc08d5 (diff) | |
download | protobuf-javalite-7664db57a53476f84f46128d6258c476433e7734.tar.gz |
Remove unused reference to missing sun.misc.Unsafe method
The copyMemory(byte[], long, byte[], long, long) method doesn't exist
in sun.misc.Unsafe in Android, and leaving the dangling reference
causes soft-verification errors when a jarjar'd version of
libprotobuf-java-lite is included in the bootclasspath:
Soft verification failures in void com.android.framework.protobuf.UnsafeUtil.copyMemory(byte[], long, byte[], long, long)
void com.android.framework.protobuf.UnsafeUtil.copyMemory(byte[], long, byte[], long, long): [0x7] couldn't find method sun.misc.Unsafe.copyMemory ([BJ[BJJ)V
This method is unused in the current open-source implementation of the
protobuf lite runtime, so just remove it for now.
Bug: 117607748
Test: m checkbuild
Change-Id: Iedeeaf6fe4c278300a06a0403bd01e76a17e0cec
-rw-r--r-- | java/core/src/main/java/com/google/protobuf/UnsafeUtil.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java b/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java index 6a4787d1..051fffc9 100644 --- a/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java +++ b/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java @@ -73,10 +73,19 @@ final class UnsafeUtil { UNSAFE.putByte(target, offset, value); } - static void copyMemory( - byte[] src, long srcOffset, byte[] target, long targetOffset, long length) { - UNSAFE.copyMemory(src, srcOffset, target, targetOffset, length); - } + // BEGIN Android-removed + // This method doesn't exist in sun.misc.Unsafe in Android, and leaving the + // dangling reference causes soft-verification errors when a jarjar'd version + // of libprotobuf-java-lite is included in the bootclasspath: + // Soft verification failures in void com.android.framework.protobuf.UnsafeUtil.copyMemory(byte[], long, byte[], long, long) + // void com.android.framework.protobuf.UnsafeUtil.copyMemory(byte[], long, byte[], long, long): [0x7] couldn't find method sun.misc.Unsafe.copyMemory ([BJ[BJJ)V + // This method is unused in the current open-source implementation of the + // protobuf lite runtime, so just remove it for now. + //static void copyMemory( + // byte[] src, long srcOffset, byte[] target, long targetOffset, long length) { + // UNSAFE.copyMemory(src, srcOffset, target, targetOffset, length); + //} + // END Android-removed static long getLong(byte[] target, long offset) { return UNSAFE.getLong(target, offset); |