Make sure that isValidElementType(Type) before calling {Array,Struct}Type::get(Type)