JetBrains/xodus-dnq

xodus-dnq is incompatible with newer Java versions (tested on Java 16)

jakobkmar opened this issue · 2 comments

xodus-dnq seems to be incompatible with Java 16.

I can't really tell how much of it does not work with Java 16, because it already breaks when calling initMetaData - because that call leads to the usage of javassist.util.proxy.ProxyFactory which is using some illegal reflection.

Here is the stack trace which comes up when calling

initMetaData(XdModel.hierarchy, store)
Exception in thread "main" java.lang.ExceptionInInitializerError
        at javassist.util.proxy.DefineClassHelper.<clinit>(DefineClassHelper.java:216)
        at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:128)
        at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:552)
        at javassist.util.proxy.ProxyFactory.createClass1(ProxyFactory.java:475)
        at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:444)
        at javassist.util.proxy.ProxyFactory.create(ProxyFactory.java:721)
        at kotlinx.dnq.util.XdHierarchyNode$naturalPersistentClassInstance$2.invoke(XdHierarchyNode.kt:96)
        at kotlinx.dnq.util.XdHierarchyNode$naturalPersistentClassInstance$2.invoke(XdHierarchyNode.kt:33)
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
        at kotlinx.dnq.util.XdHierarchyNode.getNaturalPersistentClassInstance(XdHierarchyNode.kt)
        at kotlinx.dnq.util.DNQMetaDataUtilKt.initMetaData(DNQMetaDataUtil.kt:46)
        at net.axay.pacmc.storage.Xodus.<clinit>(Xodus.kt:28)
        at net.axay.pacmc.commands.Init$run$1.invokeSuspend(Init.kt:27)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @391ad520
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
        at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
        at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
        at javassist.util.proxy.SecurityActions$3.run(SecurityActions.java:94)
        at javassist.util.proxy.SecurityActions$3.run(SecurityActions.java:90)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:554)
        at javassist.util.proxy.SecurityActions.getMethodHandle(SecurityActions.java:89)
        at javassist.util.proxy.DefineClassHelper$SecuredPrivileged$2.getDefineClassMethodHandle(DefineClassHelper.java:143)
        at javassist.util.proxy.DefineClassHelper$SecuredPrivileged$2.<init>(DefineClassHelper.java:136)
        at javassist.util.proxy.DefineClassHelper$SecuredPrivileged.<clinit>(DefineClassHelper.java:134)
        ... 19 more

Version of xodus-dnq I used is: 1.4.480

Are there any workarounds except changing JDK/JRE version? Any comments/suggestions from maintainers? I kinda need help with that one, because one of mine project's dependencies requires JDK 16...

Another issue with FakeTransientEntity:

java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @50dae5bc
	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:199)
	at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
	at javassist.util.proxy.SecurityActions.setAccessible(SecurityActions.java:103)
	at javassist.util.proxy.FactoryHelper.toClass2(FactoryHelper.java:181)
	at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:164)
	at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:508)
	at javassist.util.proxy.ProxyFactory.createClass2(ProxyFactory.java:493)
	at javassist.util.proxy.ProxyFactory.createClass1(ProxyFactory.java:429)
	at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:400)
	at kotlinx.dnq.query.FakeTransientEntity.toXdHandlingAbstraction(FakeTransientEntities.kt:303)
	at kotlinx.dnq.XdModel.toXd(XdModel.kt:155)
	at kotlinx.dnq.XdExtensionsKt.toXd(XdExtensions.kt:28)
	at kotlinx.dnq.XdEntityType.wrap(XdEntityType.kt:42)