izhangzhihao / intellij-rainbow-brackets

🌈Rainbow Brackets for IntelliJ based IDEs/Android Studio/HUAWEI DevEco Studio/Fleet
https://plugins.jetbrains.com/plugin/10080-rainbow-brackets
GNU General Public License v3.0
4.35k stars 202 forks source link

The expensive method should not be called during the references contributing #2675

Closed Rendal closed 7 months ago

Rendal commented 7 months ago

Please check

Your programming languages

Expected Behavior

Editing jsp with java script snippets smoothly

Current Behavior

Periodically idea allerts following exception and break my workflow: java.lang.Throwable: the expensive method should not be called during the references contributing at com.intellij.openapi.diagnostic.Logger.error(Logger.java:370) at com.intellij.codeInsight.highlighting.PassRunningAssert.assertPassNotRunning(PassRunningAssert.kt:44) at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.assertNotContributingReferences(ReferenceProvidersRegistry.java:57) at com.intellij.spring.SpringManager.getInstance(SpringManager.java:22) at com.intellij.spring.mvc.services.SpringMvcService.getServletModels(SpringMvcService.java:33) at com.intellij.spring.mvc.config.anno.SpringMvcPsiBasedServletWebModelContributor.getServlets(SpringMvcPsiBasedServletWebModelContributor.java:45) at com.intellij.spring.mvc.config.anno.SpringMvcPsiBasedServletWebModelContributor.getServletMappings(SpringMvcPsiBasedServletWebModelContributor.java:50) at com.intellij.javaee.web.WebModelBase.lambda$findServletMappings$6(WebModelBase.java:60) at com.intellij.javaee.web.WebModelBase.getMergedElements(WebModelBase.java:77) at com.intellij.javaee.web.WebModelBase.findServletMappings(WebModelBase.java:59) at com.intellij.javaee.web.WebModelBase.lambda$getServletMappings$4(WebModelBase.java:53) at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:37) at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:240) at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:43) at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:240) at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110) at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27) at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65) at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241) at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:27) at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:69) at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:111) at com.intellij.javaee.web.WebModelBase.getServletMappings(WebModelBase.java:52) at com.intellij.javaee.web.WebUtilImpl.resolveServletMappingInfo(WebUtilImpl.java:117) at com.intellij.javaee.web.ServletPathReferenceProvider.subReferences(ServletPathReferenceProvider.java:79) at com.intellij.javaee.web.ServletPathReferenceProvider.lambda$createReferences$0(ServletPathReferenceProvider.java:66) at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74) at com.intellij.javaee.web.LazyMultipleReferencesWapperKt.makeReferenceSet$lambda$0(LazyMultipleReferencesWapper.kt:41) at com.intellij.javaee.web.LazyMultipleReferencesWapperKt.access$makeReferenceSet$lambda$0(LazyMultipleReferencesWapper.kt:1) at com.intellij.javaee.web.LazyMultipleReferencesWapperKt$makeReferenceSet$1$1.invoke(LazyMultipleReferencesWapper.kt:51) at com.intellij.javaee.web.LazyMultipleReferencesWapperKt$makeReferenceSet$1$1.invoke(LazyMultipleReferencesWapper.kt:50) at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74) at com.intellij.javaee.web.LazyMultipleReferencesWrapper.getMyReferences(LazyMultipleReferencesWapper.kt:14) at com.intellij.javaee.web.LazyMultipleReferencesWrapper.getReferences(LazyMultipleReferencesWapper.kt:33) at com.intellij.openapi.paths.PsiDynaReference.lambda$getRangeInElement$1(PsiDynaReference.java:82) at com.intellij.util.containers.ContainerUtil.findAll(ContainerUtil.java:1019) at com.intellij.util.containers.ContainerUtil.filter(ContainerUtil.java:994) at com.intellij.openapi.paths.PsiDynaReference.getRangeInElement(PsiDynaReference.java:81) at com.intellij.openapi.paths.PathReferenceManagerImpl.lambda$static$0(PathReferenceManagerImpl.java:23) at java.base/java.util.Comparator.lambda$comparingInt$7b0bb60$1(Comparator.java:494) at java.base/java.util.TimSort.countRunAndMakeAscending(TimSort.java:355) at java.base/java.util.TimSort.sort(TimSort.java:220) at java.base/java.util.Arrays.sort(Arrays.java:1307) at java.base/java.util.ArrayList.sort(ArrayList.java:1721) at com.intellij.openapi.paths.PathReferenceManagerImpl.mergeReferences(PathReferenceManagerImpl.java:163) at com.intellij.openapi.paths.PathReferenceManagerImpl.createReferences(PathReferenceManagerImpl.java:107) at com.intellij.openapi.paths.PathReferenceManagerImpl.createReferences(PathReferenceManagerImpl.java:81) at com.intellij.htmltools.xml.util.HtmlReferenceProvider.getReferencesByElement(HtmlReferenceProvider.java:264) at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.getReferences(ReferenceProvidersRegistryImpl.java:182) at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.mapNotEmptyReferencesFromProviders(ReferenceProvidersRegistryImpl.java:163) at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.doGetReferencesFromProviders(ReferenceProvidersRegistryImpl.java:142) at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.lambda$getReferencesFromProviders$0(ReferenceProvidersRegistry.java:45) at com.intellij.psi.util.CachedValuesManager$1.compute(CachedValuesManager.java:158) at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:37) at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:240) at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:43) at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:240) at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:110) at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27) at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:65) at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241) at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:27) 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:43) at com.intellij.psi.impl.source.xml.XmlAttributeValueImpl.getReferences(XmlAttributeValueImpl.java:81) at com.intellij.psi.impl.source.xml.XmlAttributeValueImpl.getReferences(XmlAttributeValueImpl.java:96) 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:360) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$collectHighlights$7(GeneralHighlightingPass.java:299) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:320) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$8(GeneralHighlightingPass.java:323) at com.github.izhangzhihao.rainbow.brackets.lite.visitor.RainbowHighlightVisitor.analyze(RainbowHighlightVisitor.kt:34) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:323) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$8(GeneralHighlightingPass.java:323) at com.github.izhangzhihao.rainbow.brackets.lite.visitor.RainbowHighlightVisitor.analyze(RainbowHighlightVisitor.kt:34) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:323) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$8(GeneralHighlightingPass.java:323) at com.intellij.codeInsight.daemon.impl.analysis.JavaNamesHighlightVisitor.analyze(JavaNamesHighlightVisitor.java:53) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:323) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$8(GeneralHighlightingPass.java:323) at com.intellij.codeInsight.daemon.impl.analysis.HighlightVisitorImpl.analyze(HighlightVisitorImpl.java:231) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:323) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$8(GeneralHighlightingPass.java:323) at com.intellij.codeInsight.daemon.impl.analysis.XmlHighlightVisitor.analyze(XmlHighlightVisitor.java:584) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:323) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$8(GeneralHighlightingPass.java:323) at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.analyze(DefaultHighlightVisitor.java:92) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:323) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$8(GeneralHighlightingPass.java:323) at com.intellij.lang.javascript.validation.JSSemanticKeywordHighlighter.analyze(JSSemanticKeywordHighlighter.java:65) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:323) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectHighlights(GeneralHighlightingPass.java:286) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectInformationWithProgress(GeneralHighlightingPass.java:234) at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:95) at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:57) at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$1(PassExecutorService.java:390) at com.intellij.platform.diagnostic.telemetry.helpers.TraceKt.runWithSpanIgnoreThrows(trace.kt:77) at com.intellij.platform.diagnostic.telemetry.helpers.TraceUtil.runWithSpanThrows(TraceUtil.java:24) at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:386) at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1133) at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$3(PassExecutorService.java:377) 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:61) at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:376) at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:352) at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:201) at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:207) at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:350) at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:190) 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)

Code snippet for reproduce (for bugs)

I hope stack trace is enough for understanding the issue reason, because I can`t share the code.i

Your Environment

IntelliJ IDEA 2023.2.2 (Ultimate Edition)
Build version: IntelliJ IDEA 2023.2.2 Build: #IU-232.9921.47 September 13, 2023
JRE: 17.0.8+7-b1000.22, JetBrains s.r.o.
JVM: 17.0.8+7-b1000.22, OpenJDK 64-Bit Server VM, JetBrains s.r.o.
Operating System: Windows 10.0 (amd64)
=== System ===
Number of CPU: 12
Used memory: 1130Mb 
Free memory: 917Mb 
Total memory: 2048Mb 
Maximum available memory: 2048Mb
=== Plugins ===
Custom plugins: [Maven Helper (4.26.0-IJ2022.2), Kafka (232.9921.47), Jakarta EE: Server Faces (JSF) (232.8660.142), AceJump (3.8.16), Kubernetes (232.9921.86), GitToolBox (500.0.20+222), Jakarta EE: Enterprise Java Beans (EJB) (232.8660.142), Rainbow Brackets Lite - Free and OpenSource (1.0.1), JPA Buddy (2023.3.5-232), Big Data Tools Core (232.9921.47), Jakarta EE: Web Services (JAX-WS) (232.8660.142), TeamCity (2023.9.141339), Ansible Vault Editor (1.20)]
izhangzhihao commented 7 months ago

Same with the issue IDEA-327692, JetBrains said that it will be fixed in the next EAP build: 2023.3 EAP 3