for (INamedElement defElement : targetDefElements) {
DefUnit defUnit = defElement.resolveDefUnit();
if(defUnit == null) {
continue;
}
Module moduleNode = defUnit.getModuleNode();
if(moduleNode == null) {
continue; // consider this case more
}
ISourceModule defUnitSrcModule = findSourceModule(moduleNode, searchProj);
ArrayList<Integer> nodeTreePath = DeeSearchEngineTestUtils.getNodeTreePath(defUnit);
Pair<ISourceModule, ?> key = Pair.create(defUnitSrcModule, nodeTreePath);
if(defUnitToReferencesMap.get(key) == null) {
defUnitToReferencesMap.put(key, new HashSet<Reference>());
}
defUnitToReferencesMap.get(key).add(reference);
}
}
}
}.visitElementsAndNodes(getSrcFolder(searchProj, "srcA"), 10);
for (Pair<ISourceModule, ?> key : defUnitToReferencesMap.keySet()) {
ISourceModule sourceModule = key.getFirst();
ArrayList<Integer> nodeTreePath = blindCast(key.getSecond());
Path filePath = DLTKUtils.getFilePath(sourceModule);
ParsedModule parseModule = DToolClient.getDefaultModuleCache().getParsedModuleOrNull(filePath);
Module deeModule = parseModule == null ? null : parseModule.module;
ASTNode node = DeeSearchEngineTestUtils.getNodeFromPath(deeModule, nodeTreePath);
final DefUnit defUnit = (DefUnit) node;
final HashSet<Reference> expectedReferences = defUnitToReferencesMap.get(key);