if (element instanceof Member) {
element = ((Member) element).getBaseElement();
}
// System.out.println(element + " " + relationship + " " + location);
// prepare information
AnalysisContext elementContext = element.getContext();
AnalysisContext locationContext = location.getElement().getContext();
Source elementSource = element.getSource();
Source locationSource = location.getElement().getSource();
Source elementLibrarySource = getLibrarySourceOrNull(element);
Source locationLibrarySource = getLibrarySourceOrNull(location.getElement());
// sanity check
if (locationContext == null) {
return;
}
if (locationSource == null) {
return;
}
if (elementContext == null && !(element instanceof NameElementImpl)
&& !(element instanceof UniverseElementImpl)) {
return;
}
if (elementSource == null && !(element instanceof NameElementImpl)
&& !(element instanceof UniverseElementImpl)) {
return;
}
// may be already disposed in other thread
if (elementContext != null && elementContext.isDisposed()) {
return;
}
if (locationContext.isDisposed()) {
return;
}
// record: key -> location(s)
ElementRelationKey key = getCanonicalKey(element, relationship);
{