8066751: Remove casts redundant with Java 9 buffer APIs
Reviewed-by: hannesw, sundar
This commit is contained in:
parent
b9fbd2d32d
commit
3ac44fdc58
@ -28,7 +28,6 @@ package jdk.nashorn.internal.objects;
|
||||
import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import jdk.nashorn.internal.objects.annotations.Attribute;
|
||||
import jdk.nashorn.internal.objects.annotations.Constructor;
|
||||
import jdk.nashorn.internal.objects.annotations.Function;
|
||||
@ -227,10 +226,10 @@ public final class NativeArrayBuffer extends ScriptObject {
|
||||
}
|
||||
|
||||
ByteBuffer getBuffer(final int offset) {
|
||||
return (ByteBuffer)nb.duplicate().position(offset);
|
||||
return nb.duplicate().position(offset);
|
||||
}
|
||||
|
||||
ByteBuffer getBuffer(final int offset, final int length) {
|
||||
return (ByteBuffer)getBuffer(offset).limit(length);
|
||||
return getBuffer(offset).limit(length);
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public final class NativeFloat32Array extends ArrayBufferView {
|
||||
private static final MethodHandle SET_ELEM = specialCall(MethodHandles.lookup(), Float32ArrayData.class, "setElem", void.class, int.class, double.class).methodHandle();
|
||||
|
||||
private Float32ArrayData(final FloatBuffer nb, final int start, final int end) {
|
||||
super(((FloatBuffer)nb.position(start).limit(end)).slice(), end - start);
|
||||
super(nb.position(start).limit(end).slice(), end - start);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -81,7 +81,7 @@ public final class NativeFloat64Array extends ArrayBufferView {
|
||||
private static final MethodHandle SET_ELEM = specialCall(MethodHandles.lookup(), Float64ArrayData.class, "setElem", void.class, int.class, double.class).methodHandle();
|
||||
|
||||
private Float64ArrayData(final DoubleBuffer nb, final int start, final int end) {
|
||||
super(((DoubleBuffer)nb.position(start).limit(end)).slice(), end - start);
|
||||
super(nb.position(start).limit(end).slice(), end - start);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -82,7 +82,7 @@ public final class NativeInt16Array extends ArrayBufferView {
|
||||
private static final MethodHandle SET_ELEM = specialCall(MethodHandles.lookup(), Int16ArrayData.class, "setElem", void.class, int.class, int.class).methodHandle();
|
||||
|
||||
private Int16ArrayData(final ShortBuffer nb, final int start, final int end) {
|
||||
super(((ShortBuffer)nb.position(start).limit(end)).slice(), end - start);
|
||||
super(nb.position(start).limit(end).slice(), end - start);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -81,7 +81,7 @@ public final class NativeInt32Array extends ArrayBufferView {
|
||||
private static final MethodHandle SET_ELEM = specialCall(MethodHandles.lookup(), Int32ArrayData.class, "setElem", void.class, int.class, int.class).methodHandle();
|
||||
|
||||
private Int32ArrayData(final IntBuffer nb, final int start, final int end) {
|
||||
super(((IntBuffer)nb.position(start).limit(end)).slice(), end - start);
|
||||
super(nb.position(start).limit(end).slice(), end - start);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -80,7 +80,7 @@ public final class NativeInt8Array extends ArrayBufferView {
|
||||
private static final MethodHandle SET_ELEM = specialCall(MethodHandles.lookup(), Int8ArrayData.class, "setElem", void.class, int.class, int.class).methodHandle();
|
||||
|
||||
private Int8ArrayData(final ByteBuffer nb, final int start, final int end) {
|
||||
super(((ByteBuffer)nb.position(start).limit(end)).slice(), end - start);
|
||||
super(nb.position(start).limit(end).slice(), end - start);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -81,7 +81,7 @@ public final class NativeUint16Array extends ArrayBufferView {
|
||||
private static final MethodHandle SET_ELEM = specialCall(MethodHandles.lookup(), Uint16ArrayData.class, "setElem", void.class, int.class, int.class).methodHandle();
|
||||
|
||||
private Uint16ArrayData(final CharBuffer nb, final int start, final int end) {
|
||||
super(((CharBuffer)nb.position(start).limit(end)).slice(), end - start);
|
||||
super(nb.position(start).limit(end).slice(), end - start);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -82,7 +82,7 @@ public final class NativeUint32Array extends ArrayBufferView {
|
||||
private static final MethodHandle SET_ELEM = specialCall(MethodHandles.lookup(), Uint32ArrayData.class, "setElem", void.class, int.class, int.class).methodHandle();
|
||||
|
||||
private Uint32ArrayData(final IntBuffer nb, final int start, final int end) {
|
||||
super(((IntBuffer)nb.position(start).limit(end)).slice(), end - start);
|
||||
super(nb.position(start).limit(end).slice(), end - start);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -81,7 +81,7 @@ public final class NativeUint8Array extends ArrayBufferView {
|
||||
private static final MethodHandle SET_ELEM = specialCall(MethodHandles.lookup(), Uint8ArrayData.class, "setElem", void.class, int.class, int.class).methodHandle();
|
||||
|
||||
private Uint8ArrayData(final ByteBuffer nb, final int start, final int end) {
|
||||
super(((ByteBuffer)nb.position(start).limit(end)).slice(), end - start);
|
||||
super(nb.position(start).limit(end).slice(), end - start);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -85,7 +85,7 @@ public final class NativeUint8ClampedArray extends ArrayBufferView {
|
||||
private static final MethodHandle CLAMP_LONG = staticCall(MethodHandles.lookup(), Uint8ClampedArrayData.class, "clampLong", long.class, long.class).methodHandle();
|
||||
|
||||
private Uint8ClampedArrayData(final ByteBuffer nb, final int start, final int end) {
|
||||
super(((ByteBuffer)nb.position(start).limit(end)).slice(), end - start);
|
||||
super(nb.position(start).limit(end).slice(), end - start);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user