PsiFunctionalExpression (Map<TextRange, PsiFile> fragmentCache, JavaFunctionalExpressionIndex.IndexEntry entry, PsiFunctionalExpression expression) { PsiFile file = expression.getContainingFile(); FileViewProvider viewProvider = file.getViewProvider(); try { PsiMember member = Objects.requireNonNull(PsiTreeUtil.getStubOrPsiParentOfType(expression, PsiMember.class)); PsiFunctionalExpression psi = null; Exception ex = null; try { PsiFile fragment = fragmentCache.computeIfAbsent(TextRange.create(entry.contextStart, entry.contextEnd), range -> createMemberCopyFromText(member, range)); psi = findPsiByAST(fragment, entry.exprStart - entry.contextStart); } catch (IncorrectOperationException e) { ex = e; } if (psi == null) { StubTextInconsistencyException.checkStubTextConsistency(file); throw new RuntimeExceptionWithAttachments( "No functional expression at " + entry + ", file will be reindexed", ex, new Attachment(viewProvider.getVirtualFile().getPath(), viewProvider.getContents().toString())); } return psi; } catch (ProcessCanceledException e) { throw e; } catch (Throwable e) { FileBasedIndex.getInstance().requestReindex(viewProvider.getVirtualFile()); LOG.error(e); return expression; } }