PathReference (@NotNull final String path, @NotNull final PsiElement element) { final List<PsiReference> list = new SmartList<>(); createReferences(element, list, true); if (list.isEmpty()) return null; final PsiElement target = list.get(list.size() - 1).resolve(); if (target == null) return null; return new PathReference(path, PathReference.ResolveFunction.NULL_RESOLVE_FUNCTION) { @Override public PsiElement resolve() { return target; } }; }