if (tic != null && tic.isDone()) {
// we have an answer already; use it.
return tic;
}
TreeLogger localLogger = logger.branch(TreeLogger.DEBUG,
classType.getParameterizedQualifiedSourceName(), null);
JTypeParameter isTypeParameter = classType.isTypeParameter();
if (isTypeParameter != null) {
if (typeParametersInRootTypes.contains(isTypeParameter)) {
return computeTypeInstantiability(localLogger,
isTypeParameter.getFirstBound(),
TypePaths.createTypeParameterInRootPath(path, isTypeParameter),
problems);
}
/*
* This type parameter was not in a root type and therefore it is the
* caller's responsibility to deal with it. We assume that it is
* indirectly instantiable here.
*/
tic = getTypeInfoComputed(classType, path, true);
tic.setInstantiableSubtypes(true);
tic.setInstantiable(false);
return tic;
}
JWildcardType isWildcard = classType.isWildcard();
if (isWildcard != null) {
boolean success = true;
for (JClassType bound : isWildcard.getUpperBounds()) {
success &= computeTypeInstantiability(localLogger, bound, path,
problems).hasInstantiableSubtypes();
}
tic = getTypeInfoComputed(classType, path, true);
tic.setInstantiableSubtypes(success);
tic.setInstantiable(false);
return tic;
}
JArrayType isArray = classType.isArray();
if (isArray != null) {
TypeInfoComputed arrayTic = checkArrayInstantiable(localLogger, isArray,
path, problems);
assert getTypeInfoComputed(classType, path, false) != null;
return arrayTic;
}
if (classType == typeOracle.getJavaLangObject()) {
/*
* Report an error if the type is or erases to Object since this violates
* our restrictions on RPC. Should be fatal, but I worry users may have
* Object-using code they can't readily get out of the class hierarchy.
*/
problems.add(classType,
"In order to produce smaller client-side code, 'Object' is not "
+ "allowed; please use a more specific type", Priority.DEFAULT);
tic = getTypeInfoComputed(classType, path, true);
tic.setInstantiable(false);
return tic;
}
if (classType.isRawType() != null) {
localLogger.log(
TreeLogger.DEBUG,
"Type '"
+ classType.getQualifiedSourceName()
+ "' should be parameterized to help the compiler produce the smallest code size possible for your module",
null);