dubreuia / intellij-plugin-save-actions

Supports configurable, Eclipse like, save actions, including "organize imports", "reformat code" and "rearrange code".
MIT License
531 stars 101 forks source link

IntelliJ Ultimate 2021.1 Stack Trace #367

Closed melloware closed 1 year ago

melloware commented 3 years ago

Describe the bug Save Actions failing

What triggered the plugin Saving my file.

Versions

IntelliJ IDEA 2021.1 (Ultimate Edition)
Build #IU-211.6693.111, built on April 6, 2021
Runtime version: 11.0.10+9-b1341.35 amd64
VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 1990M
Cores: 12
Non-Bundled Plugins: com.dubreuia (2.2.0)
Kotlin: 211-1.4.32-release-IJ6693.72

Stack Trace:

java.lang.IllegalStateException: Attempt to modify PSI for non-committed Document!
    at com.intellij.pom.core.impl.PomModelImpl.startTransaction(PomModelImpl.java:266)
    at com.intellij.pom.core.impl.PomModelImpl.lambda$runTransaction$2(PomModelImpl.java:96)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:688)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:634)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:64)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:218)
    at com.intellij.pom.core.impl.PomModelImpl.runTransaction(PomModelImpl.java:93)
    at com.intellij.psi.impl.source.tree.ChangeUtil.prepareAndRunChangeAction(ChangeUtil.java:142)
    at com.intellij.psi.impl.source.tree.CompositeElement.replaceChild(CompositeElement.java:625)
    at com.intellij.psi.impl.source.codeStyle.CodeEditUtil.replaceChild(CodeEditUtil.java:162)
    at com.intellij.psi.impl.source.tree.CompositeElement.replaceChildInternal(CompositeElement.java:455)
    at com.intellij.psi.impl.source.tree.SharedImplUtil.doReplace(SharedImplUtil.java:196)
    at com.intellij.psi.impl.source.tree.CompositePsiElement.replace(CompositePsiElement.java:210)
    at com.siyeh.ig.psiutils.CommentTracker.replace(CommentTracker.java:302)
    at com.siyeh.ig.psiutils.CommentTracker.replaceAndRestoreComments(CommentTracker.java:341)
    at com.siyeh.ig.psiutils.CommentTracker.replaceAndRestoreComments(CommentTracker.java:479)
    at com.siyeh.ig.PsiReplacementUtil.replaceExpressionAndShorten(PsiReplacementUtil.java:54)
    at com.siyeh.ig.fixes.AddThisQualifierFix.doFix(AddThisQualifierFix.java:81)
    at com.siyeh.ig.InspectionGadgetsFix.applyFix(InspectionGadgetsFix.java:39)
    at com.siyeh.ig.InspectionGadgetsFix.applyFix(InspectionGadgetsFix.java:26)
    at com.dubreuia.processors.java.InspectionRunnable.writeQuickFixes(InspectionRunnable.java:96)
    at com.dubreuia.processors.java.InspectionRunnable.run(InspectionRunnable.java:71)
    at com.dubreuia.processors.SaveWriteCommand$1.run(SaveWriteCommand.java:57)
    at com.intellij.openapi.application.RunResult.run(RunResult.java:36)
    at com.intellij.openapi.command.WriteCommandAction.lambda$performWriteCommandAction$1(WriteCommandAction.java:266)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:959)
    at com.intellij.openapi.command.WriteCommandAction.lambda$performWriteCommandAction$2(WriteCommandAction.java:265)
    at com.intellij.openapi.command.WriteCommandAction.lambda$doExecuteCommand$3(WriteCommandAction.java:295)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:216)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:182)
    at com.intellij.openapi.command.WriteCommandAction.doExecuteCommand(WriteCommandAction.java:297)
    at com.intellij.openapi.command.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:265)
    at com.intellij.openapi.command.WriteCommandAction.execute(WriteCommandAction.java:246)
    at com.dubreuia.processors.SaveWriteCommand.execute(SaveWriteCommand.java:60)
    at com.dubreuia.core.component.Engine.lambda$processPsiFiles$5(Engine.java:106)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
    at java.base/java.util.stream.ReferencePipeline$11$1.accept(ReferencePipeline.java:442)
    at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
    at com.dubreuia.core.component.Engine.processPsiFiles(Engine.java:107)
    at com.dubreuia.core.component.Engine.processPsiFilesIfNecessary(Engine.java:90)
    at com.dubreuia.core.component.SaveActionManager.guardedProcessPsiFiles(SaveActionManager.java:169)
    at com.dubreuia.core.component.SaveActionManager.lambda$beforeDocumentsSaving$3(SaveActionManager.java:153)
    at java.base/java.util.HashMap.forEach(HashMap.java:1336)
    at com.dubreuia.core.component.SaveActionManager.beforeDocumentsSaving(SaveActionManager.java:152)
    at com.dubreuia.core.component.SaveActionManager.beforeAllDocumentsSaving(SaveActionManager.java:137)
    at com.intellij.util.messages.impl.MessageBusImpl.invokeMethod(MessageBusImpl.java:671)
    at com.intellij.util.messages.impl.MessageBusImpl.invokeListener(MessageBusImpl.java:649)
    at com.intellij.util.messages.impl.MessageBusImpl.deliverMessage(MessageBusImpl.java:422)
    at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:397)
    at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:379)
    at com.intellij.util.messages.impl.MessageBusImpl.access$100(MessageBusImpl.java:33)
    at com.intellij.util.messages.impl.MessageBusImpl$MessagePublisher.invoke(MessageBusImpl.java:185)
    at com.sun.proxy.$Proxy22.beforeAllDocumentsSaving(Unknown Source)
    at jdk.internal.reflect.GeneratedMethodAccessor180.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.multiCast(FileDocumentManagerImpl.java:174)
    at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.lambda$new$0(FileDocumentManagerImpl.java:129)
    at com.sun.proxy.$Proxy22.beforeAllDocumentsSaving(Unknown Source)
    at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.saveDocuments(FileDocumentManagerImpl.java:271)
    at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.saveAllDocuments(FileDocumentManagerImpl.java:259)
    at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.saveAllDocuments(FileDocumentManagerImpl.java:252)
    at com.intellij.ide.actions.SaveAllAction.actionPerformed(SaveAllAction.kt:24)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.lambda$performActionDumbAware$5(ActionUtil.java:273)
    at com.intellij.util.SlowOperations.lambda$allowSlowOperations$0(SlowOperations.java:77)
    at com.intellij.util.SlowOperations.allowSlowOperations(SlowOperations.java:64)
    at com.intellij.util.SlowOperations.allowSlowOperations(SlowOperations.java:76)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:273)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$1.performAction(IdeKeyEventDispatcher.java:616)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.lambda$processAction$3(IdeKeyEventDispatcher.java:676)
    at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:95)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:675)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:626)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processActionOrWaitSecondStroke(IdeKeyEventDispatcher.java:486)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:481)
    at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:232)
    at com.intellij.ide.IdeEventQueue.dispatchKeyEvent(IdeEventQueue.java:889)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:833)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:449)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:808)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:448)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:781)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:502)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
JThoennes commented 3 years ago

Same error happening on IntelliJ Community 2021.1

ismaxs commented 3 years ago

Same error happening on IntelliJ Community 2021.1

Arran-0 commented 3 years ago

This is causing file/s not to save and I've lost an hour of work because of this bug.

The only solution right now is to disable save actions or disable the plugin till it's fixed.

Hope this gets fixed soon.

kajh commented 3 years ago

It would be interesting if anyone seeing this issue could try to reproduce it on Intellij 2021.1.1 (https://blog.jetbrains.com/idea/2021/04/intellij-idea-2021-1-1/).

melloware commented 3 years ago

I just tried it with 20.1.1 and its still same error.

fishermans commented 2 years ago

Same as #379