Removed HeapByteBuffer address field check.
Motivation: In JDK9 heap byte buffers have an address field, so we have to remove the current check as it is invalid in JDK9. Modifications: Removed the address field check for heap byte buffers. Result: Netty continues to find sun.misc.Unsafe in JDK9 as in previous JDKs.
This commit is contained in:
parent
9d933091bf
commit
8780062a43
@ -62,14 +62,9 @@ final class PlatformDependent0 {
|
|||||||
try {
|
try {
|
||||||
addressField = Buffer.class.getDeclaredField("address");
|
addressField = Buffer.class.getDeclaredField("address");
|
||||||
addressField.setAccessible(true);
|
addressField.setAccessible(true);
|
||||||
if (addressField.getLong(ByteBuffer.allocate(1)) != 0) {
|
if (addressField.getLong(direct) == 0) {
|
||||||
// A heap buffer must have 0 address.
|
// A direct buffer must have non-zero address.
|
||||||
addressField = null;
|
addressField = null;
|
||||||
} else {
|
|
||||||
if (addressField.getLong(direct) == 0) {
|
|
||||||
// A direct buffer must have non-zero address.
|
|
||||||
addressField = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
// Failed to access the address field.
|
// Failed to access the address field.
|
||||||
|
Loading…
Reference in New Issue
Block a user