File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/inspection Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import com.intellij.openapi.util.TextRange
6
6
import com.intellij.psi.JavaPsiFacade
7
7
import com.intellij.psi.PsiDocumentManager
8
8
import com.intellij.psi.PsiFile
9
+ import org.jetbrains.kotlin.idea.core.util.toPsiFile
9
10
import org.jetbrains.kotlin.idea.search.allScope
10
11
import org.utbot.sarif.*
11
12
import java.nio.file.Path
@@ -59,7 +60,14 @@ class UnitTestBotInspectionTool : GlobalSimpleInspectionTool() {
59
60
val errorPsiFile = srcFileLogicalLocation?.fullyQualifiedName?.let { errorClassFqn ->
60
61
val psiFacade = JavaPsiFacade .getInstance(srcPsiFile.project)
61
62
val psiClass = psiFacade.findClass(errorClassFqn, srcPsiFile.project.allScope())
62
- psiClass?.containingFile
63
+ val psiFile = psiClass?.containingFile ? : return @let null
64
+
65
+ // We can't just return psiFile because it may be non-physical
66
+ if (psiFile.isPhysical) {
67
+ psiFile
68
+ } else {
69
+ psiFile.virtualFile.toPsiFile(srcPsiFile.project)
70
+ }
63
71
} ? : srcPsiFile
64
72
val errorRegion = srcFilePhysicalLocation.region
65
73
val errorTextRange = getTextRange(problemsHolder.project, errorPsiFile, errorRegion)
You can’t perform that action at this time.
0 commit comments