FileElement () { assertReadAccessAllowed(); if (myPossiblyInvalidated) { PsiUtilCore.ensureValid(this); // for invalidation trace diagnostics } FileViewProvider viewProvider = getViewProvider(); if (viewProvider.isPhysical()) { VirtualFile vFile = viewProvider.getVirtualFile(); AstLoadingFilter.assertTreeLoadingAllowed(vFile); if (myManager.isAssertOnFileLoading(vFile)) { reportProhibitedAstAccess(vFile); } } try { synchronized (myPsiLock) { FileElement treeElement = derefTreeElement(); if (treeElement != null) { return treeElement; } treeElement = createFileElement(viewProvider.getContents()); treeElement.setPsi(this); myLoadingAst = true; try { updateTrees(myTrees.withAst(createTreeElementPointer(treeElement))); } finally { myLoadingAst = false; } if (LOG.isDebugEnabled() && viewProvider.isPhysical()) { LOG.debug("Loaded text for file " + viewProvider.getVirtualFile().getPresentableUrl()); } return treeElement; } } catch (StubTreeLoader.StubTreeAndIndexUnmatchCoarseException e) { throw e.createCompleteException(); } }