return false;
}
// Check array/array subtype relationship
ArrayType typeAsArrayType = (ArrayType) type;
ArrayType possibleSupertypeAsArrayType = (ArrayType) possibleSupertype;
// Must have same number of dimensions
if (typeAsArrayType.getDimensions() < possibleSupertypeAsArrayType.getDimensions()) {
return false;
}
Type possibleSupertypeBasicType = possibleSupertypeAsArrayType.getBasicType();
if (!(possibleSupertypeBasicType instanceof ObjectType)) {
return false;
}
Type typeBasicType = typeAsArrayType.getBasicType();
// If dimensions differ, see if element types are compatible.
if (typeAsArrayType.getDimensions() > possibleSupertypeAsArrayType.getDimensions()) {
return isSubtype(
new ArrayType(typeBasicType, typeAsArrayType.getDimensions()
- possibleSupertypeAsArrayType.getDimensions()), (ObjectType) possibleSupertypeBasicType);
}
// type's base type must be a subtype of possibleSupertype's base
// type.
// Note that neither base type can be a non-ObjectType if we are to