Closed mrousavy closed 3 days ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
hm - I just tested this again (in https://github.com/mrousavy/nitro/pull/346), and it seems like getFieldValue("ordinal")
works as expected for me.
Again, this would've failed in the tests already, we use this property.
So I think this is not a bug - maybe there was something else that was broken in your app @Szymon20000.
Ah there's why this works:
In Kotlin, enums have a ordinal
field. In Java, enums have a ordinal()
method.
Since we use Kotlin, we're good.
Not sure why but I keep getting the same no "I" field "ordinal" in class
error when using Kotlin Enums. The solution in this PR fixed it for me.
@shovel-kun which Kotlin version are you using? This is weird, ordinal
is definitely a field in my test cases. It works in the example app.
@shovel-kun can you please test this PR? https://github.com/mrousavy/nitro/pull/360
This is a better solution in my opinion since it has no performance impact. The PR here has one, as we switch from field access to method call.
@mrousavy
Tested the PR and it is working for me.
Not sure how to check what Kotlin version I'm using, I think 2.0.0
classpath "com.android.tools.build:gradle:7.2.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.21"
classpath "org.jetbrains.kotlin:kotlin-serialization:2.0.21"
…
apply plugin: "com.android.library"
apply plugin: 'org.jetbrains.kotlin.android'
apply from: '../nitrogen/generated/android/Tachiyomi+autolinking.gradle'
great, thx
Previously, we tried to access
.ordinal
as a field on an enum.Apparently this doesn't exist, and
ordinal()
is a method on an enum. So this PR now changes this to call that method.One thing I am wondering is; how did this work before? Afaik we have those test cases... 🤔
cc @Szymon20000 - didn't those tests work? In the example app they're green...?