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 Idea Ultimate 2022.2 on macOs Monterey- Exception in plugin #413

Open vabraham01 opened 2 years ago

vabraham01 commented 2 years ago

Describe the bug IDE internal error happened while plugin execution. As a result the functionality of the plugin isn't working. Started to see this after the IntelliJ update to 2022.2 version. Stack trace provided at the bottom:

What triggered the plugin While saving a file.

Versions SaveActions - 2.3.0 IntelliJ IDEA 2022.2 (Ultimate Edition) Build #IU-222.3345.118, built on July 25, 2022 Licensed to **** Subscription is active until February 9, 2023. Runtime version: 17.0.3+7-b469.32 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.

SaveActionsPluginissue

Stack trace:

Got unexpected exception during formatting PsiJavaFile:MyServiceImpl.java

java.util.concurrent.ExecutionException: java.lang.IllegalAccessError: class com.google.googlejavaformat.java.JavaInput (in unnamed module @0x236816ed) cannot access class com.sun.tools.javac.parser.Tokens$TokenKind (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.parser to unnamed module @0x236816ed at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor$ProcessingTask.checkStop(AbstractLayoutCodeProcessor.java:468) at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor$ProcessingTask.performFileProcessing(AbstractLayoutCodeProcessor.java:462) at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor$ProcessingTask.lambda$iteration$2(AbstractLayoutCodeProcessor.java:428) at com.intellij.openapi.project.DumbService.withAlternativeResolveEnabled(DumbService.java:355) at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor$ProcessingTask.iteration(AbstractLayoutCodeProcessor.java:428) at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor$ProcessingTask.lambda$process$8(AbstractLayoutCodeProcessor.java:505) at com.intellij.codeInsight.actions.FileRecursiveIterator.lambda$processAll$4(FileRecursiveIterator.java:69) at com.intellij.openapi.roots.impl.FileIndexBase.lambda$toContentIteratorEx$0(FileIndexBase.java:77) at com.intellij.openapi.roots.impl.FileIndexBase$1.visitFileEx(FileIndexBase.java:60) at com.intellij.openapi.vfs.VfsUtilCore.visitChildrenRecursively(VfsUtilCore.java:294) at com.intellij.openapi.roots.impl.FileIndexBase.iterateContentUnderDirectory(FileIndexBase.java:41) at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.iterateContentUnderDirectory(ProjectFileIndexImpl.java:27) at com.intellij.openapi.roots.impl.FileIndexBase.iterateContentUnderDirectory(FileIndexBase.java:82) at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.iterateContentUnderDirectory(ProjectFileIndexImpl.java:27) at com.intellij.codeInsight.actions.FileRecursiveIterator.processAll(FileRecursiveIterator.java:64) at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor$ProcessingTask.process(AbstractLayoutCodeProcessor.java:503) at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor.processFilesUnderProgress(AbstractLayoutCodeProcessor.java:366) at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor.lambda$runProcessFiles$1(AbstractLayoutCodeProcessor.java:325) at com.intellij.openapi.progress.impl.CoreProgressManager$1.run(CoreProgressManager.java:270) at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:442) at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressSynchronously$8(CoreProgressManager.java:526) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:188) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683) at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60) at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:175) at com.intellij.openapi.application.impl.ApplicationImpl.runProcessWithProgressSynchronously(ApplicationImpl.java:461) at com.intellij.openapi.progress.impl.CoreProgressManager.runProcessWithProgressSynchronously(CoreProgressManager.java:537) at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcessWithProgressSynchronously(ProgressManagerImpl.java:85) at com.intellij.openapi.progress.impl.CoreProgressManager.runProcessWithProgressSynchronously(CoreProgressManager.java:266) at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor.runProcessFiles(AbstractLayoutCodeProcessor.java:323) at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor.run(AbstractLayoutCodeProcessor.java:222) at com.dubreuia.processors.SaveWriteCommand.lambda$execute$0(SaveWriteCommand.java:53) at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.lambda$doRunWriteCommandAction$1(WriteCommandAction.java:150) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1023) 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.dubreuia.processors.SaveWriteCommand.execute(SaveWriteCommand.java:53) at com.dubreuia.core.component.Engine.lambda$processPsiFiles$5(Engine.java:106) 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.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: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:1421) 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.MessageBusImplKt.invokeMethod(MessageBusImpl.kt:646) at com.intellij.util.messages.impl.MessageBusImplKt.invokeListener(MessageBusImpl.kt:625) at com.intellij.util.messages.impl.MessageBusImplKt.executeOrAddToQueue(MessageBusImpl.kt:470) at com.intellij.util.messages.impl.ToDirectChildrenMessagePublisher.publish$intellij_platform_core(CompositeMessageBus.kt:259) at com.intellij.util.messages.impl.MessagePublisher.invoke(MessageBusImpl.kt:425) at jdk.proxy2/jdk.proxy2.$Proxy25.beforeAllDocumentsSaving(Unknown Source) at jdk.internal.reflect.GeneratedMethodAccessor163.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:173) at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.lambda$new$0(FileDocumentManagerImpl.java:128) at jdk.proxy2/jdk.proxy2.$Proxy25.beforeAllDocumentsSaving(Unknown Source) at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.saveDocuments(FileDocumentManagerImpl.java:274) at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.saveAllDocuments(FileDocumentManagerImpl.java:262) at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.saveAllDocuments(FileDocumentManagerImpl.java:255) at com.intellij.ide.actions.SaveAllAction.actionPerformed(SaveAllAction.kt:25) at com.intellij.openapi.actionSystem.ex.ActionUtil.doPerformActionOrShowPopup(ActionUtil.java:315) at com.intellij.openapi.keymap.impl.ActionProcessor.performAction(ActionProcessor.java:47) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$1.performAction(IdeKeyEventDispatcher.java:581) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.lambda$doPerformActionInner$9(IdeKeyEventDispatcher.java:703) 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:703) at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.java:337) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.doPerformActionInner(IdeKeyEventDispatcher.java:700) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:644) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:592) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processActionOrWaitSecondStroke(IdeKeyEventDispatcher.java:475) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:464) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:229) at com.intellij.ide.IdeEventQueue.dispatchKeyEvent(IdeEventQueue.java:804) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:740) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:439) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:791) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:438) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113) at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:604) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:436) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:881) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:484) 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) Caused by: java.lang.IllegalAccessError: class com.google.googlejavaformat.java.JavaInput (in unnamed module @0x236816ed) cannot access class com.sun.tools.javac.parser.Tokens$TokenKind (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.parser to unnamed module @0x236816ed at com.google.googlejavaformat.java.JavaInput.buildToks(JavaInput.java:349) at com.google.googlejavaformat.java.JavaInput.buildToks(JavaInput.java:334) at com.google.googlejavaformat.java.JavaInput.(JavaInput.java:276) at com.google.googlejavaformat.java.Formatter.getFormatReplacements(Formatter.java:260) at com.google.googlejavaformat.intellij.FormatterUtil.getReplacements(FormatterUtil.java:40) at com.google.googlejavaformat.intellij.GoogleJavaFormatCodeStyleManager.format(GoogleJavaFormatCodeStyleManager.java:150) at com.google.googlejavaformat.intellij.GoogleJavaFormatCodeStyleManager.formatInternal(GoogleJavaFormatCodeStyleManager.java:137) at com.google.googlejavaformat.intellij.GoogleJavaFormatCodeStyleManager.reformatText(GoogleJavaFormatCodeStyleManager.java:69) at com.intellij.codeInsight.actions.ReformatCodeProcessor.lambda$doReformat$5(ReformatCodeProcessor.java:196) at com.intellij.util.SlowOperations.allowSlowOperations(SlowOperations.java:149) at com.intellij.codeInsight.actions.ReformatCodeProcessor.lambda$doReformat$6(ReformatCodeProcessor.java:186) at com.intellij.openapi.editor.ex.util.EditorScrollingPositionKeeper.perform(EditorScrollingPositionKeeper.java:100) at com.intellij.codeInsight.actions.ReformatCodeProcessor.doReformat(ReformatCodeProcessor.java:186) at com.intellij.codeInsight.actions.ReformatCodeProcessor.lambda$prepareTask$2(ReformatCodeProcessor.java:134) at com.intellij.application.options.CodeStyle.doWithTemporarySettings(CodeStyle.java:338) at com.intellij.codeInsight.actions.ReformatCodeProcessor.lambda$prepareTask$3(ReformatCodeProcessor.java:130) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor$ProcessingTask.lambda$performFileProcessing$5(AbstractLayoutCodeProcessor.java:459) at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.lambda$doRunWriteCommandAction$1(WriteCommandAction.java:150) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1023) 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.codeInsight.actions.AbstractLayoutCodeProcessor$ProcessingTask.lambda$performFileProcessing$6(AbstractLayoutCodeProcessor.java:459) at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:492) at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:525) at com.intellij.codeInsight.actions.AbstractLayoutCodeProcessor$ProcessingTask.performFileProcessing(AbstractLayoutCodeProcessor.java:454) ... 104 more

