Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDEA2022.3.1+springspring javaformat0.0.35 Document is locked by write PSI operations #351

Closed
YAGAMIL opened this issue Jan 9, 2023 · 1 comment

Comments

@YAGAMIL
Copy link

YAGAMIL commented Jan 9, 2023

java.lang.RuntimeException: Document is locked by write PSI operations. Use PsiDocumentManager.doPostponedOperationsAndUnblockDocument() to commit PSI changes to the document.
Unprocessed elements: DOC_COMMENT(76820,76907)
	at com.intellij.psi.impl.source.PostprocessReformattingAspect.assertDocumentChangeIsAllowed(PostprocessReformattingAspect.java:297)
	at com.intellij.psi.impl.PsiDocumentManagerImpl.beforeDocumentChangeOnUnlockedDocument(PsiDocumentManagerImpl.java:126)
	at com.intellij.psi.impl.PsiDocumentManagerBase.beforeDocumentChange(PsiDocumentManagerBase.java:901)
	at jdk.internal.reflect.GeneratedMethodAccessor279.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.util.EventDispatcher.dispatchVoidMethod(EventDispatcher.java:120)
	at com.intellij.util.EventDispatcher.lambda$createMulticaster$1(EventDispatcher.java:85)
	at jdk.proxy1/jdk.proxy1.$Proxy142.beforeDocumentChange(Unknown Source)
	at com.intellij.openapi.editor.impl.DocumentImpl.lambda$beforeChangedUpdate$1(DocumentImpl.java:881)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeNonCancelableSection$3(CoreProgressManager.java:224)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:664)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:620)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$computeInNonCancelableSection$4(CoreProgressManager.java:232)
	at com.intellij.openapi.progress.Cancellation.computeInNonCancelableSection(Cancellation.java:99)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:232)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:223)
	at com.intellij.openapi.editor.impl.DocumentImpl.beforeChangedUpdate(DocumentImpl.java:878)
	at com.intellij.openapi.editor.impl.DocumentImpl.updateText(DocumentImpl.java:818)
	at com.intellij.openapi.editor.impl.DocumentImpl.replaceString(DocumentImpl.java:664)
	at com.intellij.openapi.editor.impl.DocumentImpl.replaceString(DocumentImpl.java:601)
	at io.spring.format.formatter.intellij.codestyle.EclipseDocumentAdapter.replace(EclipseDocumentAdapter.java:40)
	at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1118)
	at org.eclipse.text.edits.ReplaceEdit.performDocumentUpdating(ReplaceEdit.java:79)
	at org.eclipse.text.edits.TextEdit.traverseDocumentUpdating(TextEdit.java:920)
	at org.eclipse.text.edits.TextEdit.traverseDocumentUpdating(TextEdit.java:913)
	at org.eclipse.text.edits.TextEditProcessor.executeDo(TextEditProcessor.java:196)
	at org.eclipse.text.edits.TextEdit.dispatchPerformEdits(TextEdit.java:742)
	at org.eclipse.text.edits.TextEditProcessor.performEdits(TextEditProcessor.java:158)
	at org.eclipse.text.edits.TextEdit.apply(TextEdit.java:714)
	at org.eclipse.text.edits.TextEdit.apply(TextEdit.java:738)
	at io.spring.format.formatter.intellij.codestyle.SpringReformatter.lambda$applyEdit$2(SpringReformatter.java:119)
	at com.intellij.openapi.command.WriteCommandAction.lambda$runWriteCommandAction$4(WriteCommandAction.java:362)
	at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.lambda$doRunWriteCommandAction$1(WriteCommandAction.java:150)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:955)
	at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.lambda$doRunWriteCommandAction$2(WriteCommandAction.java:148)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:210)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:184)
	at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.doRunWriteCommandAction(WriteCommandAction.java:157)
	at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.run(WriteCommandAction.java:124)
	at com.intellij.openapi.command.WriteCommandAction.runWriteCommandAction(WriteCommandAction.java:362)
	at com.intellij.openapi.command.WriteCommandAction.runWriteCommandAction(WriteCommandAction.java:350)
	at io.spring.format.formatter.intellij.codestyle.SpringReformatter.runWriteCommandAction(SpringReformatter.java:129)
	at io.spring.format.formatter.intellij.codestyle.SpringReformatter.applyEdit(SpringReformatter.java:116)
	at io.spring.format.formatter.intellij.codestyle.SpringReformatter.reformat(SpringReformatter.java:111)
	at io.spring.format.formatter.intellij.codestyle.SpringReformatter.reformat(SpringReformatter.java:84)
	at io.spring.format.formatter.intellij.codestyle.SpringCodeStyleManager.reformat(SpringCodeStyleManager.java:66)
	at io.spring.format.formatter.intellij.codestyle.SpringCodeStyleManager.reformatText(SpringCodeStyleManager.java:50)
	at com.star.easydoc.service.WriterService.lambda$writeJavadoc$0(WriterService.java:48)
	at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.lambda$doRunWriteCommandAction$1(WriteCommandAction.java:150)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:955)
	at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.lambda$doRunWriteCommandAction$2(WriteCommandAction.java:148)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:219)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:184)
	at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.doRunWriteCommandAction(WriteCommandAction.java:157)
	at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.run(WriteCommandAction.java:124)
	at com.star.easydoc.service.WriterService.writeJavadoc(WriterService.java:27)
	at com.star.easydoc.action.GenerateJavadocAction.javadocProcess(GenerateJavadocAction.java:140)
	at com.star.easydoc.action.GenerateJavadocAction.actionPerformed(GenerateJavadocAction.java:104)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.doPerformActionOrShowPopup(ActionUtil.java:323)
	at com.intellij.openapi.keymap.impl.ActionProcessor.performAction(ActionProcessor.java:47)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$1.performAction(IdeKeyEventDispatcher.java:584)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.lambda$doPerformActionInner$9(IdeKeyEventDispatcher.java:706)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
	at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:94)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.lambda$doPerformActionInner$10(IdeKeyEventDispatcher.java:706)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.java:346)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.doPerformActionInner(IdeKeyEventDispatcher.java:703)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:647)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:595)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processActionOrWaitSecondStroke(IdeKeyEventDispatcher.java:478)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:467)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:225)
	at com.intellij.ide.IdeEventQueue.dispatchKeyEvent(IdeEventQueue.java:815)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:750)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$5(IdeEventQueue.java:437)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:772)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:436)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113)
	at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:615)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:434)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:813)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:480)
	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)
@philwebb
Copy link
Contributor

philwebb commented Feb 8, 2023

With #359 we've switched to use the DocumentFormattingService which I hope will fix these kinds of issues. If you can replicate the problem after v0.0.36 is released, please re-open this issue.

@philwebb philwebb closed this as not planned Won't fix, can't repro, duplicate, stale Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants