Files
openide/plugins/kotlin/base
Ilya Kirillov 36668f1ecc [kotlin] K1: fix "IllegalStateException: Cannot restore a PsiElement from hard{KtLightClassForFacadeBase:MainKt of class org.jetbrains.kotlin.asJava.classes.KtUltraLightClassForFacade}
"

The problem is the following
	- The rename happened
	- The `TextEditorHighlightingPass` starts highlighting
	- `KotlinCodeBlockModificationListener.incModificationCount` is not yet called
	- `TextEditorHighlightingPass` goes to some UAST code that uses light classes facades `KtUltraLightClassForFacade`
		- The `KtUltraLightClassForFacade` is invalid by that moment as `classes.KtLightClassForFacadeBase.isValid` checks that file name did not change
	- As `KtUltraLightClassForFacade` is invalid, `JavaElementPsiSourceWithSmartPointer` cannot restore it from the `SmartPsiElementPointer` so the exception
	- `KotlinCodeBlockModificationListener.incModificationCount` may be fired later by 2bc66c1491/community/plugins/kotlin/base/analysis/src/org/jetbrains/kotlin/idea/caches/trackers/KotlinCodeBlockModificationListener.kt) line

The fix fires OOBM on file rename for K1 on `PsiTreeChangeEvent.PROP_FILE_NAME` in `KotlinCodeBlockModificationListener`


IJ-MR-139467

GitOrigin-RevId: eccb45c3527922120bd4a8cacacbbc8b456376a9
2024-07-10 14:08:39 +00:00
..
2024-06-26 00:29:35 +00:00