florent37 / Android-NoSql

Lightweight, simple structured NoSQL database for Android
Apache License 2.0
288 stars 40 forks source link

Jacoco causes a crash #3

Open xgleich1 opened 7 years ago

xgleich1 commented 7 years ago

First of all a huge thanks for your library!

I was trying to use it and ran into a rather strange bug. The put operation always threw a exception:

java.lang.ClassCastException: boolean[] cannot be cast to java.lang.Object[] at com.github.florent37.androidnosql.NoSql$Node.write(NoSql.java:475)

Further digging with the LogDataServer revealed this:

nodes: /user/florent/cars/0/$jacocoData/ -> []

For some very strange reason the db tries to save coverage data associated with the jacoco plugin.

I could also replicate it in your example app when I added:

apply plugin: 'jacoco'

android { buildTypes { debug { testCoverageEnabled = true } } }

in the build.gradle file of the app module.

I hope this helps while debugging the issue!

florent37 commented 7 years ago

Oh :/ I'll try this

In Java the autoboxing don't allow to cast boolean[] to Object[] ? Seem strange

Le 6 juin 2017 23:48, "Ferranis" notifications@github.com a écrit :

First of all a huge thanks for your library!

I was trying to use it and ran into a rather strange bug. The put operation always threw a exception:

java.lang.ClassCastException: boolean[] cannot be cast to java.lang.Object[] at com.github.florent37.androidnosql.NoSql$Node.write(NoSql.java:475)

Further digging with the LogDataServer revealed this:

nodes: /user/florent/cars/0/$jacocoData/ -> []

For some very strange reason the db tries to save coverage data associated with the jacoco plugin.

I could also replicate it in your example app when I added:

apply plugin: 'jacoco'

android { buildTypes { debug { testCoverageEnabled = true } } }

in the build.gradle file of the app module.

I hope this helps while debugging the issue!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/florent37/Android-NoSql/issues/3, or mute the thread https://github.com/notifications/unsubscribe-auth/AFfQXKf6TS0FdxH5XhjSX5PVKL63hnE-ks5sBck9gaJpZM4Nx9aH .

xgleich1 commented 7 years ago

Primitive types seem to cause problems in general. I just added a primitive boolean as another (last one) member variable to the user class and it ran into an endless loop which produces this log in repeat:

D/LogDataSaver: nodes: /user/florent/flag/FALSE/FALSE/FALSE/FALSE/FALSE/FALSE/FALSE/FALSE/FALSE

For another note, you probable don't support this, but if I use types in kotlin (Int, Long) which correspond to primitive types in java there is also a exception thrown.

For the cast thing this seems to be the case, you cannot cast primitive types to their boxes and vice versa :/

florent37 commented 7 years ago

oh :/