odoo-ide / pycharm-odoo

PyCharm plugin for Odoo
https://plugins.jetbrains.com/plugin/13499-odoo
Other
41 stars 5 forks source link

com.intellij.psi.PsiInvalidElementAccessException in OdooModelClassType.getAncestorTypes #386

Closed IJOL closed 1 year ago

IJOL commented 1 year ago

In file: file:///home/nacho/git/odoo120/odoo/addons/stock/models/stock_move.py

com.intellij.psi.PsiInvalidElementAccessException: Element class com.intellij.psi.impl.source.tree.CompositeElement of type Py:CLASS_DECLARATION (class com.jetbrains.python.psi.impl.stubs.PyClassElementType) at com.intellij.psi.PsiInvalidElementAccessException.createByNode(PsiInvalidElementAccessException.java:80) at com.intellij.psi.impl.source.SubstrateRef$2.getContainingFile(SubstrateRef.java:98) at com.intellij.extapi.psi.StubBasedPsiElementBase.getContainingFile(StubBasedPsiElementBase.java:239) at com.intellij.codeInsight.completion.CompletionUtilCoreImpl.getOriginalElement(CompletionUtilCoreImpl.java:19) at com.jetbrains.python.psi.types.PyClassTypeImpl.(PyClassTypeImpl.java:55) at dev.ngocta.pycharm.odoo.model.OdooModelClassType.lambda$getAncestorTypes$3(OdooModelClassType.java:189) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1092) at dev.ngocta.pycharm.odoo.model.OdooModelClassType.getAncestorTypes(OdooModelClassType.java:188) at com.jetbrains.python.codeInsight.stdlib.PyNamedTupleTypeProvider$Companion.getFieldTypeForTypingNTFunctionInheritor(PyNamedTupleTypeProvider.kt:97) at com.jetbrains.python.codeInsight.stdlib.PyNamedTupleTypeProvider$Companion.access$getFieldTypeForTypingNTFunctionInheritor(PyNamedTupleTypeProvider.kt:53) at com.jetbrains.python.codeInsight.stdlib.PyNamedTupleTypeProvider.getReferenceExpressionType(PyNamedTupleTypeProvider.kt:36) at com.jetbrains.python.psi.impl.PyReferenceExpressionImpl.getTypeFromProviders(PyReferenceExpressionImpl.java:379) at com.jetbrains.python.psi.impl.PyReferenceExpressionImpl.getType(PyReferenceExpressionImpl.java:215) at dev.ngocta.pycharm.odoo.python.psi.OdooPyReferenceExpression.getType(OdooPyReferenceExpression.java:43) at com.jetbrains.python.psi.types.TypeEvalContext.lambda$getType$0(TypeEvalContext.java:181) 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.jetbrains.python.psi.types.TypeEvalContext.getType(TypeEvalContext.java:170) at dev.ngocta.pycharm.odoo.python.OdooPyUtils.isEnvironmentTypeExpression(OdooPyUtils.java:320) at dev.ngocta.pycharm.odoo.model.OdooModelReferenceContributor$5.accepts(OdooModelReferenceContributor.java:116) at dev.ngocta.pycharm.odoo.model.OdooModelReferenceContributor$5.accepts(OdooModelReferenceContributor.java:94) at com.intellij.patterns.ObjectPattern.accepts(ObjectPattern.java:48) at dev.ngocta.pycharm.odoo.OdooPsiElementSingleMatchingPattern.accepts(OdooPsiElementSingleMatchingPattern.java:33) 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:244) at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:42) at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:244) 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:245) at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:28) at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:69) 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 com.jetbrains.python.psi.impl.PyStringLiteralExpressionImpl.getReferences(PyStringLiteralExpressionImpl.java:193) at com.intellij.codeInsight.highlighting.HyperlinkAnnotator.annotate(HyperlinkAnnotator.java:42) at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.runAnnotators(DefaultHighlightVisitor.java:130) at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.visit(DefaultHighlightVisitor.java:107) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.runVisitors(GeneralHighlightingPass.java:348) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$collectHighlights$7(GeneralHighlightingPass.java:281) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:308) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$8(GeneralHighlightingPass.java:311) at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.analyze(DefaultHighlightVisitor.java:92) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:311) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectHighlights(GeneralHighlightingPass.java:278) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectInformationWithProgress(GeneralHighlightingPass.java:226) at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:97) at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:57) at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$1(PassExecutorService.java:382) at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1102) at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:374) 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.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:373) at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:349) at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:229) at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:187) at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:347) at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:181) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

trinhanhngoc commented 1 year ago

Hi @IJOL. What version of the Odoo plugin are you using?

IJOL commented 1 year ago

odoo plugin 2023.6.0.231 pycharm 2023.1.2

IJOL commented 1 year ago

I have 23 of them in the last days, the first line varies from one to the next, but the exception itself is the same..

trinhanhngoc commented 1 year ago

Hi @IJOL I am looking into this issue. In the meantime, you can try Invalidate caches to see if the errors go away.

trinhanhngoc commented 1 year ago

@IJOL When you get these errors, do you have multiple PyCharm projects open at the same time?

trinhanhngoc commented 1 year ago

Hi @IJOL. The new version 2023.6.2 has been released with the fix for this issue.

IJOL commented 1 year ago

Yes I open 2 or 3 odoo versions each one in his own pycharm instance habitually, sorry to be that late, i will test new version.. at the same time

El vie, 16 jun 2023 a las 12:36, Trịnh Anh Ngọc @.***>) escribió:

@IJOL https://github.com/IJOL When you get these errors, do you have multiple PyCharm projects open at the same time?

— Reply to this email directly, view it on GitHub https://github.com/odoo-ide/pycharm-odoo/issues/386#issuecomment-1594473938, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXHYV6X6WE7JLZU6ANTP6DXLQZJTANCNFSM6AAAAAAZHR27B4 . You are receiving this because you were mentioned.Message ID: @.***>