Adam- / runelite-plugins

17 stars 41 forks source link

BankValueHistoryTracker: InaccessibleObjectException when adding new entry #77

Closed Ivan-Johnson closed 11 months ago

Ivan-Johnson commented 11 months ago

So I noticed a while ago that when I open the bank and hit BankValueHistoryTracker's "add entry" button it just hangs indefinitely and it never actually creates the new entry. Here is the error that I see on stdout/stderr:

2023-12-31 15:20:52 EST [Client] ERROR n.r.client.callback.ClientThread - Exception in invoke java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.time.LocalDate java.time.LocalDateTime.date accessible: module java.base does not "opens java.time" to unnamed module @35390ee3 at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178) at java.base/java.lang.reflect.Field.setAccessible(Field.java:172) at com.google.gson.internal.reflect.UnsafeReflectionAccessor.makeAccessible(UnsafeReflectionAccessor.java:44) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:159) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102) at com.google.gson.Gson.getAdapter(Gson.java:458) at com.google.gson.internal.bind.MapTypeAdapterFactory.getKeyAdapter(MapTypeAdapterFactory.java:142) at com.google.gson.internal.bind.MapTypeAdapterFactory.create(MapTypeAdapterFactory.java:125) at com.google.gson.Gson.getAdapter(Gson.java:458) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102) at com.google.gson.Gson.getDelegateAdapter(Gson.java:541) at com.google.gson.internal.bind.TreeTypeAdapter.delegate(TreeTypeAdapter.java:89) at com.google.gson.internal.bind.TreeTypeAdapter.write(TreeTypeAdapter.java:74) at com.google.gson.Gson.toJson(Gson.java:704) at com.google.gson.Gson.toJson(Gson.java:683) at com.google.gson.Gson.toJson(Gson.java:658) at com.adriansoftware.BankValueHistoryTracker.add(BankValueHistoryTracker.java:116) at com.adriansoftware.BankValueHistoryTracker.lambda$addEntry$1(BankValueHistoryTracker.java:252) at net.runelite.client.callback.ClientThread.lambda$invokeLater$1(ClientThread.java:80) at net.runelite.client.callback.ClientThread.invokeList(ClientThread.java:119) at net.runelite.client.callback.ClientThread.invoke(ClientThread.java:101) at net.runelite.client.callback.Hooks.tick(Hooks.java:218) at client.yq(client.java:58060) at client.bp(client.java) at bm.ad(bm.java:394) at bm.tr(bm.java) at bm.run(bm.java:49095) at java.base/java.lang.Thread.run(Thread.java:840)

I only see this error on my Arch Linux machine, not my Windows machine. Initially this made me think that the error occurs because I'm using Wayland, which isn't yet fully supported by Java. However, that was before I saw the error message; now I think it might have something to do with the specific version of Java I'm using.

Diagnostics

000:i@sparta:~
$ java -version
openjdk version "17.0.9" 2023-10-17
OpenJDK Runtime Environment (build 17.0.9+8)
OpenJDK 64-Bit Server VM (build 17.0.9+8, mixed mode)
000:i@sparta:~
$

Info from Runelite's Info tab:

RuneLite version: 1.10.18.1
Oldschool revision: Rev 218
Launcher version: 2.6.7

In the plugin list, Runelite reports that the Bank Value Tracker has version 3d0e4b73

Temporary workaround

I've done some searching, and found a similar issue on StackOverflow. It doesn't actually fix the root problem, but as a temporary solution I can avoid the crash and use the plugin normally if I launch Runelite with an extra environment variable: JAVA_TOOL_OPTIONS=--add-opens=java.base/java.time=ALL-UNNAMED runelite.

Ivan-Johnson commented 11 months ago

I just saw a different comment saying that this is the wrong report issues with the BankValueHistoryTracker plugin; my bad. I also see that there's already an open ticket for this issue in the correct repo :sweat_smile: