}
}
private void unifyJavaAst(Set<String> allRootTypes, String entryMethodHolderTypeName)
throws UnableToCompleteException {
UnifyAst unifyAst;
try {
unifyAst = new UnifyAst(logger, compilerContext, jprogram, jsProgram, rpo);
} catch (CollidingCompilationUnitException e) {
logger.log(TreeLogger.ERROR, e.getMessage());
throw new UnableToCompleteException();
}
// Makes JProgram aware of these types so they can be accessed via index.
unifyAst.addRootTypes(allRootTypes);
// Must synthesize entryPoint.onModuleLoad() calls because some EntryPoint classes are
// private.
if (entryMethodHolderTypeName != null) {
// Only synthesize the init method in the EntryMethodHolder class, if there is an
// EntryMethodHolder class.
synthesizeEntryMethodHolderInit(unifyAst, entryMethodHolderTypeName);
}
// Ensures that unification traversal starts from these methods.
jprogram.addEntryMethod(jprogram.getIndexedMethod("Impl.registerEntry"));
if (entryMethodHolderTypeName != null) {
// Only register the init method in the EntryMethodHolder class as an entry method, if there
// is an EntryMethodHolder class.
jprogram.addEntryMethod(jprogram.getIndexedMethod(
SourceName.getShortClassName(entryMethodHolderTypeName) + ".init"));
}
unifyAst.exec();
}