PsiIdentifier () { PsiIdentifier identifier = PsiTreeUtil.getChildOfType(this, PsiIdentifier.class); if (identifier == null) { PsiFile file = getContainingFile(); Logger.getInstance(PsiPatternVariableImpl.class).error("Pattern without identifier", new Attachment("File content", file.getText())); } return Objects.requireNonNull(identifier); }