google-java-format icon indicating copy to clipboard operation
google-java-format copied to clipboard

java.lang.IllegalAccessError fails on IntelliJ IDEA v2022.2

Open padis opened this issue 3 years ago • 2 comments

When creates a new Test or class fails with this error: java.lang.IllegalAccessError: class com.google.googlejavaformat.java.JavaInput (in unnamed module @0x34c31d27) 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 @0x34c31d27 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:59) at com.intellij.codeInsight.template.impl.TemplateState.reformat(TemplateState.java:1231) at com.intellij.codeInsight.template.impl.TemplateState.lambda$doReformat$2(TemplateState.java:416) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1023) at com.intellij.codeInsight.template.impl.TemplateState.doReformat(TemplateState.java:421) at com.intellij.codeInsight.template.impl.TemplateState.lambda$processAllExpressions$1(TemplateState.java:364) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1023) at com.intellij.codeInsight.template.impl.TemplateState.processAllExpressions(TemplateState.java:397) at com.intellij.codeInsight.template.impl.TemplateState.start(TemplateState.java:337) at com.intellij.codeInsight.template.impl.TemplateState.start(TemplateState.java:299) at com.intellij.codeInsight.template.impl.TemplateManagerImpl.lambda$startTemplate$2(TemplateManagerImpl.java:170) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:210) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:174) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:164) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:150) at com.intellij.codeInsight.template.impl.TemplateManagerImpl.startTemplate(TemplateManagerImpl.java:173) at com.intellij.codeInsight.template.impl.TemplateManagerImpl.startTemplate(TemplateManagerImpl.java:191) at com.intellij.testIntegration.TestIntegrationUtils.runTestMethodTemplate(TestIntegrationUtils.java:214) at com.intellij.testIntegration.TestIntegrationUtils.runTestMethodTemplate(TestIntegrationUtils.java:173) at com.intellij.testIntegration.createTest.JavaTestGenerator.generateMethod(JavaTestGenerator.java:258) at com.intellij.testIntegration.createTest.JavaTestGenerator.addTestMethods(JavaTestGenerator.java:238) at com.intellij.testIntegration.createTest.JavaTestGenerator$1.compute(JavaTestGenerator.java:80) at com.intellij.testIntegration.createTest.JavaTestGenerator$1.compute(JavaTestGenerator.java:61) at com.intellij.openapi.application.impl.ApplicationImpl.lambda$runWriteAction$13(ApplicationImpl.java:1032) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithClass(ApplicationImpl.java:1011) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1032) at com.intellij.testIntegration.createTest.JavaTestGenerator.lambda$generateTest$0(JavaTestGenerator.java:61) at com.intellij.psi.impl.source.PostprocessReformattingAspect.postponeFormattingInside(PostprocessReformattingAspect.java:146) at com.intellij.testIntegration.createTest.JavaTestGenerator.generateTest(JavaTestGenerator.java:60) at com.intellij.testIntegration.createTest.CreateTestAction.lambda$invoke$0(CreateTestAction.java:123) at com.intellij.openapi.project.DumbService.withAlternativeResolveEnabled(DumbService.java:355) at com.intellij.testIntegration.createTest.CreateTestAction.lambda$invoke$1(CreateTestAction.java:123) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:219) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:174) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:164) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:150) at com.intellij.testIntegration.createTest.CreateTestAction.invoke(CreateTestAction.java:120) at com.intellij.testIntegration.JavaTestCreator.createTest(JavaTestCreator.java:42) at com.intellij.testIntegration.GotoTestOrCodeHandler$1.execute(GotoTestOrCodeHandler.java:93) at com.intellij.codeInsight.navigation.GotoTargetHandler.lambda$show$2(GotoTargetHandler.java:134) at com.intellij.ui.popup.PopupListAdapter.lambda$setItemsChosenCallback$1(PopupListAdapter.java:65) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105) at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:94) at com.intellij.ui.popup.AbstractPopup.lambda$dispose$18(AbstractPopup.java:1543) at com.intellij.util.ui.EdtInvocationManager.invokeLaterIfNeeded(EdtInvocationManager.java:113) at com.intellij.ide.IdeEventQueue.ifFocusEventsInTheQueue(IdeEventQueue.java:179) at com.intellij.ide.IdeEventQueue.executeWhenAllFocusEventsLeftTheQueue(IdeEventQueue.java:132) at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:163) at com.intellij.ui.popup.AbstractPopup.dispose(AbstractPopup.java:1540) at com.intellij.openapi.util.ObjectTree.runWithTrace(ObjectTree.java:126) at com.intellij.openapi.util.ObjectTree.executeAll(ObjectTree.java:158) at com.intellij.openapi.util.Disposer.dispose(Disposer.java:217) at com.intellij.ui.popup.AbstractPopup.cancel(AbstractPopup.java:800) at com.intellij.ui.popup.AbstractPopup.closeOk(AbstractPopup.java:734) at com.intellij.openapi.ui.popup.PopupChooserBuilder.closePopup(PopupChooserBuilder.java:470) at com.intellij.openapi.ui.popup.PopupChooserBuilder$1.mouseReleased(PopupChooserBuilder.java:329) at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:298) at java.desktop/java.awt.Component.processMouseEvent(Component.java:6648) at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3392) at java.desktop/java.awt.Component.processEvent(Component.java:6413) at java.desktop/java.awt.Container.processEvent(Container.java:2266) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5022) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854) at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948) at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575) at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310) at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2802) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:781) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:730) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:724) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:754) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:752) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:751) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:898) at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:820) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:743) 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)

padis avatar Jul 28 '22 08:07 padis

Duplicate of #787 (and many many others)

tbroyer avatar Jul 28 '22 08:07 tbroyer

In my case it was fixed with https://github.com/google/google-java-format/issues/787#issuecomment-1158034061

javatlacati avatar Sep 06 '22 05:09 javatlacati

Close as Dup of #787, as others mentioned. 1.16.0.0 will give you instructions on how to fix this.

plumpy avatar Mar 03 '23 20:03 plumpy