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