Skip to content
This repository has been archived by the owner on Aug 3, 2024. It is now read-only.

Java InaccessibleObjectException when running :Validate #618

Open
McTrafaret opened this issue Sep 12, 2021 · 1 comment
Open

Java InaccessibleObjectException when running :Validate #618

McTrafaret opened this issue Sep 12, 2021 · 1 comment

Comments

@McTrafaret
Copy link

McTrafaret commented Sep 12, 2021

I tried running the example from http://eclim.org/gettingstarted.html. Saving the file after System. didn't do anything.
I then checked it once again with :Validate and it showed an error. In eclim logs i found the following:

java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InaccessibleObjectException: Unable to make field protected java.lang.Object java.io.Reader.lock accessible: module java.base does not "opens java.io" to unnamed module @3c380bd8
        at org.eclim.util.file.FileOffsets.compile(FileOffsets.java:69) ~[eclim.jar:?]
        at org.eclim.plugin.jdt.command.src.SrcUpdateCommand.execute(SrcUpdateCommand.java:89) ~[?:?]
        at org.eclim.command.Main$1.run(Main.java:100) ~[eclim.jar:?]
        at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40) ~[org.eclipse.swt.gtk.linux.x86_64_3.116.100.v20210602-2209.jar:?]
        at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185) ~[org.eclipse.swt.gtk.linux.x86_64_3.116.100.v20210602-2209.jar:?]
        at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:5096) ~[org.eclipse.swt.gtk.linux.x86_64_3.116.100.v20210602-2209.jar:?]
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4602) ~[org.eclipse.swt.gtk.linux.x86_64_3.116.100.v20210602-2209.jar:?]
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1157) ~[org.eclipse.e4.ui.workbench.swt_0.16.100.v20210315-1604.jar:?]
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) ~[org.eclipse.core.databinding.observable_1.10.0.v20200730-0848.jar:?]
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046) ~[org.eclipse.e4.ui.workbench.swt_0.16.100.v20210315-1604.jar:?]
        at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155) ~[org.eclipse.e4.ui.workbench_1.13.0.v20210521-0741.jar:?]
        at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644) ~[org.eclipse.ui.workbench_3.122.200.v20210506-1640.jar:?]
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) [org.eclipse.core.databinding.observable_1.10.0.v20200730-0848.jar:?]
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4602) ~[org.eclipse.swt.gtk.linux.x86_64_3.116.100.v20210602-2209.jar:?]
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1157) ~[org.eclipse.e4.ui.workbench.swt_0.16.100.v20210315-1604.jar:?]
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) ~[org.eclipse.core.databinding.observable_1.10.0.v20200730-0848.jar:?]
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046) ~[org.eclipse.e4.ui.workbench.swt_0.16.100.v20210315-1604.jar:?]
        at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155) ~[org.eclipse.e4.ui.workbench_1.13.0.v20210521-0741.jar:?]
        at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644) ~[org.eclipse.ui.workbench_3.122.200.v20210506-1640.jar:?]
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) [org.eclipse.core.databinding.observable_1.10.0.v20200730-0848.jar:?]
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551) [org.eclipse.ui.workbench_3.122.200.v20210506-1640.jar:?]
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156) [org.eclipse.ui.workbench_3.122.200.v20210506-1640.jar:?]
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152) [org.eclipse.ui.ide.application_1.4.100.v20210506-1050.jar:?]
        at org.eclim.eclipse.EclimApplication.start(EclimApplication.java:130) [eclim.jar:?]
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203) [org.eclipse.equinox.app_1.5.100.v20210212-1143.jar:?]
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) [org.eclipse.osgi_3.16.300.v20210525-1715.jar:?]
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) [org.eclipse.osgi_3.16.300.v20210525-1715.jar:?]
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401) [org.eclipse.osgi_3.16.300.v20210525-1715.jar:?]
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255) [org.eclipse.osgi_3.16.300.v20210525-1715.jar:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:567) ~[?:?]
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:654) [org.eclipse.equinox.launcher_1.6.200.v20210416-2027.jar:?]
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591) [org.eclipse.equinox.launcher_1.6.200.v20210416-2027.jar:?]
        at org.eclipse.equinox.launcher.Main.run(Main.java:1462) [org.eclipse.equinox.launcher_1.6.200.v20210416-2027.jar:?]
        at org.eclipse.equinox.launcher.Main.main(Main.java:1435) [org.eclipse.equinox.launcher_1.6.200.v20210416-2027.jar:?]
Caused by: java.lang.RuntimeException: java.lang.reflect.InaccessibleObjectException: Unable to make field protected java.lang.Object java.io.Reader.lock accessible: module java.base does not "opens java.io" to unnamed module @3c380bd8
        at org.eclim.util.file.FileOffsets.compileOffsets(FileOffsets.java:117) ~[eclim.jar:?]
        at org.eclim.util.file.FileOffsets.compile(FileOffsets.java:82) ~[eclim.jar:?]
        at org.eclim.util.file.FileOffsets.compile(FileOffsets.java:67) ~[eclim.jar:?]
        ... 29 more
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field protected java.lang.Object java.io.Reader.lock accessible: module java.base does not "opens java.io" to unnamed module @3c380bd8
        at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357) ~[?:?]
        at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) ~[?:?]
        at java.lang.reflect.Field.checkCanSetAccessible(Field.java:177) ~[?:?]
        at java.lang.reflect.Field.setAccessible(Field.java:171) ~[?:?]
        at org.eclim.util.file.BufferedReader.getDeclaredField(BufferedReader.java:151) ~[eclim.jar:?]
        at org.eclim.util.file.BufferedReader.<init>(BufferedReader.java:139) ~[eclim.jar:?]
        at org.eclim.util.file.BufferedReader.<init>(BufferedReader.java:123) ~[eclim.jar:?]
        at org.eclim.util.file.FileOffsets.compileOffsets(FileOffsets.java:95) ~[eclim.jar:?]
        at org.eclim.util.file.FileOffsets.compile(FileOffsets.java:82) ~[eclim.jar:?]
        at org.eclim.util.file.FileOffsets.compile(FileOffsets.java:67) ~[eclim.jar:?]
        ... 29 more

I'm running Arch Linux 5.13.4-arch1-1. Eclipse was installed from AUR: https://aur.archlinux.org/packages/eclipse-java-bin/

Java version:

$ java --version
openjdk 16.0.1 2021-04-20
OpenJDK Runtime Environment (build 16.0.1+9)
OpenJDK 64-Bit Server VM (build 16.0.1+9, mixed mode)

And I'm running nvim can this be an issue?

$ nvim --version
NVIM v0.5.0
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/cc -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/build/neovim/src/neovim-0.5.0/build/config -I/build/neovim/src/neovim-0.5.0/src -I/usr/include -I/build/neovim/src/neovim-0.5.0/build/src/nvim/auto -I/build/neovim/src/neovim-0.5.0/build/include
Compiled by builduser

All other features seem to work fine.

UPD: tried on Vim 8.2 -- got the same

@sideshowbarker
Copy link
Contributor

To quote the relevant error message:

java.lang.reflect.InaccessibleObjectException: Unable to make field protected java.lang.Object java.io.Reader.lock accessible: module java.base does not "opens java.io" to unnamed module

You should be able to fix that error by editing your eclipse.ini file and adding the following line:

--add-opens=java.base/java.io=ALL-UNNAMED

The location of your eclipse.ini file depends on what OS/platform you’re on, and where you have Eclipse installed.

On my macOS system, the eclipse.ini file is here:

/Applications/Eclipse Java.app/Contents/Eclipse/eclipse.ini

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants