Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

org.jetbrains.kotlin.idea.caches.resolve.KotlinIdeaResolutionException: Kotlin resolution encountered a problem while analyzing KtObjectDeclaration #489

Closed
novokrest opened this issue Sep 2, 2023 · 1 comment

Comments

@novokrest
Copy link

novokrest commented Sep 2, 2023

Bug description

Please include steps to reproduce expected and actual behavior.

Environment

  • detekt Idea Version: 1.21.0-RC1
  • Platform Version: 2022.3.2
  • Platform Vendor: JetBrains s.r.o.
  • Java Version: 17.0.5
  • OS Name: Mac OS X

Stacktrace

org.jetbrains.kotlin.idea.caches.resolve.KotlinIdeaResolutionException: Kotlin resolution encountered a problem while analyzing KtObjectDeclaration
	at org.jetbrains.kotlin.idea.caches.resolve.ResolutionFacadeWithDebugInfo.analyze(ResolutionFacadeWithDebugInfo.kt:268)
	at org.jetbrains.kotlin.idea.caches.resolve.ExtendedResolutionApiKt.analyze(ExtendedResolutionApi.kt:124)
	at org.jetbrains.kotlin.idea.caches.resolve.ExtendedResolutionApiKt.safeAnalyze(ExtendedResolutionApi.kt:115)
	at org.jetbrains.kotlin.idea.caches.resolve.ExtendedResolutionApiKt.resolveToDescriptorIfAny(ExtendedResolutionApi.kt:56)
	at org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils.resolveToDescriptorIfAny(ResolutionUtils.kt:57)
	at org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils.resolveToDescriptorIfAny$default(ResolutionUtils.kt:54)
	at org.jetbrains.kotlin.idea.completion.KotlinProximityStatistician.serialize(Statisticians.kt:41)
	at org.jetbrains.kotlin.idea.completion.KotlinProximityStatistician.serialize(Statisticians.kt:38)
	at com.intellij.psi.statistics.StatisticsManager.serialize(StatisticsManager.java:29)
	at com.intellij.psi.util.proximity.PsiProximityComparator.compare(PsiProximityComparator.java:63)
	at com.intellij.ide.util.gotoByName.DefaultChooseByNameItemProvider$PathProximityComparator.compare(DefaultChooseByNameItemProvider.java:443)
	at com.intellij.ide.util.gotoByName.DefaultChooseByNameItemProvider$1.compare(DefaultChooseByNameItemProvider.java:242)
	at com.intellij.ide.util.gotoByName.DefaultChooseByNameItemProvider$1.compare(DefaultChooseByNameItemProvider.java:235)
	at java.base/java.util.TimSort.binarySort(TimSort.java:296)
	at java.base/java.util.TimSort.sort(TimSort.java:221)
	at java.base/java.util.Arrays.sort(Arrays.java:1307)
	at com.intellij.util.SmartList.sort(SmartList.java:209)
	at com.intellij.ide.util.gotoByName.DefaultChooseByNameItemProvider.processByNames(DefaultChooseByNameItemProvider.java:266)
	at com.intellij.ide.util.gotoByName.DefaultChooseByNameItemProvider.filterElements(DefaultChooseByNameItemProvider.java:117)
	at com.intellij.ide.util.gotoByName.DefaultChooseByNameItemProvider.lambda$filterElementsWithWeights$3(DefaultChooseByNameItemProvider.java:75)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787)
	at com.intellij.ide.util.gotoByName.DefaultChooseByNameItemProvider.filterElementsWithWeights(DefaultChooseByNameItemProvider.java:74)
	at com.intellij.ide.actions.searcheverywhere.AbstractGotoSEContributor.lambda$fetchWeightedElements$4(AbstractGotoSEContributor.java:244)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1111)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runInReadActionWithWriteActionPriority$0(ProgressIndicatorUtils.java:71)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtilService.runActionAndCancelBeforeWrite(ProgressIndicatorUtilService.java:63)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:128)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runWithWriteActionPriority$1(ProgressIndicatorUtils.java:109)
	at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:68)
	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.ProgressManager.runProcess(ProgressManager.java:68)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runWithWriteActionPriority(ProgressIndicatorUtils.java:106)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(ProgressIndicatorUtils.java:71)
	at com.intellij.ide.actions.searcheverywhere.AbstractGotoSEContributor.fetchWeightedElements(AbstractGotoSEContributor.java:270)
	at com.intellij.ide.actions.searcheverywhere.PSIPresentationBgRendererWrapper.fetchWeightedElements(PSIPresentationBgRendererWrapper.java:67)
	at com.intellij.ide.actions.searcheverywhere.MixedResultsSearcher$ContributorSearchTask.run(MixedResultsSearcher.java:183)
	at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:212)
	at com.intellij.util.ConcurrencyUtil.lambda$underThreadNameRunnable$3(ConcurrencyUtil.java:200)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:246)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	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)
