*/
public static Type createIsomorphicType(Type shapeType, Type elementType) {
if (shapeType instanceof RefType || shapeType instanceof PrimType) {
return elementType;
} else if (shapeType instanceof ArrayType) {
ArrayType arrayShapeType = (ArrayType) shapeType;
if (elementType instanceof RefType
|| elementType instanceof PrimType) {
return ArrayType.v(elementType, arrayShapeType.numDimensions);
} else if (elementType instanceof ArrayType) {
ArrayType arrayElementType = (ArrayType) elementType;
return ArrayType.v(arrayElementType.baseType,
arrayElementType.numDimensions
+ arrayShapeType.numDimensions);
}
}