private static Value evalJdiArray(CommonTree node) {
CommonTree arrayNode = (CommonTree)node.getChild(0);
CommonTree indexExpNode = (CommonTree)node.getChild(1);
ArrayReference array = (ArrayReference)evalTreeNode(arrayNode);
Object arrayIdxValue = evalTreeNode((CommonTree)indexExpNode.getChild(0));
if (arrayIdxValue instanceof IntegerValue ) {
int idx = ((IntegerValue)arrayIdxValue).value();
return array.getValue(idx);
} else if (arrayIdxValue instanceof Integer) {
int idx = ((Integer)arrayIdxValue).intValue();
return array.getValue(idx);
} else {
throw new ExpressionEvalException("eval expression error, array index is not int type.");
}
}