java.lang.ClassCastException: class kotlinx.dnq.util.FakeEntity cannot be cast to class jetbrains.exodus.database.TransientEntity
Neitex opened this issue · 1 comments
Neitex commented
I've encountered some bizarre exception that crashes the whole app on calling XdModel.registerNodes
Stack trace:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at kotlinx.dnq.util.ReflectionUtilKt$entityConstructor$1.invoke(ReflectionUtil.kt:75)
at kotlinx.dnq.util.ReflectionUtilKt$entityConstructor$1.invoke(ReflectionUtil.kt)
at kotlinx.dnq.util.XdHierarchyNode.<init>(XdHierarchyNode.kt:72)
at kotlinx.dnq.XdModel.registerNode(XdModel.kt:106)
at kotlinx.dnq.XdModel.registerNodes(XdModel.kt:139)
at by.enrollie.xodus.InitializeDBKt.initializeDB(InitializeDB.kt:18)
at by.enrollie.xodus.DatabaseProviderImplementation.<init>(DatabaseProviderImplementation.kt:15)
at MainKt.main(main.kt:11)
at MainKt.main(main.kt)
Caused by: java.lang.ClassCastException: class kotlinx.dnq.util.FakeEntity cannot be cast to class jetbrains.exodus.database.TransientEntity (kotlinx.dnq.util.FakeEntity and jetbrains.exodus.database.TransientEntity are in unnamed module of loader 'app')
at com.jetbrains.teamsys.dnq.database.TransientEntityUtilKt.reattachTransient(TransientEntityUtil.kt:37)
at kotlinx.dnq.util.TransientEntityUtilKt.reattach(TransientEntityUtil.kt:29)
at kotlinx.dnq.util.TransientEntityUtilKt.reattach$default(TransientEntityUtil.kt:29)
at kotlinx.dnq.util.TransientEntityUtilKt.reattachAndGetPrimitiveValue(TransientEntityUtil.kt:35)
at kotlinx.dnq.simple.XdProperty.getValue(XdProperty.kt:43)
at kotlinx.dnq.simple.XdProperty.getValue(XdProperty.kt:27)
at kotlinx.dnq.simple.XdWrappedProperty.getValue(XdWrappedProperty.kt:39)
at by.enrollie.xodus.classes.XdRole.getGranted(XdRole.kt:36)
at by.enrollie.xodus.classes.XdRole$revoked$2$1.invoke(XdRole.kt:37)
at by.enrollie.xodus.classes.XdRole$revoked$2$1.invoke(XdRole.kt:37)
at kotlinx.dnq.simple.PropertyConstraintsKt.isAfter$default(PropertyConstraints.kt:491)
at by.enrollie.xodus.classes.XdRole$revoked$2.invoke(XdRole.kt:37)
at by.enrollie.xodus.classes.XdRole$revoked$2.invoke(XdRole.kt:37)
at kotlinx.dnq.simple.FactoriesKt.collect(Factories.kt:34)
at kotlinx.dnq.PropertyDelegatesKt$xdDateTimeProp$1.invoke(PropertyDelegates.kt:639)
at kotlinx.dnq.PropertyDelegatesKt$xdDateTimeProp$1.invoke(PropertyDelegates.kt)
at kotlinx.dnq.util.XdPropertyCachedProvider.provideDelegate(XdPropertyCachedProvider.kt:41)
at by.enrollie.xodus.classes.XdRole.<init>(XdRole.kt:37)
... 14 more
Source code of an app: https://github.com/enrollie/Eversity-XodusDB
Neitex commented
Sorry for the false alarm - library was trying to process non-XD property with custom getters and setter:
var roleInformation: RoleInformationHolder
get() = Json.decodeFromString(roleRawData)
set(value) {
roleRawData = Json.encodeToString(value)
}
which made it crash due to reflection problems. Rewriting this as get and set functions resolved the issue. Sorry for the inconvenience! :)