fishermans commented 2 years ago

You can fork my fork https://github.com/fishermans/intellij-plugin-save-actions and build and install it locally as long as @dubreuia is not releasing any updates. It's been working with 2022.2

dubreuia commented 1 year ago

Sorry I'm not using the plugin anymore so my motivation for maintenance is low (if you want to step up as a second maintainer, I can add you @fishermans)

Taking note this needs a fix / release, I'll try to do soon

PrimeDominus commented 1 year ago

@dubreuia what are you using instead?

dubreuia commented 1 year ago

@dubreuia what are you using instead?

I don't code in java anymore, I code in python (so I don't need the quick fixes of the plugin) and I'm using the File Watchers plugin which launches black + isort, works well (and it is my current team setup) but there's no equivalent in the java ecosystem afaik

PrimeDominus commented 1 year ago

@fishermans we need you 😄

fishermans commented 1 year ago

@PrimeDominus

First off, thanks for the compliments. I updated the plugin to 2022.2.1, today. Also, the previous local build worked since months (daily usage) even with IDEA 2022.2.1.

@dubreuia should please accept my PR #409 to get a more stable version. It has been updated to the latest idea version and intellij gradle plugin version 1.9.0 which is the most recent one at the moment.

I am not a plugin developer but I am using the plugin every day. Hence, I will maintain it as long as I need this plugin for my work. I will push it to my repo each time I worked on it. I know that many people loving it and using it most of the time.

But I do not have time to implement improvements and test it for other IDEs like Py, GO,... IDEA is the only one I am working with. It should work most of the time but I will not verify it.

Unfortunately, I don't have time to support and maintain plugins next to my work. I am an employee and get paid by my company. I also can understand Alexander, who doesn't use the IDE at all anymore. And, of course, I also understand you and all the other users who are using it, need it and are waiting for an update to get their work done.

Since the plugin has a large amount of distribution, it is a pity that no one can be found who is able to support the plugin and perhaps has more knowledge about plugins than I do.

Therefore, we can only ask Alexander to push the plugin in the version revised by me once again to the marketplace. I even don't know how to do that.

Within the last year I was unfortunately the only one who pushed improvements and fixes. Maybe someone can also help to keep it alive?

Hope, you understand my point-of-view.