RefElement (@NotNull PsiElement psiElement, @NotNull UElement uElement, @NotNull RefManagerImpl refManager) { UDeclaration containingUDecl = UDeclarationKt.getContainingDeclaration(uElement); PsiElement containingDeclaration = RefJavaUtilImpl.returnToPhysical(containingUDecl == null ? null : containingUDecl.getSourcePsi()); final RefElement parentRef; //TODO strange if (containingDeclaration == null || containingDeclaration instanceof LightElement) { parentRef = refManager.getReference(psiElement.getContainingFile(), true); } else { parentRef = refManager.getReference(containingDeclaration, true); } return parentRef; }