< prev index next >
src/jdk/nashorn/internal/runtime/arrays/LongArrayData.java
Print this page
rev 1361 : 8079145: jdk.nashorn.internal.runtime.arrays.IntArrayData.convert assertion
Reviewed-by: jlaskey, hannesw
*** 118,132 ****
return darray;
}
@Override
public ContinuousArrayData convert(final Class<?> type) {
! if (type == Integer.class || type == Long.class) {
return this;
}
final int len = (int)length();
! if (type == Double.class) {
return new NumberArrayData(toDoubleArray(), len);
}
return new ObjectArrayData(toObjectArray(false), len);
}
--- 118,132 ----
return darray;
}
@Override
public ContinuousArrayData convert(final Class<?> type) {
! if (type == Integer.class || type == Long.class || type == Byte.class || type == Short.class) {
return this;
}
final int len = (int)length();
! if (type == Double.class || type == Float.class) {
return new NumberArrayData(toDoubleArray(), len);
}
return new ObjectArrayData(toObjectArray(false), len);
}
*** 169,179 ****
return this;
}
@Override
public ArrayData set(final int index, final Object value, final boolean strict) {
! if (value instanceof Long || value instanceof Integer) {
return set(index, ((Number)value).longValue(), strict);
} else if (value == ScriptRuntime.UNDEFINED) {
return new UndefinedArrayFilter(this).set(index, value, strict);
}
--- 169,180 ----
return this;
}
@Override
public ArrayData set(final int index, final Object value, final boolean strict) {
! if (value instanceof Long || value instanceof Integer ||
! value instanceof Byte || value instanceof Short) {
return set(index, ((Number)value).longValue(), strict);
} else if (value == ScriptRuntime.UNDEFINED) {
return new UndefinedArrayFilter(this).set(index, value, strict);
}
< prev index next >