nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/LongArrayData.java
equal
deleted
inserted
replaced
118 return darray; |
118 return darray; |
119 } |
119 } |
120 |
120 |
121 @Override |
121 @Override |
122 public ContinuousArrayData convert(final Class<?> type) { |
122 public ContinuousArrayData convert(final Class<?> type) { |
123 if (type == Integer.class || type == Long.class) { |
123 if (type == Integer.class || type == Long.class || type == Byte.class || type == Short.class) { |
124 return this; |
124 return this; |
125 } |
125 } |
126 final int len = (int)length(); |
126 final int len = (int)length(); |
127 if (type == Double.class) { |
127 if (type == Double.class || type == Float.class) { |
128 return new NumberArrayData(toDoubleArray(), len); |
128 return new NumberArrayData(toDoubleArray(), len); |
129 } |
129 } |
130 return new ObjectArrayData(toObjectArray(false), len); |
130 return new ObjectArrayData(toObjectArray(false), len); |
131 } |
131 } |
132 |
132 |
169 return this; |
169 return this; |
170 } |
170 } |
171 |
171 |
172 @Override |
172 @Override |
173 public ArrayData set(final int index, final Object value, final boolean strict) { |
173 public ArrayData set(final int index, final Object value, final boolean strict) { |
174 if (value instanceof Long || value instanceof Integer) { |
174 if (value instanceof Long || value instanceof Integer || |
|
175 value instanceof Byte || value instanceof Short) { |
175 return set(index, ((Number)value).longValue(), strict); |
176 return set(index, ((Number)value).longValue(), strict); |
176 } else if (value == ScriptRuntime.UNDEFINED) { |
177 } else if (value == ScriptRuntime.UNDEFINED) { |
177 return new UndefinedArrayFilter(this).set(index, value, strict); |
178 return new UndefinedArrayFilter(this).set(index, value, strict); |
178 } |
179 } |
179 |
180 |