Caused by: java.lang.AssertionError: Recursion detected on input: Companion under LockBasedStorageManager@60c54fea (project source roots and libraries)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.AbstractLazyMemberScope.getContributedClassifier(AbstractLazyMemberScope.kt:77)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.computeCompanionObjectDescriptor(LazyClassDescriptor.java:532)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.lambda$new$3(LazyClassDescriptor.java:220)
	at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.getCompanionObjectDescriptor(LazyClassDescriptor.java:494)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.getCompanionObjectDescriptor(LazyClassDescriptor.java:65)
	at org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt.getClassValueTypeDescriptor(DescriptorUtils.kt:117)
	at org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt.getClassValueType(DescriptorUtils.kt:123)
	at org.jetbrains.kotlin.resolve.scopes.receivers.ClassQualifier.<init>(Qualifier.kt:69)
	at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.storeQualifier(QualifiedExpressionResolver.kt:802)
	at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.storeResult(QualifiedExpressionResolver.kt:791)
	at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.storeResult$default(QualifiedExpressionResolver.kt:761)
	at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.resolveToPackageOrClassPrefix(QualifiedExpressionResolver.kt:556)
	at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.resolveToPackageOrClassPrefix$default(QualifiedExpressionResolver.kt:481)
	at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.resolveToPackageOrClass(QualifiedExpressionResolver.kt:469)
	at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.processSingleImport(QualifiedExpressionResolver.kt:330)
	at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.doProcessImportReference(QualifiedExpressionResolver.kt:282)
	at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.processImportReference$processReferenceInContextOf(QualifiedExpressionResolver.kt:229)
	at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.processImportReference(QualifiedExpressionResolver.kt:237)
	at org.jetbrains.kotlin.resolve.lazy.LazyImportResolver$importedScopesProvider$1$1.invoke(LazyImportScope.kt:108)
	at org.jetbrains.kotlin.resolve.lazy.LazyImportResolver$importedScopesProvider$1$1.invoke(LazyImportScope.kt:107)
	at org.jetbrains.kotlin.storage.LockBasedStorageManager$MapBasedMemoizedFunction.invoke(LockBasedStorageManager.java:578)
	at org.jetbrains.kotlin.resolve.lazy.LazyImportResolver.getImportScope(LazyImportScope.kt:126)
	at org.jetbrains.kotlin.resolve.lazy.LazyImportScope$getClassifier$1.invoke(LazyImportScope.kt:266)
	at org.jetbrains.kotlin.resolve.lazy.LazyImportScope$getClassifier$1.invoke(LazyImportScope.kt:261)
	at org.jetbrains.kotlin.storage.LockBasedStorageManager.compute(LockBasedStorageManager.java:290)
	at org.jetbrains.kotlin.resolve.lazy.LazyImportScope.getClassifier(LazyImportScope.kt:261)
	at org.jetbrains.kotlin.resolve.lazy.LazyImportScope.getContributedClassifier(LazyImportScope.kt:257)
	at org.jetbrains.kotlin.resolve.scopes.ResolutionScope$DefaultImpls.getContributedClassifierIncludeDeprecated(ResolutionScope.kt:40)
	at org.jetbrains.kotlin.resolve.scopes.HierarchicalScope$DefaultImpls.getContributedClassifierIncludeDeprecated(Scopes.kt:27)
	at org.jetbrains.kotlin.resolve.scopes.ImportingScope$DefaultImpls.getContributedClassifierIncludeDeprecated(Scopes.kt:113)
	at org.jetbrains.kotlin.resolve.lazy.LazyImportScope.getContributedClassifierIncludeDeprecated(LazyImportScope.kt:222)
	at org.jetbrains.kotlin.resolve.scopes.utils.ScopeUtilsKt.findFirstClassifierWithDeprecationStatus(ScopeUtils.kt:119)
	at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.findClassifierAndReportDeprecationIfNeeded(QualifiedExpressionResolver.kt:82)
	at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.resolveDescriptorForType(QualifiedExpressionResolver.kt:106)
	at org.jetbrains.kotlin.resolve.TypeResolver.resolveDescriptorForType(TypeResolver.kt:1053)
	at org.jetbrains.kotlin.resolve.TypeResolver$resolveTypeElement$1.visitUserType(TypeResolver.kt:259)
	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitUserType(KtVisitorVoid.java:937)
	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitUserType(KtVisitorVoid.java:21)
	at org.jetbrains.kotlin.psi.KtUserType.accept(KtUserType.java:42)
	at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:49)
	at org.jetbrains.kotlin.resolve.TypeResolver.resolveTypeElement(TypeResolver.kt:257)
	at org.jetbrains.kotlin.resolve.TypeResolver.resolvePossiblyBareType(TypeResolver.kt:136)
	at org.jetbrains.kotlin.resolve.TypeResolver.resolveType(TypeResolver.kt:126)
	at org.jetbrains.kotlin.resolve.TypeResolver.resolveTypeProjections(TypeResolver.kt:1006)
	at org.jetbrains.kotlin.resolve.TypeResolver.resolveTypeForClass(TypeResolver.kt:615)
	at org.jetbrains.kotlin.resolve.TypeResolver.resolveTypeForClassifier(TypeResolver.kt:582)
	at org.jetbrains.kotlin.resolve.TypeResolver$resolveTypeElement$1.visitUserType(TypeResolver.kt:278)
	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitUserType(KtVisitorVoid.java:937)
	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitUserType(KtVisitorVoid.java:21)
	at org.jetbrains.kotlin.psi.KtUserType.accept(KtUserType.java:42)
	at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:49)
	at org.jetbrains.kotlin.resolve.TypeResolver.resolveTypeElement(TypeResolver.kt:257)
	at org.jetbrains.kotlin.resolve.TypeResolver.resolvePossiblyBareType(TypeResolver.kt:136)
	at org.jetbrains.kotlin.resolve.TypeResolver.resolveType(TypeResolver.kt:126)
	at org.jetbrains.kotlin.resolve.TypeResolver.resolveType(TypeResolver.kt:97)
	at org.jetbrains.kotlin.resolve.DescriptorResolver.resolveSuperTypeListEntries(DescriptorResolver.java:216)
	at org.jetbrains.kotlin.resolve.DescriptorResolver.resolveSupertypes(DescriptorResolver.java:152)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.computeSupertypes(LazyClassDescriptor.java:873)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor$LazyClassTypeConstructor.computeSupertypes(LazyClassDescriptor.java:770)
	at org.jetbrains.kotlin.types.AbstractTypeConstructor$supertypes$1.invoke(AbstractTypeConstructor.kt:78)
	at org.jetbrains.kotlin.types.AbstractTypeConstructor$supertypes$1.invoke(AbstractTypeConstructor.kt:77)
	at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
	at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValueWithPostCompute.invoke(LockBasedStorageManager.java:481)
	at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedNotNullLazyValueWithPostCompute.invoke(LockBasedStorageManager.java:512)
	at org.jetbrains.kotlin.types.AbstractTypeConstructor.getSupertypes(AbstractTypeConstructor.kt:27)
	at org.jetbrains.kotlin.types.AbstractTypeConstructor.getSupertypes(AbstractTypeConstructor.kt:26)
	at org.jetbrains.kotlin.types.TypeUtils.getImmediateSupertypes(TypeUtils.java:249)
	at org.jetbrains.kotlin.types.TypeUtils.collectAllSupertypes(TypeUtils.java:274)
	at org.jetbrains.kotlin.types.TypeUtils.getAllSupertypes(TypeUtils.java:287)
	at org.jetbrains.kotlin.extensions.AnnotationBasedExtension.hasSpecialAnnotation(AnnotationBasedExtension.kt:36)
	at org.jetbrains.kotlin.allopen.AbstractAllOpenDeclarationAttributeAltererExtension.refineDeclarationModality(AllOpenDeclarationAttributeAltererExtension.kt:51)
	at org.jetbrains.kotlin.resolve.ModifiersChecker.resolveModalityFromModifiers(ModifiersChecker.java:91)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.lambda$new$2(LazyClassDescriptor.java:151)
	at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
	at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedNotNullLazyValue.invoke(LockBasedStorageManager.java:527)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.getModality(LazyClassDescriptor.java:584)
	at org.jetbrains.kotlinx.serialization.compiler.resolve.KSerializationUtilKt.getShouldHaveGeneratedSerializer(KSerializationUtil.kt:138)
	at org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationResolveExtension.generateSyntheticClasses(SerializationResolveExtension.kt:78)
	at org.jetbrains.kotlin.idea.compilerPlugin.kotlinxSerialization.compiler.extensions.SerializationIDEResolveExtension.access$generateSyntheticClasses$s-988879965(SerializationIDEResolveExtension.kt:18)
	at org.jetbrains.kotlin.idea.compilerPlugin.kotlinxSerialization.compiler.extensions.SerializationIDEResolveExtension$generateSyntheticClasses$1.invoke(SerializationIDEResolveExtension.kt:38)
	at org.jetbrains.kotlin.idea.compilerPlugin.kotlinxSerialization.compiler.extensions.SerializationIDEResolveExtension$generateSyntheticClasses$1.invoke(SerializationIDEResolveExtension.kt:37)
	at org.jetbrains.kotlin.idea.compilerPlugin.kotlinxSerialization.SerializationSwitchUtilsKt.getIfEnabledOn(SerializationSwitchUtils.kt:20)
	at org.jetbrains.kotlin.idea.compilerPlugin.kotlinxSerialization.SerializationSwitchUtilsKt.runIfEnabledOn(SerializationSwitchUtils.kt:23)
	at org.jetbrains.kotlin.idea.compilerPlugin.kotlinxSerialization.compiler.extensions.SerializationIDEResolveExtension.generateSyntheticClasses(SerializationIDEResolveExtension.kt:37)
	at org.jetbrains.kotlin.resolve.extensions.SyntheticResolveExtension$Companion$getInstance$1.generateSyntheticClasses(SyntheticResolveExtension.kt:66)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope.getNonDeclaredClasses(LazyClassMemberScope.kt:287)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.AbstractLazyMemberScope.doGetClasses(AbstractLazyMemberScope.kt:70)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.AbstractLazyMemberScope.access$doGetClasses(AbstractLazyMemberScope.kt:38)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.AbstractLazyMemberScope$classDescriptors$1.invoke(AbstractLazyMemberScope.kt:49)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.AbstractLazyMemberScope$classDescriptors$1.invoke(AbstractLazyMemberScope.kt:49)
	at org.jetbrains.kotlin.storage.LockBasedStorageManager$MapBasedMemoizedFunction.invoke(LockBasedStorageManager.java:578)
	at org.jetbrains.kotlin.storage.LockBasedStorageManager$MapBasedMemoizedFunctionToNotNull.invoke(LockBasedStorageManager.java:651)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.AbstractLazyMemberScope.getContributedClassifier(AbstractLazyMemberScope.kt:77)
	at org.jetbrains.kotlin.resolve.lazy.LazyDeclarationResolver.findClassDescriptorIfAny(LazyDeclarationResolver.kt:77)
	at org.jetbrains.kotlin.resolve.lazy.LazyDeclarationResolver.getClassDescriptorIfAny(LazyDeclarationResolver.kt:59)
	at org.jetbrains.kotlin.resolve.lazy.LazyDeclarationResolver$resolveToDescriptor$1.visitObjectDeclaration(LazyDeclarationResolver.kt:103)
	at org.jetbrains.kotlin.resolve.lazy.LazyDeclarationResolver$resolveToDescriptor$1.visitObjectDeclaration(LazyDeclarationResolver.kt:94)
	at org.jetbrains.kotlin.psi.KtObjectDeclaration.accept(KtObjectDeclaration.kt:63)
	at org.jetbrains.kotlin.resolve.lazy.LazyDeclarationResolver.resolveToDescriptor(LazyDeclarationResolver.kt:94)
	at org.jetbrains.kotlin.resolve.lazy.LazyDeclarationResolver.resolveToDescriptor(LazyDeclarationResolver.kt:91)
	at org.jetbrains.kotlin.resolve.lazy.ResolveSession.resolveToDescriptor(ResolveSession.java:368)
	at org.jetbrains.kotlin.idea.project.ResolveElementCache.resolveToElement(ResolveElementCache.kt:290)
	at org.jetbrains.kotlin.idea.caches.resolve.ModuleResolutionFacadeImpl$analyze$3.invoke(ModuleResolutionFacadeImpl.kt:53)
	at org.jetbrains.kotlin.idea.caches.resolve.ModuleResolutionFacadeImpl$analyze$3.invoke(ModuleResolutionFacadeImpl.kt:52)
	at com.intellij.openapi.progress.impl.CancellationCheck.withCancellationCheck(CancellationCheck.kt:59)
	at com.intellij.openapi.progress.impl.CancellationCheck$Companion.runWithCancellationCheck(CancellationCheck.kt:105)
	at org.jetbrains.kotlin.idea.util.application.ApplicationUtilsKt.runWithCancellationCheck(ApplicationUtils.kt:58)
	at org.jetbrains.kotlin.idea.caches.resolve.ModuleResolutionFacadeImpl.analyze(ModuleResolutionFacadeImpl.kt:52)
	at org.jetbrains.kotlin.idea.caches.resolve.ResolutionFacadeWithDebugInfo.analyze(ResolutionFacadeWithDebugInfo.kt:44)
	... 53 more
@arturbosch
Copy link
Member

Duplicate of #271

@arturbosch arturbosch marked this as a duplicate of #271 Sep 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants