98 @Override 99 public Class<?> getElementType() { 100 return int.class; 101 } 102 103 @Override 104 public Class<?> getBoxedElementType() { 105 return Integer.class; 106 } 107 108 private int getElem(final int index) { 109 try { 110 return nb.get(index); 111 } catch (final IndexOutOfBoundsException e) { 112 throw new ClassCastException(); //force relink - this works for unoptimistic too 113 } 114 } 115 116 private void setElem(final int index, final int elem) { 117 try { 118 nb.put(index, (short)elem); 119 } catch (final IndexOutOfBoundsException e) { 120 //swallow valid array indexes. it's ok. 121 if (index < 0) { 122 throw new ClassCastException(); 123 } 124 } 125 } 126 127 @Override 128 public int getInt(final int index) { 129 return getElem(index); 130 } 131 132 @Override 133 public int getIntOptimistic(final int index, final int programPoint) { 134 return getElem(index); 135 } 136 137 @Override 138 public long getLong(final int index) { 139 return getInt(index); 140 } 141 142 @Override 143 public long getLongOptimistic(final int index, final int programPoint) { | 98 @Override 99 public Class<?> getElementType() { 100 return int.class; 101 } 102 103 @Override 104 public Class<?> getBoxedElementType() { 105 return Integer.class; 106 } 107 108 private int getElem(final int index) { 109 try { 110 return nb.get(index); 111 } catch (final IndexOutOfBoundsException e) { 112 throw new ClassCastException(); //force relink - this works for unoptimistic too 113 } 114 } 115 116 private void setElem(final int index, final int elem) { 117 try { 118 if (index < nb.limit()) { 119 nb.put(index, (short) elem); 120 } 121 } catch (final IndexOutOfBoundsException e) { 122 throw new ClassCastException(); 123 } 124 } 125 126 @Override 127 public int getInt(final int index) { 128 return getElem(index); 129 } 130 131 @Override 132 public int getIntOptimistic(final int index, final int programPoint) { 133 return getElem(index); 134 } 135 136 @Override 137 public long getLong(final int index) { 138 return getInt(index); 139 } 140 141 @Override 142 public long getLongOptimistic(final int index, final int programPoint) { |