-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Realm incompatible with Kotlin projects compiled against a Java version newer than 8 #887
Comments
@jakobkmar Thanks for the report and temporary workaround. We will investigate how to enforce our minimal required version along with working with other libraries. Do you mind sharing any immediate combination of libraries/setup that triggers this? |
Sorry for the late reply! You simply have to find a library which has been compiled targetting a more recent Java version than 8 and try using an inline function from that library. I currently do not know any lightweight library which I can recommend for quickly testing this - but if you really need it I can search for one. However creating a very simple one with one inline function taking a lambda parameter and publishing it to Maven Local and then adding it to a realm project is enough to trigger this issue. |
Thanks a lot for the workaround. It's a lifesaver! I have faced the same problem with my stack: Compose (which requires JVM 11) + Koin (using reified inline functions to provide dependencies) + Realm. Also, I noticed that the workaround looks like an extension-based solution. I rewrote it a bit:
|
I ran into this issue while implementing: Nordic's BLE Library and got the error on asValidResponseFlow() off of setNotificationCallback. I can confirm the above fix allows my code to once again compile. |
Is there an update on this issue? The workaround is effective for me, but it remains just that — a workaround |
This is fixed by #1513 available from the |
Cause:
realm-kotlin/packages/gradle-plugin/src/main/kotlin/io/realm/kotlin/gradle/RealmPlugin.kt
Line 92 in 0198f3a
Because of this, Realm is incompatible with other Kotlin libraries which have been built targetting a newer JVM version - since it is impossible to inline functions from these libraries then.
I don't think the Realm Gradle plugin should force all compilations to target JVM 1.8, right?
The temporary workaround to overwrite what the Realm Gradle plugin set here is the following:
The text was updated successfully, but these errors were encountered: