Pair<List<Shadow>, List<CdoSnapshot>> queryForShadows(JqlQuery query, List<CdoSnapshot> gapsFilledInPreviousQuery) { List<CdoSnapshot> coreSnapshots = queryForCoreSnapshots(query); CommitTable commitTable = new CommitTable( coreSnapshots, query.getMaxGapsToFill(), query); commitTable.appendSnapshots(gapsFilledInPreviousQuery); if (query.getShadowScope().isCommitDeep()) { commitTable.loadFullCommits(); } List<Shadow> shadows = commitTable.rootsForQuery(query).stream() .map(r -> shadowFactory.createShadow(r.root, r.context, (cm, targetId) -> commitTable.referenceResolver(cm, targetId))) .collect(toList()); query.stats().stop(); logger.debug("queryForShadows executed: {}", query); return new Pair(shadows, commitTable.getFilledGapsSnapshots()); }