PsiReference () { return new PsiReference() { @Override @NotNull public PsiElement getElement() { return RegExpBackrefImpl.this; } @Override @NotNull public TextRange getRangeInElement() { return TextRange.from(0, getElement().getTextLength()); } @Override @NotNull public String getCanonicalText() { return getElement().getText(); } @Override public PsiElement handleElementRename(@NotNull String newElementName) throws IncorrectOperationException { throw new IncorrectOperationException(); } @Override public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException { throw new IncorrectOperationException(); } @Override public boolean isReferenceTo(@NotNull PsiElement element) { return Comparing.equal(element, resolve()); } @Override public boolean isSoft() { return false; } @Override public PsiElement resolve() { return RegExpBackrefImpl.this.resolve(); } }; }