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,15 +62,10 @@ final class PlatformDependent0 {
|
||||
try {
|
||||
addressField = Buffer.class.getDeclaredField("address");
|
||||
addressField.setAccessible(true);
|
||||
if (addressField.getLong(ByteBuffer.allocate(1)) != 0) {
|
||||
// A heap buffer must have 0 address.
|
||||
addressField = null;
|
||||
} else {
|
||||
if (addressField.getLong(direct) == 0) {
|
||||
// A direct buffer must have non-zero address.
|
||||
addressField = null;
|
||||
}
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
// Failed to access the address field.
|
||||
addressField = null;
|
||||
|
Loading…
Reference in New Issue
Block a user