mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
add a special assertion if FileContentImpl#getPsiFile is called for a file with non language file type
GitOrigin-RevId: 58d83b8cbd96b3a0a893e3e6b18368440435c48d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
93d6f7d6e6
commit
fe95514af7
@@ -114,7 +114,12 @@ public class FileContentImpl extends IndexedFileImpl implements PsiDependentFile
|
||||
if (project == null) {
|
||||
project = DefaultProjectFactory.getInstance().getDefaultProject();
|
||||
}
|
||||
return createFileFromText(project, text, (LanguageFileType)getFileTypeWithoutSubstitution(), myFile, myFileName);
|
||||
FileType fileType = getFileTypeWithoutSubstitution();
|
||||
if (!(fileType instanceof LanguageFileType)) {
|
||||
throw new AssertionError("PSI can be created only for a file with LanguageFileType but actual is " + fileType.getClass() + "." +
|
||||
"\nPlease use a proper FileBasedIndexExtension#getInputFilter() implementation for the caller index");
|
||||
}
|
||||
return createFileFromText(project, text, (LanguageFileType)fileType, myFile, myFileName);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user