wanghuan9 / intellij-plugin-save-action-tool

intellij-plugin-save-action-tool
51 stars 2 forks source link

保存时报错 #14

Open wanghuan9 opened 7 months ago

wanghuan9 commented 7 months ago

Describe the bug A clear and concise description of what the bug is. Refactorings should not be started inside write action because they start progress inside and any read action from the progress task would cause the deadlock

java.lang.Exception at com.intellij.refactoring.BaseRefactoringProcessor.run(BaseRefactoringProcessor.java:608) at com.intellij.refactoring.RefactoringImpl.run(RefactoringImpl.java:56) at com.siyeh.ig.performance.MethodMayBeStaticInspection$1.doFix(MethodMayBeStaticInspection.java:67) 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:103) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at com.dubreuia.processors.java.InspectionRunnable.lambda$run$0(InspectionRunnable.java:72) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at com.dubreuia.processors.java.InspectionRunnable.run(InspectionRunnable.java:72) at com.dubreuia.processors.SaveWriteCommand.lambda$execute$0(SaveWriteCommand.java:55) at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.lambda$doRunWriteCommandAction$1(WriteCommandAction.java:144) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:975) at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.lambda$doRunWriteCommandAction$2(WriteCommandAction.java:142) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:225) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:187) at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.doRunWriteCommandAction(WriteCommandAction.java:151) at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.run(WriteCommandAction.java:118) at com.dubreuia.processors.SaveWriteCommand.execute(SaveWriteCommand.java:55) at com.dubreuia.core.component.Engine.lambda$processPsiFiles$6(Engine.java:121) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.stream.ReferencePipeline$15$1.accept(ReferencePipeline.java:541) at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) 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.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) at com.dubreuia.core.component.Engine.processPsiFiles(Engine.java:122) at com.dubreuia.core.component.Engine.processPsiFilesIfNecessary(Engine.java:100) at com.dubreuia.core.service.impl.AbstractSaveActionsService.guardedProcessPsiFiles(AbstractSaveActionsService.java:93) at com.dubreuia.core.service.impl.SaveActionsJavaService.guardedProcessPsiFiles(SaveActionsJavaService.java:47) at com.dubreuia.core.listener.SaveActionsDocumentManagerListener.beforeDocumentsSaving(SaveActionsDocumentManagerListener.java:81) at com.dubreuia.core.listener.SaveActionsDocumentManagerListener.beforeAllDocumentsSaving(SaveActionsDocumentManagerListener.java:67) at com.intellij.util.messages.impl.MessageBusImplKt.invokeMethod(MessageBusImpl.kt:697) at com.intellij.util.messages.impl.MessageBusImplKt.invokeListener(MessageBusImpl.kt:660) at com.intellij.util.messages.impl.MessageBusImplKt.executeOrAddToQueue(MessageBusImpl.kt:492) at com.intellij.util.messages.impl.ToDirectChildrenMessagePublisher.publish$intellij_platform_core(CompositeMessageBus.kt:310) at com.intellij.util.messages.impl.MessagePublisher.invoke(MessageBusImpl.kt:449) at jdk.proxy1/jdk.proxy1.$Proxy24.beforeAllDocumentsSaving(Unknown Source) at jdk.internal.reflect.GeneratedMethodAccessor233.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.multiCast(FileDocumentManagerImpl.java:174) at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.lambda$new$0(FileDocumentManagerImpl.java:130) at jdk.proxy1/jdk.proxy1.$Proxy24.beforeAllDocumentsSaving(Unknown Source) at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.saveDocuments(FileDocumentManagerImpl.java:279) at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.saveAllDocuments(FileDocumentManagerImpl.java:267) at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.saveAllDocuments(FileDocumentManagerImpl.java:260) at com.intellij.ide.actions.SaveAllAction.actionPerformed(SaveAllAction.kt:25) at com.intellij.openapi.actionSystem.ex.ActionUtil.doPerformActionOrShowPopup(ActionUtil.java:344) at com.intellij.openapi.keymap.impl.ActionProcessor.performAction(ActionProcessor.java:32) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$myActionProcessor$1.performAction(IdeKeyEventDispatcher.kt:496) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcherKt.doPerformActionInner$lambda$4$lambda$3(IdeKeyEventDispatcher.kt:831) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106) at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:95) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcherKt.doPerformActionInner$lambda$4(IdeKeyEventDispatcher.kt:831) at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.java:381) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcherKt.doPerformActionInner(IdeKeyEventDispatcher.kt:829) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcherKt.access$doPerformActionInner(IdeKeyEventDispatcher.kt:1) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction$intellij_platform_ide_impl(IdeKeyEventDispatcher.kt:559) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.kt:509) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processActionOrWaitSecondStroke(IdeKeyEventDispatcher.kt:448) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.kt:441) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.kt:303) at com.intellij.ide.IdeEventQueue.dispatchKeyEvent(IdeEventQueue.kt:620) at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$11(IdeEventQueue.kt:581) at com.intellij.openapi.application.impl.RwLockHolder.runWithEnabledImplicitRead(RwLockHolder.kt:75) at com.intellij.openapi.application.impl.RwLockHolder.runWithImplicitRead(RwLockHolder.kt:67) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:581) at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:72) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:355) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:354) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:793) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:354) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:349) at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:1014) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:114) at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:1014) at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:349) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:848) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:391) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

What triggered the plugin Frame deactivation (window loses focus), CTRL+SHIFT+S, CTRL+S, etc.

Versions In Intellij, go to "Help > About > Copy" and paste it here

wanghuan9 commented 7 months ago

场景在于勾选了所有的 Quick Fix 选项