detekt/detekt-intellij-plugin

java.lang.NullPointerException: ktFile.virtualFile must not be null

mrclrchtr opened this issue · 1 comments

It seems to be a random occurrence:

Version 1.22.2

java.lang.NullPointerException: ktFile.virtualFile must not be null
	at org.jetbrains.kotlin.idea.core.script.ucache.KotlinScriptImplementationSwitcherKt.getScriptDependenciesClassFilesScope(kotlinScriptImplementationSwitcher.kt:41)
	at org.jetbrains.kotlin.idea.core.script.dependencies.KotlinScriptResolveScopeProvider.getResolveScope(KotlinScriptResolveScopeProvider.kt:85)
	at com.intellij.psi.impl.file.impl.ResolveScopeManagerImpl.createScopeByFile(ResolveScopeManagerImpl.java:74)
	at com.intellij.psi.impl.file.impl.ResolveScopeManagerImpl.lambda$new$0(ResolveScopeManagerImpl.java:50)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:898)
	at com.intellij.openapi.application.ReadAction.compute(ReadAction.java:68)
	at com.intellij.psi.impl.file.impl.ResolveScopeManagerImpl.lambda$new$1(ResolveScopeManagerImpl.java:50)
	at com.intellij.util.containers.ConcurrentFactoryMap$3.create(ConcurrentFactoryMap.java:184)
	at com.intellij.util.containers.ConcurrentFactoryMap.get(ConcurrentFactoryMap.java:40)
	at com.intellij.psi.impl.file.impl.ResolveScopeManagerImpl.getResolveScopeFromProviders(ResolveScopeManagerImpl.java:92)
	at com.intellij.psi.impl.file.impl.ResolveScopeManagerImpl.getPsiFileResolveScope(ResolveScopeManagerImpl.java:155)
	at com.intellij.psi.impl.file.impl.ResolveScopeManagerImpl.getResolveScope(ResolveScopeManagerImpl.java:142)
	at com.intellij.psi.impl.ResolveScopeManager.getElementResolveScope(ResolveScopeManager.java:36)
	at com.intellij.psi.impl.PsiElementBase.getResolveScope(PsiElementBase.java:172)
	at org.jetbrains.uast.kotlin.KotlinInternalUastUtilsKt.resolveContainingDeserializedClass(kotlinInternalUastUtils.kt:423)
	at org.jetbrains.uast.kotlin.KotlinInternalUastUtilsKt.resolveDeserialized(kotlinInternalUastUtils.kt:468)
	at org.jetbrains.uast.kotlin.KotlinInternalUastUtilsKt.resolveDeserialized$default(kotlinInternalUastUtils.kt:461)
	at org.jetbrains.uast.kotlin.KotlinInternalUastUtilsKt.resolveToPsiMethod(kotlinInternalUastUtils.kt:317)
	at org.jetbrains.uast.kotlin.KotlinInternalUastUtilsKt.resolveToPsiMethod$default(kotlinInternalUastUtils.kt:281)
	at org.jetbrains.uast.kotlin.KotlinInternalUastUtilsKt.resolveToPsiMethod(kotlinInternalUastUtils.kt:279)
	at org.jetbrains.uast.kotlin.KotlinUastResolveProviderService.resolveCall(KotlinUastResolveProviderService.kt:180)
	at org.jetbrains.uast.kotlin.KotlinUFunctionCallExpression.resolve(KotlinUFunctionCallExpression.kt:162)
	at com.intellij.patterns.uast.UCallExpressionPattern$constructor$2.invoke(UastPatterns.kt:175)
	at com.intellij.patterns.uast.UCallExpressionPattern$constructor$2.invoke(UastPatterns.kt:172)
	at com.intellij.patterns.uast.UElementPattern$filterWithContext$1.accepts(UastPatterns.kt:79)
	at com.intellij.patterns.uast.UElementPattern$filterWithContext$1.accepts(UastPatterns.kt:78)
	at com.intellij.patterns.ObjectPattern.accepts(ObjectPattern.java:48)
	at com.intellij.patterns.uast.UastPatterns.isCallExpressionParameter(UastPatterns.kt:114)
	at com.intellij.patterns.uast.UastPatterns.access$isCallExpressionParameter(UastPatterns.kt:1)
	at com.intellij.patterns.uast.UExpressionPattern$callParameter$1.invoke(UastPatterns.kt:227)
	at com.intellij.patterns.uast.UExpressionPattern$callParameter$1.invoke(UastPatterns.kt:227)
	at com.intellij.patterns.uast.UElementPattern$filterWithContext$1.accepts(UastPatterns.kt:79)
	at com.intellij.patterns.uast.UElementPattern$filterWithContext$1.accepts(UastPatterns.kt:78)
	at com.intellij.patterns.ObjectPattern.accepts(ObjectPattern.java:48)
	at com.intellij.patterns.uast.UElementPattern$withUastParentOrSelf$1.invoke(UastPatterns.kt:89)
	at com.intellij.patterns.uast.UElementPattern$withUastParentOrSelf$1.invoke(UastPatterns.kt:88)
	at com.intellij.patterns.uast.UElementPattern$filterWithContext$1.accepts(UastPatterns.kt:79)
	at com.intellij.patterns.uast.UElementPattern$filterWithContext$1.accepts(UastPatterns.kt:78)
	at com.intellij.patterns.ObjectPattern.accepts(ObjectPattern.java:48)
	at com.intellij.psi.UastReferenceRegistrar$registerUastReferenceProvider$1.invoke(UastReferenceRegistrar.kt:29)
	at com.intellij.psi.UastReferenceRegistrar$registerUastReferenceProvider$1.invoke(UastReferenceRegistrar.kt:29)
	at com.intellij.psi.UastPatternAdapter.accepts(UastPatternAdapter.kt:32)
	at com.intellij.psi.impl.source.resolve.reference.NamedObjectProviderBinding.addMatchingProviders(NamedObjectProviderBinding.java:88)
	at com.intellij.psi.impl.source.resolve.reference.SimpleProviderBinding.addAcceptableReferenceProviders(SimpleProviderBinding.java:26)
	at com.intellij.psi.impl.source.resolve.reference.PsiReferenceRegistrarImpl.getPairsByElement(PsiReferenceRegistrarImpl.java:187)
	at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.doGetReferencesFromProviders(ReferenceProvidersRegistryImpl.java:140)
	at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.lambda$getReferencesFromProviders$0(ReferenceProvidersRegistry.java:39)
	at com.intellij.psi.util.CachedValuesManager$1.compute(CachedValuesManager.java:158)
	at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:39)
	at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:231)
	at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:41)
	at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:231)
	at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:112)
	at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:42)
	at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:66)
	at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:232)
	at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:28)
	at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:72)
	at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:155)
	at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:121)
	at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.getReferencesFromProviders(ReferenceProvidersRegistry.java:38)
	at org.jetbrains.kotlin.idea.references.KtIdeReferenceProviderService.getReferences(KtIdeReferenceProviderService.kt:62)
	at org.jetbrains.kotlin.psi.KotlinReferenceProvidersService$Companion.getReferencesFromProviders(KotlinReferenceProvidersService.kt:26)
	at org.jetbrains.kotlin.psi.KotlinReferenceProvidersService.getReferencesFromProviders(KotlinReferenceProvidersService.kt)
	at org.jetbrains.kotlin.psi.KtElementImplStub.getReferences(KtElementImplStub.java:113)
	at org.jetbrains.kotlin.idea.references.ReferenceUtilsKt.getMainReference(referenceUtils.kt:33)
	at org.jetbrains.kotlin.idea.codeInsight.KotlinCopyPasteReferenceProcessor$addReferenceDataInsideElement$reference$1.invoke(KotlinCopyPasteReferenceProcessor.kt:233)
	at org.jetbrains.kotlin.idea.codeInsight.KotlinCopyPasteReferenceProcessor$addReferenceDataInsideElement$reference$1.invoke(KotlinCopyPasteReferenceProcessor.kt:233)
	at org.jetbrains.kotlin.idea.base.util.DumbModeUtils.runReadActionInSmartMode(DumbModeUtils.kt:17)
	at org.jetbrains.kotlin.idea.codeInsight.KotlinCopyPasteReferenceProcessor.addReferenceDataInsideElement(KotlinCopyPasteReferenceProcessor.kt:233)
	at org.jetbrains.kotlin.idea.codeInsight.KotlinCopyPasteReferenceProcessor.access$addReferenceDataInsideElement(KotlinCopyPasteReferenceProcessor.kt:69)
	at org.jetbrains.kotlin.idea.codeInsight.KotlinCopyPasteReferenceProcessor$collectReferenceData$4.invoke(KotlinCopyPasteReferenceProcessor.kt:200)
	at org.jetbrains.kotlin.idea.codeInsight.KotlinCopyPasteReferenceProcessor$collectReferenceData$4.invoke(KotlinCopyPasteReferenceProcessor.kt:197)
	at org.jetbrains.kotlin.idea.base.util.DumbModeUtils.runReadActionInSmartMode$lambda$0(DumbModeUtils.kt:18)
	at com.intellij.openapi.project.DumbService.lambda$runReadActionInSmartMode$0(DumbService.java:112)
	at com.intellij.openapi.project.DumbService.lambda$runReadActionInSmartMode$1(DumbService.java:156)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:898)
	at com.intellij.openapi.application.ReadAction.compute(ReadAction.java:68)
	at com.intellij.openapi.project.DumbService.runReadActionInSmartMode(DumbService.java:149)
	at com.intellij.openapi.project.DumbService.runReadActionInSmartMode(DumbService.java:112)
	at org.jetbrains.kotlin.idea.base.util.DumbModeUtils.runReadActionInSmartMode(DumbModeUtils.kt:18)
	at org.jetbrains.kotlin.idea.codeInsight.KotlinCopyPasteReferenceProcessor.collectReferenceData(KotlinCopyPasteReferenceProcessor.kt:197)
	at org.jetbrains.kotlin.idea.codeInsight.KotlinCopyPasteReferenceProcessor.collectReferenceData(KotlinCopyPasteReferenceProcessor.kt:143)
	at org.jetbrains.kotlin.idea.codeInsight.KotlinCopyPasteReferenceProcessor.findReferenceDataToRestore(KotlinCopyPasteReferenceProcessor.kt:498)
	at org.jetbrains.kotlin.idea.codeInsight.KotlinCopyPasteReferenceProcessor.access$findReferenceDataToRestore(KotlinCopyPasteReferenceProcessor.kt:69)
	at org.jetbrains.kotlin.idea.codeInsight.KotlinCopyPasteReferenceProcessor$processReferenceData$1.invoke(KotlinCopyPasteReferenceProcessor.kt:356)
	at org.jetbrains.kotlin.idea.codeInsight.KotlinCopyPasteReferenceProcessor$processReferenceData$1.invoke(KotlinCopyPasteReferenceProcessor.kt:355)
	at org.jetbrains.kotlin.idea.codeInsight.KotlinCopyPasteReferenceProcessor$processReferenceData$task$1.run(KotlinCopyPasteReferenceProcessor.kt:383)
	at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:429)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$6(CoreProgressManager.java:480)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:252)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:186)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:604)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:173)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:252)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
	at java.base/java.lang.Thread.run(Thread.java:833)

Hi, it seems to be a duplicate of #271 .