From f104bdfe03beb86fc3ae42c9d270d0a8540372b4 Mon Sep 17 00:00:00 2001 From: Natalia Selezneva Date: Mon, 6 Aug 2018 13:47:44 +0300 Subject: [PATCH] Do not log full file text when code fragment was created with error context of PsiFile --- compiler/psi/src/org/jetbrains/kotlin/psi/KtCodeFragment.kt | 3 ++- .../psi/src/org/jetbrains/kotlin/psi/KtCodeFragment.kt.181 | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtCodeFragment.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/KtCodeFragment.kt index 2f96f354c56..f3bd462061e 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtCodeFragment.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtCodeFragment.kt @@ -87,7 +87,8 @@ abstract class KtCodeFragment( override fun getContext(): PsiElement? { if (fakeContextForJavaFile != null) return fakeContextForJavaFile if (context !is KtElement) { - LOG.warn("CodeFragment with non-kotlin context should have fakeContextForJavaFile set: \noriginalContext = ${context?.getElementTextWithContext()}") + val logInfoForContextElement = (context as? PsiFile)?.virtualFile?.path ?: context?.getElementTextWithContext() + LOG.warn("CodeFragment with non-kotlin context should have fakeContextForJavaFile set: \noriginalContext = $logInfoForContextElement") return null } diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtCodeFragment.kt.181 b/compiler/psi/src/org/jetbrains/kotlin/psi/KtCodeFragment.kt.181 index 8dd2aeeeae3..f76f6504f45 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtCodeFragment.kt.181 +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtCodeFragment.kt.181 @@ -87,7 +87,8 @@ abstract class KtCodeFragment( override fun getContext(): PsiElement? { if (fakeContextForJavaFile != null) return fakeContextForJavaFile if (context !is KtElement) { - LOG.warn("CodeFragment with non-kotlin context should have fakeContextForJavaFile set: \noriginalContext = ${context?.getElementTextWithContext()}") + val logInfoForContextElement = (context as? PsiFile)?.virtualFile?.path ?: context?.getElementTextWithContext() + LOG.warn("CodeFragment with non-kotlin context should have fakeContextForJavaFile set: \noriginalContext = $logInfoForContextElement") return null }