Repository navigation
Eclipse plugin v1.15.0 thows exception in 2022-03 #779
Copy link
Copy link
Open
Labels
Description
With the eclipse plugin 1.15.0 (named 1.13.0 on the releases page) the following exception is generated every time the formatter is executed or selected.
eclipse.buildId=4.23.0.I20220308-0310
java.version=17.0.2
java.vendor=Eclipse Adoptium
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US
Framework arguments: -product org.eclipse.epp.package.java.product -keyring /Users/isaki/.eclipse_keyring
Command-line arguments: -os macosx -ws cocoa -arch x86_64 -product org.eclipse.epp.package.java.product -keyring /Users/isaki/.eclipse_keyring
org.eclipse.ui
Error
Sat Apr 23 16:27:17 EDT 2022
Unhandled event loop exception
java.lang.IllegalAccessError: class com.google.googlejavaformat.java.JavaInput (in unnamed module @0x47d32e33) 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 @0x47d32e33
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.<init>(JavaInput.java:276)
at com.google.googlejavaformat.java.Formatter.getFormatReplacements(Formatter.java:280)
at com.google.googlejavaformat.java.SnippetFormatter.format(SnippetFormatter.java:109)
at com.google.googlejavaformat.java.GoogleJavaFormatter.formatInternal(GoogleJavaFormatter.java:87)
at com.google.googlejavaformat.java.GoogleJavaFormatter.format(GoogleJavaFormatter.java:39)
at org.eclipse.jdt.internal.corext.util.CodeFormatterUtil.reformat(CodeFormatterUtil.java:361)
at org.eclipse.jdt.internal.corext.util.CodeFormatterUtil.reformat(CodeFormatterUtil.java:424)
at org.eclipse.jdt.internal.ui.preferences.formatter.JavaPreview.doFormatPreview(JavaPreview.java:246)
at org.eclipse.jdt.internal.ui.preferences.formatter.JavaPreview.doUpdate(JavaPreview.java:212)
at org.eclipse.jdt.internal.ui.preferences.formatter.JavaPreview.lambda$0(JavaPreview.java:169)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4320)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3943)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:823)
at org.eclipse.jface.window.Window.open(Window.java:799)
at org.eclipse.ui.internal.handlers.ShowPreferencePageHandler.execute(ShowPreferencePageHandler.java:58)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:283)
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:97)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:317)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:251)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:173)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:156)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:487)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:195)
at org.eclipse.e4.ui.workbench.renderers.swt.cocoa.CocoaUIHandler.runCommand(CocoaUIHandler.java:421)
at org.eclipse.e4.ui.workbench.renderers.swt.cocoa.CocoaUIHandler.access$0(CocoaUIHandler.java:407)
at org.eclipse.e4.ui.workbench.renderers.swt.cocoa.CocoaUIHandler$1.widgetSelected(CocoaUIHandler.java:281)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4579)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1524)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1547)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1532)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1325)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4365)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3941)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
I've added the following to my eclipse.ini to no avail:
--illegal-access=deny
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
Reactions are currently unavailable
Activity
scharf commentedon Apr 27, 2022
I have the same Problem...
MrThaler commentedon May 2, 2022
It should not be
--add-exports EXPORT, but instead--add-exports=EXPORT.When I correctly use the
=sign there does not seem to be an error anymore:loosebazooka commentedon May 19, 2022
It looks like the root of this issue is:
google-java-format/core/src/main/java/com/google/googlejavaformat/java/JavaInput.java
Line 37 in 27670be
rbolkameh commentedon Jul 27, 2022
I have the same problem with:
v1.15.0 (but the Eclipse plugin's jar is called google-java-format-eclipse-plugin-1.13.0.jar)
Version: 2022-06 (4.24.0)
Build id: 20220609-1112
To be able to use the plugin in Eclipse I downgraded to tag v1.11.0 [https://github.com/google/google-java-format/releases/tag/v1.11.0], and make sure in eclipse.ini you are pointing to java 11.
aczire commentedon Jan 10, 2023
Same here, with v1.15.0. Any updates?
Workaround.
v1.13.0 seems to load fine.
Environment (default eclipse install; using the new installer)
eclipse.buildId=4.26.0.20221201-1200
java.version=17.0.5
java.vendor=Eclipse Adoptium
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product
PhilippWendler commentedon Jan 20, 2023
For me as well, version 1.13.0 works but 1.15.0 does not on Eclipse with Java 17 even though I have the flags in
eclipse.ini. I even have more flags than what should be necessary:Note that testing this is a little bit tricky due to #744 (comment).
Jangor67 commentedon Mar 27, 2023
Same Issue with IntelliJ
I only have the following VM options:
--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
Clearly the above does not prevent the issue. I will now try the list as from @PhillippWendler to see if that improves things...
Version info:
Stacktrace of course a bit different:
PhilippWendler commentedon Oct 6, 2023
Current versions of the plugin (e.g., 1.18.1) work fine for me in Eclipse with Java 17.
Maxime-ADAGP commentedon Oct 20, 2023
Which version of Eclipse are you running? I am still facing the error with the latest version (1.18.1) of the plugin (stack trace copied below).
Here is my Session data :
Click here to see stack trace
PhilippWendler commentedon Oct 23, 2023
Do you have the additional options in
eclipse.inithat are discussed above?Maxime-ADAGP commentedon Oct 23, 2023
I tried with and without the additional
eclipse.iniconfigured and it still doesn't work. I have a fairly standard Eclipse installation (I have lombok installed, but that's about it).As a temporary measure, I imported the configuration provided here.
gohrner commentedon Nov 10, 2023
Following patch worked for me in Eclipse 2023-09 and Google Code Formatter plugin version 1.18.1:
I wonder why this wasn't added to the installation instruction already a long time ago? Similar information is contained in the IntelliJ setup instructions (even though there less whitelisting seems to suffice...)