[SOLVED] java.lang.IllegalAccessError JME 3.4.0alpha6 + Lemur

Hi

After switching to JME v3.4.0-alpha6 I am getting this error when using Lemur

java.lang.IllegalAccessError: class com.simsilica.lemur.event.KeyAction tried to access private method 'void com.jme3.input.KeyNames.<init>()' (com.simsilica.lemur.event.KeyAction and com.jme3.input.KeyNames are in unnamed module of loader 'app')
	at com.simsilica.lemur.event.KeyAction.<clinit>(KeyAction.java:52) ~[lemur-1.15.0-SNAPSHOT.jar:?]
	at com.simsilica.lemur.component.TextEntryComponent.<clinit>(TextEntryComponent.java:106) ~[lemur-1.15.0-SNAPSHOT.jar:?]
	at com.simsilica.lemur.TextField.createTextEntryComponent(TextField.java:130) ~[lemur-1.15.0-SNAPSHOT.jar:?]
	at com.simsilica.lemur.TextField.setDocumentModel(TextField.java:123) ~[lemur-1.15.0-SNAPSHOT.jar:?]
	at com.simsilica.lemur.TextField.<init>(TextField.java:109) ~[lemur-1.15.0-SNAPSHOT.jar:?]
	at com.simsilica.lemur.TextField.<init>(TextField.java:73) ~[lemur-1.15.0-SNAPSHOT.jar:?]
	at game.LoginState.initialize(LoginState.java:167) ~[main/:?]
	at com.jme3.app.state.BaseAppState.initialize(BaseAppState.java:132) ~[jme3-core-3.4.0-alpha6.jar:3.4.0-alpha6]
	at com.jme3.app.state.AppStateManager.initializePending(AppStateManager.java:316) ~[jme3-core-3.4.0-alpha6.jar:3.4.0-alpha6]
	at com.jme3.app.state.AppStateManager.update(AppStateManager.java:346) ~[jme3-core-3.4.0-alpha6.jar:3.4.0-alpha6]
	at com.jme3.app.SimpleApplication.update(SimpleApplication.java:254) ~[jme3-core-3.4.0-alpha6.jar:3.4.0-alpha6]
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:160) ~[jme3-lwjgl-3.4.0-alpha6.jar:3.4.0-alpha6]
	at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:196) ~[jme3-lwjgl-3.4.0-alpha6.jar:3.4.0-alpha6]
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:242) ~[jme3-lwjgl-3.4.0-alpha6.jar:3.4.0-alpha6]
	at java.base/java.lang.Thread.run(Thread.java:832) [?:?]

I noticed KeyNames.java class recently modified (a private no-arg constructor added)

in this commit

Seems KeyAction class is instantiating it (for some reason?) here

and then using it here

which could/can be replaced by a static method call

1 Like

Used to be that there was no static getName() method and so the only way to get them was to instantiate a KeyNames.

Itā€™s unfortunate that this breaking change means that Lemur will not support JME 3.4 for the near to mid future since Iā€™m unable to release new Lemur versions until I take the hours/days that it takes to move to maven central.

I hope perhaps that this can be put back and deprecated instead.

Edit: the commit doesnā€™t mention an issue number so Iā€™m not sure where to add a comment about putting the constructor back but deprecating it.

2 Likes

By the way, if you wanted to submit a PR for Lemur with the change, I will review+apply it as soon as Iā€™m able.

Iā€™ve made a comment on the KeyNames commit hoping we can put the constructor back as deprecated for 3.4ā€¦ but in the mean time we can fix Lemur for folks who build from source.

2 Likes

I am submitting one right now :slightly_smiling_face:

2 Likes

@Ali_RS thanks for reporting the issue.

I assumed KeyNames had always been a utility class. Iā€™ll remove the constructor for KeyNames to avoid breaking Lemur.

2 Likes

Submitted a fix for Lemur

1 Like

It should have beenā€¦ I suspect the original issue was a typo or close to it. I donā€™t want to speculate about vague memories I have about conversations from that time period so weā€™ll leave it at that.

A public constructor marked deprecated would at least kick out warnings.

Edit: and note, the non-static getName() goes all the way back to 3.0 or somethingā€¦ 3.1 it was made static, I guess.

1 Like

Thank you @sgold

1 Like

And thanks again to @Ali_RS for testing alpha6 and reporting the issue!

So much easier to deal with it now than during betaā€¦

2 Likes

Please re-test with JME v3.4.0-alpha7.

2 Likes

Just tested it, works fine. Thanks

2 Likes