KTIJ-21986 Don't log non-kotlin code fragment context when it's null
This warning shouldn't be logged when the context is null.
This commit is contained in:
committed by
teamcity
parent
79ba790b38
commit
7bef560b6b
@@ -83,8 +83,8 @@ abstract class KtCodeFragment(
|
|||||||
|
|
||||||
override fun getContext(): PsiElement? {
|
override fun getContext(): PsiElement? {
|
||||||
if (fakeContextForJavaFile != null) return fakeContextForJavaFile
|
if (fakeContextForJavaFile != null) return fakeContextForJavaFile
|
||||||
if (context !is KtElement) {
|
if (context != null && context !is KtElement) {
|
||||||
val logInfoForContextElement = (context as? PsiFile)?.virtualFile?.path ?: context?.getElementTextWithContext()
|
val logInfoForContextElement = (context as? PsiFile)?.virtualFile?.path ?: context.getElementTextWithContext()
|
||||||
LOG.warn("CodeFragment with non-kotlin context should have fakeContextForJavaFile set: \noriginalContext = $logInfoForContextElement")
|
LOG.warn("CodeFragment with non-kotlin context should have fakeContextForJavaFile set: \noriginalContext = $logInfoForContextElement")
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user