in core/src/main/java/com/jetbrains/sa/jdi/ArrayReferenceImpl.java [95:147]
public List<ValueImpl> getValues(int index, int len) {
if (len == -1) { // -1 means the rest of the array
len = length() - index;
}
validateArrayAccess(index, len);
if (len == 0) {
return Collections.emptyList();
}
List<ValueImpl> vals = new ArrayList<ValueImpl>(len);
TypeArray typeArray = null;
ObjArray objArray = null;
if (ref() instanceof TypeArray) {
typeArray = (TypeArray)ref();
} else if (ref() instanceof ObjArray) {
objArray = (ObjArray)ref();
} else {
throw new RuntimeException("should not reach here");
}
char c = arrayType().componentSignature().charAt(0);
BasicType variableType = BasicType.charToBasicType(c);
final int limit = index + len;
for (int ii = index; ii < limit; ii++) {
ValueImpl valueImpl;
if (variableType == BasicType.T_BOOLEAN) {
valueImpl = vm().mirrorOf(typeArray.getBooleanAt(ii));
} else if (variableType == BasicType.T_CHAR) {
valueImpl = vm().mirrorOf(typeArray.getCharAt(ii));
} else if (variableType == BasicType.T_FLOAT) {
valueImpl = vm().mirrorOf(typeArray.getFloatAt(ii));
} else if (variableType == BasicType.T_DOUBLE) {
valueImpl = vm().mirrorOf(typeArray.getDoubleAt(ii));
} else if (variableType == BasicType.T_BYTE) {
valueImpl = vm().mirrorOf(typeArray.getByteAt(ii));
} else if (variableType == BasicType.T_SHORT) {
valueImpl = vm().mirrorOf(typeArray.getShortAt(ii));
} else if (variableType == BasicType.T_INT) {
valueImpl = vm().mirrorOf(typeArray.getIntAt(ii));
} else if (variableType == BasicType.T_LONG) {
valueImpl = vm().mirrorOf(typeArray.getLongAt(ii));
} else if (variableType == BasicType.T_OBJECT || variableType == BasicType.T_ARRAY) {
// we may have an [Ljava/lang/Object; - i.e., Object[] with the
// elements themselves may be arrays because every array is an Object.
valueImpl = vm().objectMirror(objArray.getOopHandleAt(ii));
} else {
throw new RuntimeException("should not reach here");
}
vals.add (valueImpl);
}
return vals;
}