Use long instead of int for address in DirectByteBuffer constructor
This allows the code to be used on 64-bit platforms.
(cherry picked from commit 9ce6a2533b50ffcd24b8b10bae7f234042768819)
Change-Id: Icc5248d8ea276a451b32ecc91b47aeb977e8f21c
diff --git a/luni/src/main/java/java/nio/DirectByteBuffer.java b/luni/src/main/java/java/nio/DirectByteBuffer.java
index 43db9e0..1d12f2e 100644
--- a/luni/src/main/java/java/nio/DirectByteBuffer.java
+++ b/luni/src/main/java/java/nio/DirectByteBuffer.java
@@ -44,7 +44,7 @@
}
// Used by the JNI NewDirectByteBuffer function.
- DirectByteBuffer(int address, int capacity) {
+ DirectByteBuffer(long address, int capacity) {
this(MemoryBlock.wrapFromJni(address, capacity), capacity, 0, false, null);
}
diff --git a/luni/src/test/java/libcore/java/nio/BufferTest.java b/luni/src/test/java/libcore/java/nio/BufferTest.java
index a4e5eaf..ae90d49 100644
--- a/luni/src/test/java/libcore/java/nio/BufferTest.java
+++ b/luni/src/test/java/libcore/java/nio/BufferTest.java
@@ -715,7 +715,7 @@
public void testHasArrayOnJniDirectByteBuffer() throws Exception {
// Simulate a call to JNI's NewDirectByteBuffer.
Class<?> c = Class.forName("java.nio.DirectByteBuffer");
- Constructor<?> ctor = c.getDeclaredConstructor(int.class, int.class);
+ Constructor<?> ctor = c.getDeclaredConstructor(long.class, int.class);
ctor.setAccessible(true);
ByteBuffer bb = (ByteBuffer) ctor.newInstance(0, 0);