}
private TypeInfoComputed checkArrayInstantiable(TreeLogger logger, JArrayType array,
TypePath path, ProblemReport problems) {
JType leafType = array.getLeafType();
JWildcardType leafWild = leafType.isWildcard();
if (leafWild != null) {
JArrayType arrayType = getArrayType(typeOracle, array.getRank(),
leafWild.getUpperBound());
return checkArrayInstantiable(logger, arrayType, path, problems);
}
JClassType leafClass = leafType.isClassOrInterface();
JTypeParameter isLeafTypeParameter = leafType.isTypeParameter();
if (isLeafTypeParameter != null
&& !typeParametersInRootTypes.contains(isLeafTypeParameter)) {
// Don't deal with non root type parameters, but make a TIC entry to
// save time if it recurs. We assume they're indirectly instantiable.
TypeInfoComputed tic = getTypeInfoComputed(array, path, true);
tic.setInstantiableSubtypes(true);
tic.setInstantiable(false);
return tic;
}
if (!isAllowedByFilter(array, problems)) {
// Don't deal with filtered out types either, but make a TIC entry to
// save time if it recurs. We assume they're not instantiable.
TypeInfoComputed tic = getTypeInfoComputed(array, path, true);
tic.setInstantiable(false);
return tic;
}
TypeInfoComputed tic = getTypeInfoComputed(array, path, true);
if (tic.isDone()) {
return tic;
} else if (tic.isPendingInstantiable()) {
return tic;
}
tic.setPendingInstantiable();
TreeLogger branch = logger.branch(TreeLogger.DEBUG,
"Analyzing component type:", null);
TypeInfoComputed leafTic = computeTypeInstantiability(branch, leafType,
TypePaths.createArrayComponentPath(array, path), problems);
boolean succeeded = leafTic.hasInstantiableSubtypes();
if (succeeded) {
if (leafClass == null) {
assert leafType.isPrimitive() != null;
markArrayTypesInstantiable(leafType, array.getRank(), path);
} else {
TreeLogger covariantArrayLogger = logger.branch(TreeLogger.DEBUG,
"Covariant array types");