void (@NotNull Document document, @NotNull VirtualFile virtualFile) { if (!(virtualFile instanceof LightVirtualFile) && !(virtualFile.getFileSystem() instanceof NonPhysicalFileSystem)) { throw new IllegalArgumentException( "Hard-coding file<->document association is permitted for non-physical files only (see FileViewProvider.isPhysical())" + " to avoid memory leaks. virtualFile=" + virtualFile); } synchronized (lock) { document.putUserData(FILE_KEY, virtualFile); virtualFile.putUserData(HARD_REF_TO_DOCUMENT_KEY, document); } }