| 171 | |
| 172 | |
| 173 | public static Object getIndex(Object array, int index) throws ReflectError, UtilTargetError { |
| 174 | if (Interpreter.DEBUG) { |
| 175 | Interpreter.debug("getIndex: " + array + ", index=" + index); |
| 176 | } |
| 177 | try { |
| 178 | Object val = Array.get(array, index); |
| 179 | return Primitive.wrap(val, array.getClass().getComponentType()); |
| 180 | } catch (ArrayIndexOutOfBoundsException e1) { |
| 181 | throw new UtilTargetError(e1); |
| 182 | } catch (Exception e) { |
| 183 | throw new ReflectError("Array access:" + e); |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | |
| 188 | public static void setIndex(Object array, int index, Object val) throws ReflectError, UtilTargetError { |