klesun / deep-assoc-completion

A phpstorm plugin for associative array key typing and completion
Other
266 stars 17 forks source link

java.lang.RuntimeException: java.lang.IndexOutOfBoundsException #198

Open AbdelrahmanMohamedDesoky opened 2 years ago

AbdelrahmanMohamedDesoky commented 2 years ago

I was just exploring a large class/file 10000+ lines of code and suddenly I keep getting exceptions from deep-assoc-completion.

Here is the stacktrace

java.lang.RuntimeException: java.lang.IndexOutOfBoundsException
    at com.intellij.util.io.PersistentEnumeratorBase.catchCorruption(PersistentEnumeratorBase.java:628)
    at com.intellij.util.io.PersistentEnumeratorBase.doEnumerate(PersistentEnumeratorBase.java:266)
    at com.intellij.util.io.PersistentEnumeratorBase.tryEnumerate(PersistentEnumeratorBase.java:257)
    at com.intellij.util.io.PersistentMapImpl.doGet(PersistentMapImpl.java:583)
    at com.intellij.util.io.PersistentMapImpl.get(PersistentMapImpl.java:545)
    at com.intellij.util.indexing.impl.ValueContainerMap.lambda$getModifiableValueContainer$0(ValueContainerMap.java:77)
    at com.intellij.util.indexing.impl.ChangeTrackingValueContainer.getMergedData(ChangeTrackingValueContainer.java:98)
    at com.intellij.util.indexing.impl.ChangeTrackingValueContainer.getValueIterator(ChangeTrackingValueContainer.java:77)
    at com.intellij.util.indexing.impl.MergedValueContainer$1.<init>(MergedValueContainer.java:27)
    at com.intellij.util.indexing.impl.MergedValueContainer.getValueIterator(MergedValueContainer.java:25)
    at com.intellij.util.indexing.impl.MergedValueContainer.getValueIterator(MergedValueContainer.java:11)
    at com.intellij.util.indexing.FileBasedIndexEx.lambda$processValueIterator$10(FileBasedIndexEx.java:350)
    at com.intellij.util.indexing.FileBasedIndexEx.lambda$processExceptions$5(FileBasedIndexEx.java:248)
    at com.intellij.util.ConcurrencyUtil.withLock(ConcurrencyUtil.java:234)
    at com.intellij.util.indexing.FileBasedIndexEx.lambda$processExceptions$6(FileBasedIndexEx.java:248)
    at com.intellij.util.indexing.diagnostic.IndexAccessValidator.validate(IndexAccessValidator.java:42)
    at com.intellij.util.indexing.FileBasedIndexEx.processExceptions(FileBasedIndexEx.java:248)
    at com.intellij.util.indexing.FileBasedIndexEx.processValueIterator(FileBasedIndexEx.java:349)
    at com.intellij.util.indexing.FileBasedIndexEx.processValuesInScope(FileBasedIndexEx.java:318)
    at com.intellij.util.indexing.FileBasedIndexEx.getValues(FileBasedIndexEx.java:111)
    at com.jetbrains.php.lang.classAlias.PhpClassAliasIndexImpl.getAliasesByName(PhpClassAliasIndexImpl.java:113)
    at com.jetbrains.php.lang.classAlias.PhpClassAliasIndexImpl.getAliasesByName(PhpClassAliasIndexImpl.java:103)
    at com.jetbrains.php.lang.classAlias.PhpClassAliasIndexImpl.getAllAliasesByName(PhpClassAliasIndexImpl.java:97)
    at com.jetbrains.php.PhpIndexImpl.getAliasesByName(PhpIndexImpl.java:1028)
    at com.jetbrains.php.PhpIndexImpl.addAliases(PhpIndexImpl.java:1083)
    at com.jetbrains.php.PhpIndexImpl.getAnyByFQN(PhpIndexImpl.java:1114)
    at com.jetbrains.php.PhpIndexImpl.getBySignatureInternal(PhpIndexImpl.java:744)
    at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:680)
    at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:667)
    at com.jetbrains.php.lang.psi.resolve.types.PhpParameterBasedTypeProvider.getTargets(PhpParameterBasedTypeProvider.java:438)
    at com.jetbrains.php.lang.psi.resolve.types.PhpParameterBasedTypeProvider.getBySignature(PhpParameterBasedTypeProvider.java:271)
    at com.jetbrains.php.PhpIndexImpl.getBySignatureInternal(PhpIndexImpl.java:794)
    at com.jetbrains.php.PhpIndexImpl.getBySignature(PhpIndexImpl.java:680)
    at com.jetbrains.php.PhpIndexImpl.doCompleteType(PhpIndexImpl.java:189)
    at com.jetbrains.php.PhpIndexImpl.completeType(PhpIndexImpl.java:120)
    at com.jetbrains.php.PhpIndexImpl.completeType(PhpIndexImpl.java:99)
    at com.jetbrains.php.lang.psi.resolve.types.PhpType.global(PhpType.java:760)
    at com.jetbrains.php.lang.psi.elements.PhpTypedElement.getGlobalType(PhpTypedElement.java:57)
    at com.jetbrains.php.lang.psi.elements.impl.MemberReferenceImpl.resolveInHierarchyInner(MemberReferenceImpl.java:190)
    at com.jetbrains.php.lang.psi.elements.impl.MemberReferenceImpl.lambda$resolveInHierarchy$1(MemberReferenceImpl.java:182)
    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:227)
    at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:42)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:227)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:114)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:44)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:68)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:228)
    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.jetbrains.php.lang.psi.elements.impl.MemberReferenceImpl.resolveInHierarchy(MemberReferenceImpl.java:181)
    at com.jetbrains.php.lang.psi.elements.impl.PhpBaseMemberReference.resolveGlobal(PhpBaseMemberReference.java:51)
    at com.jetbrains.php.lang.psi.elements.impl.MemberReferenceImpl.resolveGlobal(MemberReferenceImpl.java:167)
    at com.jetbrains.php.lang.psi.elements.impl.MethodReferenceImpl.resolveGlobal(MethodReferenceImpl.java:103)
    at com.jetbrains.php.lang.psi.elements.impl.PhpReferenceImpl.lambda$static$0(PhpReferenceImpl.java:159)
    at com.intellij.psi.impl.source.resolve.ResolveCache$PolyVariantResolver.resolve(ResolveCache.java:69)
    at com.intellij.psi.impl.source.resolve.ResolveCache.lambda$resolve$1(ResolveCache.java:154)
    at com.intellij.openapi.util.Computable.get(Computable.java:18)
    at com.intellij.psi.impl.source.resolve.ResolveCache.lambda$loggingResolver$4(ResolveCache.java:260)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:114)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:44)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:68)
    at com.intellij.psi.impl.source.resolve.ResolveCache.resolve(ResolveCache.java:237)
    at com.intellij.psi.impl.source.resolve.ResolveCache.resolve(ResolveCache.java:154)
    at com.intellij.psi.impl.source.resolve.ResolveCache.resolveWithCaching(ResolveCache.java:169)
    at com.intellij.psi.impl.source.resolve.ResolveCache.resolveWithCaching(ResolveCache.java:162)
    at com.jetbrains.php.lang.psi.elements.impl.PhpReferenceImpl.multiResolve(PhpReferenceImpl.java:153)
    at org.klesun.deep_assoc_completion.resolvers.UsageBasedTypeResolver.lambda$resolveFunc$25(UsageBasedTypeResolver.java:136)
    at org.klesun.lang.Opt.map(Opt.java:50)
    at org.klesun.lang.Opt.fop(Opt.java:71)
    at org.klesun.deep_assoc_completion.resolvers.UsageBasedTypeResolver.lambda$resolveFunc$26(UsageBasedTypeResolver.java:136)
    at org.klesun.lang.Opt.fst(Opt.java:161)
    at org.klesun.deep_assoc_completion.resolvers.UsageBasedTypeResolver.lambda$resolveFunc$34(UsageBasedTypeResolver.java:134)
    at org.klesun.lang.Opt.map(Opt.java:50)
    at org.klesun.lang.Opt.fop(Opt.java:71)
    at org.klesun.deep_assoc_completion.resolvers.UsageBasedTypeResolver.resolveFunc(UsageBasedTypeResolver.java:134)
    at org.klesun.deep_assoc_completion.resolvers.UsageBasedTypeResolver.findArgExprTypeFromUsage(UsageBasedTypeResolver.java:354)
    at org.klesun.deep_assoc_completion.resolvers.UsageBasedTypeResolver.lambda$resolve$166(UsageBasedTypeResolver.java:552)
    at org.klesun.lang.IIt.lambda$fap$1(IIt.java:28)
    at org.klesun.lang.iterators.FlatMapIterator.lambda$new$1(FlatMapIterator.java:17)
    at org.klesun.lang.iterators.MapIterator.next(MapIterator.java:23)
    at org.klesun.lang.iterators.MapIterator.next(MapIterator.java:23)
    at org.klesun.lang.iterators.FlatMapIterator.getNextSup(FlatMapIterator.java:33)
    at org.klesun.lang.iterators.FlatMapIterator.hasNext(FlatMapIterator.java:43)
    at org.klesun.lang.iterators.FlatMapIterator.getNextSup(FlatMapIterator.java:34)
    at org.klesun.lang.iterators.FlatMapIterator.hasNext(FlatMapIterator.java:43)
    at org.klesun.lang.MemIt$1.hasNext(MemIt.java:38)
    at org.klesun.lang.iterators.FlatMapIterator.getNextSup(FlatMapIterator.java:34)
    at org.klesun.lang.iterators.FlatMapIterator.hasNext(FlatMapIterator.java:43)
    at org.klesun.lang.iterators.FlatMapIterator.getNextSup(FlatMapIterator.java:34)
    at org.klesun.lang.iterators.FlatMapIterator.hasNext(FlatMapIterator.java:43)
    at org.klesun.lang.iterators.FlatMapIterator.getNextSup(FlatMapIterator.java:34)
    at org.klesun.lang.iterators.FlatMapIterator.hasNext(FlatMapIterator.java:43)
    at org.klesun.lang.iterators.FlatMapIterator.getNextSup(FlatMapIterator.java:29)
    at org.klesun.lang.iterators.FlatMapIterator.hasNext(FlatMapIterator.java:43)
    at org.klesun.lang.iterators.FlatMapIterator.getNextSup(FlatMapIterator.java:29)
    at org.klesun.lang.iterators.FlatMapIterator.hasNext(FlatMapIterator.java:43)
    at org.klesun.lang.iterators.FlatMapIterator.getNextSup(FlatMapIterator.java:29)
    at org.klesun.lang.iterators.FlatMapIterator.hasNext(FlatMapIterator.java:43)
    at org.klesun.lang.iterators.FlatMapIterator.getNextSup(FlatMapIterator.java:29)
    at org.klesun.lang.iterators.FlatMapIterator.hasNext(FlatMapIterator.java:43)
    at org.klesun.lang.iterators.FlatMapIterator.getNextSup(FlatMapIterator.java:29)
    at org.klesun.lang.iterators.FlatMapIterator.hasNext(FlatMapIterator.java:43)
    at org.klesun.lang.iterators.FlatMapIterator.getNextSup(FlatMapIterator.java:29)
    at org.klesun.lang.iterators.FlatMapIterator.hasNext(FlatMapIterator.java:43)
    at org.klesun.lang.iterators.FlatMapIterator.getNextSup(FlatMapIterator.java:29)
    at org.klesun.lang.iterators.FlatMapIterator.hasNext(FlatMapIterator.java:43)
    at org.klesun.lang.MemIt$1.hasNext(MemIt.java:38)
    at org.klesun.lang.iterators.FlatMapIterator.getNextSup(FlatMapIterator.java:29)
    at org.klesun.lang.iterators.FlatMapIterator.hasNext(FlatMapIterator.java:43)
    at org.klesun.lang.iterators.MapIterator.hasNext(MapIterator.java:19)
    at org.klesun.lang.iterators.FlatMapIterator.getNextSup(FlatMapIterator.java:29)
    at org.klesun.lang.iterators.FlatMapIterator.hasNext(FlatMapIterator.java:43)
    at org.klesun.lang.iterators.FilterIterator.getCurrent(FilterIterator.java:25)
    at org.klesun.lang.iterators.FilterIterator.hasNext(FilterIterator.java:38)
    at org.klesun.lang.iterators.MapIterator.hasNext(MapIterator.java:19)
    at org.klesun.lang.iterators.FlatMapIterator.getNextSup(FlatMapIterator.java:34)
    at org.klesun.lang.iterators.FlatMapIterator.hasNext(FlatMapIterator.java:43)
    at org.klesun.lang.iterators.FlatMapIterator.getNextSup(FlatMapIterator.java:34)
    at org.klesun.lang.iterators.FlatMapIterator.hasNext(FlatMapIterator.java:43)
    at org.klesun.lang.iterators.FlatMapIterator.getNextSup(FlatMapIterator.java:34)
    at org.klesun.lang.iterators.FlatMapIterator.hasNext(FlatMapIterator.java:43)
    at org.klesun.lang.iterators.FilterIterator.getCurrent(FilterIterator.java:25)
    at org.klesun.lang.iterators.FilterIterator.hasNext(FilterIterator.java:38)
    at org.klesun.lang.iterators.FilterIterator.getCurrent(FilterIterator.java:25)
    at org.klesun.lang.iterators.FilterIterator.hasNext(FilterIterator.java:38)
    at org.klesun.lang.iterators.MapIterator.hasNext(MapIterator.java:19)
    at org.klesun.lang.iterators.FlatMapIterator.getNextSup(FlatMapIterator.java:34)
    at org.klesun.lang.iterators.FlatMapIterator.hasNext(FlatMapIterator.java:43)
    at org.klesun.lang.iterators.EndIterator.getCurrent(EndIterator.java:20)
    at org.klesun.lang.iterators.EndIterator.hasNext(EndIterator.java:41)
    at org.klesun.lang.iterators.FilterIterator.getCurrent(FilterIterator.java:25)
    at org.klesun.lang.iterators.FilterIterator.hasNext(FilterIterator.java:38)
    at java.base/java.util.Iterator.forEachRemaining(Iterator.java:132)
    at org.klesun.lang.IIt.arr(IIt.java:149)
    at org.klesun.deep_assoc_completion.go_to_decl_providers.MainGoToDecl.getGotoDeclarationTargets(MainGoToDecl.java:116)
    at com.intellij.codeInsight.navigation.impl.GtdProvidersKt.fromGTDProvidersInner(gtdProviders.kt:31)
    at com.intellij.codeInsight.navigation.impl.GtdProvidersKt.access$fromGTDProvidersInner(gtdProviders.kt:1)
    at com.intellij.codeInsight.navigation.impl.GtdProvidersKt$fromGTDProviders$1.invoke(gtdProviders.kt:18)
    at com.intellij.codeInsight.navigation.impl.GtdProvidersKt$fromGTDProviders$1.invoke(gtdProviders.kt)
    at com.intellij.codeInsight.navigation.impl.CommonKt.processInjectionThenHost(common.kt:26)
    at com.intellij.codeInsight.navigation.impl.GtdProvidersKt.fromGTDProviders(gtdProviders.kt:17)
    at com.intellij.codeInsight.navigation.actions.GotoDeclarationOrUsageHandler2.gotoDeclarationOrUsages(GotoDeclarationOrUsageHandler2.kt:29)
    at com.intellij.codeInsight.navigation.actions.GotoDeclarationOrUsageHandler2.getCtrlMouseInfo(GotoDeclarationOrUsageHandler2.kt:35)
    at com.intellij.codeInsight.navigation.actions.GotoDeclarationAction.getCtrlMouseInfo(GotoDeclarationAction.java:94)
    at com.intellij.codeInsight.navigation.CtrlMouseHandler$TooltipProvider.doExecute(CtrlMouseHandler.java:392)
    at com.intellij.codeInsight.navigation.CtrlMouseHandler$TooltipProvider.lambda$execute$0(CtrlMouseHandler.java:370)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.insideReadAction(NonBlockingReadActionImpl.java:521)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$attemptComputation$3(NonBlockingReadActionImpl.java:486)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1084)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runInReadActionWithWriteActionPriority$0(ProgressIndicatorUtils.java:75)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:158)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runWithWriteActionPriority$1(ProgressIndicatorUtils.java:115)
    at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:57)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:188)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:624)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:698)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:646)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:623)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:175)
    at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:57)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runWithWriteActionPriority(ProgressIndicatorUtils.java:112)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(ProgressIndicatorUtils.java:75)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.attemptComputation(NonBlockingReadActionImpl.java:486)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$transferToBgThread$1(NonBlockingReadActionImpl.java:407)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
    at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IndexOutOfBoundsException
    at java.base/java.nio.Buffer.checkIndex(Buffer.java:687)
    at java.base/java.nio.DirectByteBuffer.get(DirectByteBuffer.java:269)
    at com.intellij.util.io.DirectBufferWrapper.get(DirectBufferWrapper.java:62)
    at com.intellij.util.io.keyStorage.AppendableStorageBackedByResizableMappedFile$3.write(AppendableStorageBackedByResizableMappedFile.java:207)
    at java.base/java.io.OutputStream.write(OutputStream.java:157)
    at com.intellij.util.io.DataOutputStream.write(DataOutputStream.java:35)
    at com.intellij.util.io.IOUtil.writeUTFFast(IOUtil.java:119)
    at com.intellij.util.io.IOUtil.writeUTF(IOUtil.java:94)
    at com.intellij.util.io.EnumeratorStringDescriptor.save(EnumeratorStringDescriptor.java:35)
    at com.intellij.util.io.EnumeratorStringDescriptor$EnumeratorStringDescriptorImpl.save(EnumeratorStringDescriptor.java:16)
    at com.intellij.util.io.keyStorage.AppendableStorageBackedByResizableMappedFile.checkBytesAreTheSame(AppendableStorageBackedByResizableMappedFile.java:165)
    at com.intellij.util.io.PersistentEnumeratorBase.isKeyAtIndex(PersistentEnumeratorBase.java:370)
    at com.intellij.util.io.PersistentBTreeEnumerator.enumerateImpl(PersistentBTreeEnumerator.java:528)
    at com.intellij.util.io.PersistentEnumeratorBase.lambda$doEnumerate$0(PersistentEnumeratorBase.java:267)
    at com.intellij.util.io.PersistentEnumeratorBase.catchCorruption(PersistentEnumeratorBase.java:608)
    ... 175 more
klesun commented 2 years ago

Wow, that looks bad. Is this 10000+ lines of code class proprietary? If not, could you share it?

I'm afraid the only option for you now is to disable deep-assoc-completion when editing this file.