PsiElement () { TreeElement mirrorTreeElement = dereference(myMirrorFileElement); if (mirrorTreeElement == null) { synchronized (myMirrorLock) { mirrorTreeElement = dereference(myMirrorFileElement); if (mirrorTreeElement == null) { VirtualFile file = getVirtualFile(); AstLoadingFilter.assertTreeLoadingAllowed(file); PsiClass[] classes = getClasses(); String fileName = (classes.length > 0 ? classes[0].getName() : file.getNameWithoutExtension()) + JavaFileType.DOT_DEFAULT_EXTENSION; Document document = FileDocumentManager.getInstance().getDocument(file); assert document != null : file.getUrl(); CharSequence mirrorText = document.getImmutableCharSequence(); boolean internalDecompiler = StringUtil.startsWith(mirrorText, BANNER); PsiFileFactory factory = PsiFileFactory.getInstance(getManager().getProject()); PsiFile mirror = factory.createFileFromText(fileName, JavaLanguage.INSTANCE, mirrorText, false, false, true); mirror.putUserData(PsiUtil.FILE_LANGUAGE_LEVEL_KEY, getLanguageLevel()); mirrorTreeElement = SourceTreeToPsiMap.psiToTreeNotNull(mirror); try { TreeElement _mirrorTreeElement = mirrorTreeElement; ProgressManager.getInstance().executeNonCancelableSection(() -> { setFileMirror(_mirrorTreeElement); putUserData(CLS_DOCUMENT_LINK_KEY, document); }); } catch (InvalidMirrorException e) { LOG.error(file.getUrl(), internalDecompiler ? e : wrapException(e, file)); } ((PsiFileImpl)mirror).setOriginalFile(this); myMirrorFileElement = new SoftReference<>(mirrorTreeElement); } } } return mirrorTreeElement.getPsi(); }