if (val != null) {
ArrayType arrayType = (ArrayType) type;
Type elementType = arrayType.unwrapAll();
int dimensionCount = getDimensions(val.getClass(), arrayType.unwrapAll());
length += 12 + (dimensionCount * 8);
length += subLength(elementType, dimensionCount, val, context);