*/
public CompilationUnitDeclaration[] getCompilationUnitDeclarations(
TreeLogger logger, String[] seedTypeNames)
throws UnableToCompleteException {
TypeOracle oracle = compilationState.getTypeOracle();
Set<JClassType> intfTypes = oracle.getSingleJsoImplInterfaces();
Map<String, CompiledClass> classMapBySource = compilationState.getClassFileMapBySource();
/*
* The alreadyAdded set prevents duplicate CompilationUnits from being added
* to the icu list in the case of multiple JSO implementations as inner
* classes in the same top-level class or seed classes as SingleJsoImpls
* (e.g. JSO itself as the SingleImpl for all tag interfaces).
*/
Set<CompilationUnit> alreadyAdded = new HashSet<CompilationUnit>();
List<ICompilationUnit> icus = new ArrayList<ICompilationUnit>(
seedTypeNames.length + intfTypes.size());
for (String seedTypeName : seedTypeNames) {
CompilationUnit unit = getUnitForType(logger, classMapBySource,
seedTypeName);
if (alreadyAdded.add(unit)) {
icus.add(new CompilationUnitAdapter(unit));
} else {
logger.log(TreeLogger.WARN, "Duplicate compilation unit '"
+ unit.getDisplayLocation() + "'in seed types");
}
}
/*
* Add all SingleJsoImpl types that we know about. It's likely that the
* concrete types are never explicitly referenced from the seed types.
*/
for (JClassType intf : intfTypes) {
String implName = oracle.getSingleJsoImpl(intf).getQualifiedSourceName();
CompilationUnit unit = getUnitForType(logger, classMapBySource, implName);
if (alreadyAdded.add(unit)) {
icus.add(new CompilationUnitAdapter(unit));
logger.log(TreeLogger.SPAM, "Forced compilation of unit '"