Cleanup PlatformDependent* code

Motivation:

PlatformDependent* contains some methods that are not used and some other things that can be cleaned-up.

Modifications:

- Remove unused methods
- cleanup

Result:

Code cleanup.
This commit is contained in:
Norman Maurer 2017-01-17 21:11:01 +01:00
parent d7ff71a3d1
commit 0c4826586f
2 changed files with 5 additions and 16 deletions

View File

@ -519,10 +519,6 @@ public final class PlatformDependent {
return value & 0x1f; return value & 0x1f;
} }
public static void putOrderedObject(Object object, long address, Object value) {
PlatformDependent0.putOrderedObject(object, address, value);
}
public static void putByte(long address, byte value) { public static void putByte(long address, byte value) {
PlatformDependent0.putByte(address, value); PlatformDependent0.putByte(address, value);
} }

View File

@ -27,9 +27,6 @@ import java.nio.Buffer;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.security.AccessController; import java.security.AccessController;
import java.security.PrivilegedAction; import java.security.PrivilegedAction;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import static io.netty.util.internal.ObjectUtil.checkNotNull; import static io.netty.util.internal.ObjectUtil.checkNotNull;
@ -92,7 +89,7 @@ final class PlatformDependent0 {
addressField = (Field) maybeAddressField; addressField = (Field) maybeAddressField;
logger.debug("java.nio.Buffer.address: available"); logger.debug("java.nio.Buffer.address: available");
} else { } else {
logger.debug("java.nio.Buffer.address: unavailable", (Exception) maybeAddressField); logger.debug("java.nio.Buffer.address: unavailable", (Throwable) maybeAddressField);
addressField = null; addressField = null;
} }
} }
@ -155,7 +152,7 @@ final class PlatformDependent0 {
} else { } else {
// Unsafe.copyMemory(Object, long, Object, long, long) unavailable. // Unsafe.copyMemory(Object, long, Object, long, long) unavailable.
unsafe = null; unsafe = null;
logger.debug("sun.misc.Unsafe.copyMemory: unavailable", (Exception) maybeException); logger.debug("sun.misc.Unsafe.copyMemory: unavailable", (Throwable) maybeException);
} }
} }
} else { } else {
@ -180,7 +177,7 @@ final class PlatformDependent0 {
@Override @Override
public Object run() { public Object run() {
try { try {
final Constructor constructor = final Constructor<?> constructor =
direct.getClass().getDeclaredConstructor(long.class, int.class); direct.getClass().getDeclaredConstructor(long.class, int.class);
constructor.setAccessible(true); constructor.setAccessible(true);
return constructor; return constructor;
@ -196,7 +193,7 @@ final class PlatformDependent0 {
address = UNSAFE.allocateMemory(1); address = UNSAFE.allocateMemory(1);
// try to use the constructor now // try to use the constructor now
try { try {
((Constructor) maybeDirectBufferConstructor).newInstance(address, 1); ((Constructor<?>) maybeDirectBufferConstructor).newInstance(address, 1);
directBufferConstructor = (Constructor<?>) maybeDirectBufferConstructor; directBufferConstructor = (Constructor<?>) maybeDirectBufferConstructor;
logger.debug("direct buffer constructor: available"); logger.debug("direct buffer constructor: available");
} catch (InstantiationException e) { } catch (InstantiationException e) {
@ -209,7 +206,7 @@ final class PlatformDependent0 {
} else { } else {
logger.debug( logger.debug(
"direct buffer constructor: unavailable", "direct buffer constructor: unavailable",
(Exception) maybeDirectBufferConstructor); (Throwable) maybeDirectBufferConstructor);
directBufferConstructor = null; directBufferConstructor = null;
} }
} finally { } finally {
@ -369,10 +366,6 @@ final class PlatformDependent0 {
return UNSAFE.getLong(data, BYTE_ARRAY_BASE_OFFSET + index); return UNSAFE.getLong(data, BYTE_ARRAY_BASE_OFFSET + index);
} }
static void putOrderedObject(Object object, long address, Object value) {
UNSAFE.putOrderedObject(object, address, value);
}
static void putByte(long address, byte value) { static void putByte(long address, byte value) {
UNSAFE.putByte(address, value); UNSAFE.putByte(address, value);
} }