jMonkeyEngine-Contributions / Lemur

Lemur is a jMonkeyEngine-based UI toolkit.
http://jmonkeyengine-contributions.github.io/Lemur/
BSD 3-Clause "New" or "Revised" License
116 stars 32 forks source link

JAVA SDK Update leads to crash in StyleLoader #107

Open Aufricer opened 2 years ago

Aufricer commented 2 years ago

I had updated my SDK to OpenJDK 18.0.1. a few days ago. Recently I was about to check something in the Lemur project. Not sure if this needs to be adressed but it could be an issue, if ever the SDK is to be updated I got the following errors, that resolved when I switched back to the old SDK (Java 1.8.0_212 in that case):
(Just posting the full stack here in case)

java.lang.RuntimeException: Error compiling script:/com/simsilica/lemur/style/StyleApi.groovy at com.simsilica.lemur.style.StyleLoader.compileApi(StyleLoader.java:94) at com.simsilica.lemur.style.StyleLoader.(StyleLoader.java:82) at com.simsilica.lemur.style.StyleLoader.(StyleLoader.java:62) at com.simsilica.lemur.style.BaseStyles.loadStyleResources(BaseStyles.java:72) at com.simsilica.lemur.style.BaseStyles.loadGlassStyle(BaseStyles.java:62) at demo.DemoLauncher.simpleInitApp(DemoLauncher.java:118) at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:240) at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:139) at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:221) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: General error during class generation: Unable to make protected void java.lang.Object.finalize() throws java.lang.Throwable accessible: module java.base does not "opens java.lang" to unnamed module @1c655221

java.lang.reflect.InaccessibleObjectException: Unable to make protected void java.lang.Object.finalize() throws java.lang.Throwable accessible: module java.base does not "opens java.lang" to unnamed module @1c655221 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.Method.checkCanSetAccessible(Method.java:200) at java.base/java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:130) at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:86) at java.base/java.security.AccessController.doPrivileged(AccessController.java:318) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:81) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:79) at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:250) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:116) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:79) at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:250) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:116) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:79) at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:250) at org.codehaus.groovy.reflection.stdclasses.CachedClosureClass.(CachedClosureClass.java:29) at org.codehaus.groovy.reflection.ClassInfo.createCachedClass(ClassInfo.java:269) at org.codehaus.groovy.reflection.ClassInfo.access$400(ClassInfo.java:36) at org.codehaus.groovy.reflection.ClassInfo$LazyCachedClassRef.initValue(ClassInfo.java:435) at org.codehaus.groovy.reflection.ClassInfo$LazyCachedClassRef.initValue(ClassInfo.java:426) at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) at org.codehaus.groovy.reflection.ClassInfo.getCachedClass(ClassInfo.java:89) at org.codehaus.groovy.reflection.ReflectionCache.getCachedClass(ReflectionCache.java:107) at org.codehaus.groovy.classgen.asm.BytecodeHelper.box(BytecodeHelper.java:614) at org.codehaus.groovy.classgen.asm.BytecodeHelper.box(BytecodeHelper.java:606) at org.codehaus.groovy.classgen.asm.OperandStack.box(OperandStack.java:203) at org.codehaus.groovy.classgen.asm.CallSiteWriter.makeCallSite(CallSiteWriter.java:302) at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCachedCall(InvocationWriter.java:260) at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:345) at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:89) at org.codehaus.groovy.classgen.asm.InvocationWriter.makeInvokeMethodCall(InvocationWriter.java:73) at org.codehaus.groovy.classgen.asm.InvocationWriter.writeInvokeMethod(InvocationWriter.java:412) at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpression(AsmClassGenerator.java:686) at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:64) at org.codehaus.groovy.classgen.asm.StatementWriter.writeReturn(StatementWriter.java:582) at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeReturn(OptimizingStatementWriter.java:316) at org.codehaus.groovy.classgen.AsmClassGenerator.visitReturnStatement(AsmClassGenerator.java:543) at org.codehaus.groovy.ast.stmt.ReturnStatement.visit(ReturnStatement.java:47) at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:81) at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeBlockStatement(OptimizingStatementWriter.java:155) at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:493) at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:101) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:112) at org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:357) at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:314) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:123) at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:434) at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1055) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:50) at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:177) at org.codehaus.groovy.control.CompilationUnit$15.call(CompilationUnit.java:794) at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1036) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:572) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:550) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:527) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:279) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:258) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:244) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:202) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.getScriptClass(GroovyScriptEngineImpl.java:368) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.compile(GroovyScriptEngineImpl.java:174) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.compile(GroovyScriptEngineImpl.java:187) at com.simsilica.lemur.style.StyleLoader.compileApiResource(StyleLoader.java:109) at com.simsilica.lemur.style.StyleLoader.compileApi(StyleLoader.java:89) at com.simsilica.lemur.style.StyleLoader.(StyleLoader.java:82) at com.simsilica.lemur.style.StyleLoader.(StyleLoader.java:62) at com.simsilica.lemur.style.BaseStyles.loadStyleResources(BaseStyles.java:72) at com.simsilica.lemur.style.BaseStyles.loadGlassStyle(BaseStyles.java:62) at demo.DemoLauncher.simpleInitApp(DemoLauncher.java:118) error

at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.compile(GroovyScriptEngineImpl.java:182)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.compile(GroovyScriptEngineImpl.java:187)
at com.simsilica.lemur.style.StyleLoader.compileApiResource(StyleLoader.java:109)
at com.simsilica.lemur.style.StyleLoader.compileApi(StyleLoader.java:89)
... 9 more

Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: General error during class generation: Unable to make protected void java.lang.Object.finalize() throws java.lang.Throwable accessible: module java.base does not "opens java.lang" to unnamed module @1c655221

java.lang.reflect.InaccessibleObjectException: Unable to make protected void java.lang.Object.finalize() throws java.lang.Throwable accessible: module java.base does not "opens java.lang" to unnamed module @1c655221 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.Method.checkCanSetAccessible(Method.java:200) at java.base/java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:130) at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:86) at java.base/java.security.AccessController.doPrivileged(AccessController.java:318) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:81) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:79) at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:250) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:116) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:79) at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:250) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:116) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:79) at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:250) at org.codehaus.groovy.reflection.stdclasses.CachedClosureClass.(CachedClosureClass.java:29) at org.codehaus.groovy.reflection.ClassInfo.createCachedClass(ClassInfo.java:269) at org.codehaus.groovy.reflection.ClassInfo.access$400(ClassInfo.java:36) at org.codehaus.groovy.reflection.ClassInfo$LazyCachedClassRef.initValue(ClassInfo.java:435) at org.codehaus.groovy.reflection.ClassInfo$LazyCachedClassRef.initValue(ClassInfo.java:426) at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) at org.codehaus.groovy.reflection.ClassInfo.getCachedClass(ClassInfo.java:89) at org.codehaus.groovy.reflection.ReflectionCache.getCachedClass(ReflectionCache.java:107) at org.codehaus.groovy.classgen.asm.BytecodeHelper.box(BytecodeHelper.java:614) at org.codehaus.groovy.classgen.asm.BytecodeHelper.box(BytecodeHelper.java:606) at org.codehaus.groovy.classgen.asm.OperandStack.box(OperandStack.java:203) at org.codehaus.groovy.classgen.asm.CallSiteWriter.makeCallSite(CallSiteWriter.java:302) at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCachedCall(InvocationWriter.java:260) at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:345) at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:89) at org.codehaus.groovy.classgen.asm.InvocationWriter.makeInvokeMethodCall(InvocationWriter.java:73) at org.codehaus.groovy.classgen.asm.InvocationWriter.writeInvokeMethod(InvocationWriter.java:412) at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpression(AsmClassGenerator.java:686) at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:64) at org.codehaus.groovy.classgen.asm.StatementWriter.writeReturn(StatementWriter.java:582) at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeReturn(OptimizingStatementWriter.java:316) at org.codehaus.groovy.classgen.AsmClassGenerator.visitReturnStatement(AsmClassGenerator.java:543) at org.codehaus.groovy.ast.stmt.ReturnStatement.visit(ReturnStatement.java:47) at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:81) at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeBlockStatement(OptimizingStatementWriter.java:155) at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:493) at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:101) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:112) at org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:357) at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:314) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:123) at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:434) at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1055) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:50) at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:177) at org.codehaus.groovy.control.CompilationUnit$15.call(CompilationUnit.java:794) at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1036) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:572) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:550) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:527) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:279) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:258) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:244) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:202) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.getScriptClass(GroovyScriptEngineImpl.java:368) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.compile(GroovyScriptEngineImpl.java:174) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.compile(GroovyScriptEngineImpl.java:187) at com.simsilica.lemur.style.StyleLoader.compileApiResource(StyleLoader.java:109) at com.simsilica.lemur.style.StyleLoader.compileApi(StyleLoader.java:89) at com.simsilica.lemur.style.StyleLoader.(StyleLoader.java:82) at com.simsilica.lemur.style.StyleLoader.(StyleLoader.java:62) at com.simsilica.lemur.style.BaseStyles.loadStyleResources(BaseStyles.java:72) at com.simsilica.lemur.style.BaseStyles.loadGlassStyle(BaseStyles.java:62) at demo.DemoLauncher.simpleInitApp(DemoLauncher.java:118) at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:240) at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:139) at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:221) at java.base/java.lang.Thread.run(Thread.java:833)

pspeed42 commented 2 years ago

It's weird because when I try to run my app JME on Java 18, I get a different (but similar) error before things even get to Lemur: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module

The application otherwise comes up and Lemur works fine (other parts of my app fail because of the above).

To fix the above error, on newer versions of Java I have to add: --add-opens java.base/java.io=ALL-UNNAMED

...to the command line. You may be able to do similar in your case with java.base/java.lang