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 {
|
||||
addressField = Buffer.class.getDeclaredField("address");
|
||||
addressField.setAccessible(true);
|
||||
if (addressField.getLong(ByteBuffer.allocate(1)) != 0) {
|
||||
// A heap buffer must have 0 address.
|
||||
if (addressField.getLong(direct) == 0) {
|
||||
// A direct buffer must have non-zero 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.
|
||||
|
Loading…
Reference in New Issue
Block a user