ArtsiomCh / CMake

IntelliJ Platform plugin for CMake basic syntax highlight.
https://plugins.jetbrains.com/plugin/10089-cmake-simple-highlighter
GNU General Public License v3.0
44 stars 7 forks source link

[Exception][CLion 2022.3.2] java.lang.IndexOutOfBoundsException: Wrong offset: 87649. Should be in range: [0, 87621] #46

Closed jschwe closed 1 year ago

jschwe commented 1 year ago

User Description

I sometimes get exceptions like this one. The exact numbers of the offset varies a bit. For example another one I got today was: java.lang.IndexOutOfBoundsException: Wrong offset: 88067. Should be in range: [0, 87747].

Not really sure if it is related, but in my project CLion sometimes hangs for a few seconds or typing becomes extremely slow with the plugin enabled.

Stack Trace

java.lang.IndexOutOfBoundsException: Wrong offset: 87649. Should be in range: [0, 87621]
    at com.intellij.openapi.editor.impl.LineSet.findLineIndex(LineSet.java:166)
    at com.intellij.openapi.editor.impl.DocumentImpl.getLineNumber(DocumentImpl.java:1015)
    at com.cmakeplugin.psi.impl.CMakePsiImplUtil$1.getPresentableText(CMakePsiImplUtil.java:99)
    at com.cmakeplugin.VarDefElement.<init>(CMakeStructureViewElement.java:207)
    at com.cmakeplugin.FunMacroBase.lambda$getChildren$0(CMakeStructureViewElement.java:169)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
    at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
    at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
    at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
    at com.cmakeplugin.FunMacroBase.getChildren(CMakeStructureViewElement.java:180)
    at com.intellij.ide.util.treeView.smartTree.TreeElementWrapper.initChildren(TreeElementWrapper.java:35)
    at com.intellij.ide.util.treeView.smartTree.CachingChildrenTreeNode.rebuildSubtree(CachingChildrenTreeNode.java:207)
    at com.intellij.ide.util.treeView.smartTree.CachingChildrenTreeNode.ensureChildrenAreInitialized(CachingChildrenTreeNode.java:41)
    at com.intellij.ide.util.treeView.smartTree.CachingChildrenTreeNode.getChildren(CachingChildrenTreeNode.java:33)
    at com.intellij.ide.structureView.newStructureView.StructureViewComponent$MyNodeWrapper.getChildren(StructureViewComponent.java:831)
    at com.intellij.ide.util.treeView.smartTree.SmartTreeStructure.getChildElements(SmartTreeStructure.java:62)
    at com.intellij.ui.tree.StructureTreeModel.getValidChildren(StructureTreeModel.java:412)
    at com.intellij.ui.tree.StructureTreeModel.validateChildren(StructureTreeModel.java:330)
    at com.intellij.ui.tree.StructureTreeModel$Node.isModelLeaf(StructureTreeModel.java:585)
    at com.intellij.ui.tree.StructureTreeModel.isLeaf(StructureTreeModel.java:366)
    at com.intellij.ui.tree.LeafState.get(LeafState.java:64)
    at com.intellij.ui.tree.AsyncTreeModel$CmdGetChildren.load(AsyncTreeModel.java:577)
    at com.intellij.ui.tree.AsyncTreeModel$CmdGetChildren.getNode(AsyncTreeModel.java:550)
    at com.intellij.ui.tree.AsyncTreeModel$Command.get(AsyncTreeModel.java:443)
    at com.intellij.ui.tree.AsyncTreeModel$Command.get(AsyncTreeModel.java:409)
    at com.intellij.util.concurrency.Invoker$Task.run(Invoker.java:305)
    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.util.concurrency.Invoker.invokeSafely(Invoker.java:187)
    at com.intellij.util.concurrency.Invoker.lambda$offerSafely$0(Invoker.java:165)
    at com.intellij.util.concurrency.Invoker$Background.lambda$offer$0(Invoker.java:475)
    at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:243)
    at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:29)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.executeFirstTaskAndHelpQueue(BoundedTaskExecutor.java:216)
    at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:212)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:205)
    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)

Other Information

=== About ===
Build version: CLion 2022.3.2 Build: #CL-223.8617.54 January 25, 2023
Theme: Darcula
JRE: 17.0.5+1-b653.25, JetBrains s.r.o.
JVM: 17.0.5+1-b653.25, OpenJDK 64-Bit Server VM, JetBrains s.r.o.
Operating System: Mac OS X 13.2.1 (aarch64)

=== Plugins ===
Custom plugins: [CMake Plus (223.8.0), Rust (0.4.189.5234-223), CMake simple highlighter (223.8.0)]
Disabled plugins:[]
ArtsiomCh commented 1 year ago

Thank you for reporting! Will investigate where that java.lang.IndexOutOfBoundsException come from.

As for freezes and slowdown on typing. Is it happening when editing cmake files or c, cpp files affected as well with cmake plus plugin enabled?

jschwe commented 1 year ago

It's only happening when editing CMake files. I'm maintaining a CMake module Corrosion, where it is quite noticeable. When editing C / Rust files everything is as usual.

ArtsiomCh commented 1 year ago

IndexOutOfBoundsException fixed in 223.8.1 (should be available within 2 business days, after JetBrains approval)

Freezes seems to be a bit more complex issue. Will investigate and solve it separately.