https://kotlinlang.org logo
#apollo-kotlin
Title
# apollo-kotlin
j

John O'Reilly

03/01/2024, 11:12 AM
Trying out new kotlinx-datetime
0.6.0-RC
version and getting what looks like crash in apollo on iOS.....more in thread
👀 1
Copy code
Uncaught Kotlin exception: kotlin.native.internal.IrLinkageError: Function 'parse' can not be called: No function found for symbol 'kotlinx.datetime/LocalDateTime.Companion.parse|parse(kotlin.String){}[0]'
    at 0   Confetti                            0x101188ecb        kfun:kotlin.Throwable#<init>(kotlin.String?){} + 119 
    at 1   Confetti                            0x101182037        kfun:kotlin.Error#<init>(kotlin.String?){} + 115 
    at 2   Confetti                            0x1011beed3        kfun:kotlin.native.internal.IrLinkageError#<init>(kotlin.String?){} + 115 
    at 3   Confetti                            0x1011bef8b        kfun:kotlin.native.internal#ThrowIrLinkageError(kotlin.String?){}kotlin.Nothing + 163 
    at 4   Confetti                            0x1014c62df        kfun:com.apollographql.apollo3.adapter.KotlinxLocalDateTimeAdapter#fromJson(com.apollographql.apollo3.api.json.JsonReader;com.apollographql.apollo3.api.CustomScalarAdapters){}kotlinx.datetime.LocalDateTime + 235
this is confetti project which is currently using
4.0.0-beta.4
of apollo
b

bod

03/01/2024, 11:17 AM
looks like this change which is probably source but not abi compatible
s

Stylianos Gakis

03/01/2024, 11:20 AM
Aha, does it not figure out to use the default parameter somehow when you do not pass it in? 🫣
b

bod

03/01/2024, 11:21 AM
default parameters are 'unfolded' at compile time
and AK was compiled with the old signature that only expect one argument 😅
I guess datetime could have kept the old signature and make it call the new one, to make this a non breaking change
s

Stylianos Gakis

03/01/2024, 11:25 AM
They probably do want to do this though no? If you report this bug and ask them to add this function (possibly as a deprecated/hidden one) for these compatibility reasons and then make a patch release?
b

bod

03/01/2024, 11:26 AM
Could be an interesting one yes!
Since it's still in 0.x versions maybe they don't care too much on API stability yet? Not sure 🙂
s

Stylianos Gakis

03/01/2024, 11:28 AM
Still worth a file, I can do it with a link to this chat if you’re busy 😊
b

bod

03/01/2024, 11:29 AM
go for it 🙂
s

Stylianos Gakis

03/01/2024, 11:29 AM
Please do correct me if I wrote something wrong, the terminology (mainly around ABI compatibility) around this is not something I am 100% familiar with
b

bod

03/01/2024, 11:36 AM
Looks all good 🙂
j

John O'Reilly

03/01/2024, 11:58 AM
looks like fix already in the works! https://github.com/Kotlin/kotlinx-datetime/pull/357
🚀 1
s

Stylianos Gakis

03/01/2024, 12:00 PM
We’re probably about to witness a lightning fast bug found to reported to fixed turnaround 😅
John, I see that you were working on Confetti when you encountered this bug. Do you have a branch with this change pushed which you could possibly show to them so that they can reproduce it themselves too? Because I imagine doing it the other way around, somehow building their library with that fix would be more work in comparison. I am not sure how I would even do that really, clone it locally, build it and publish to maven local, import it and so on? I don’t actually know 🫣
d

Dmitry Khalanskiy [JB]

03/01/2024, 12:05 PM
git clone <https://github.com/Kotlin/kotlinx-datetime>
git checkout restore-native-bincompat
./gradlew publishToMavenLocal
; Add the
mavenLocal()
repository to your build.gradle; Depend on
0.6.0-RC-SNAPSHOT
.
1
b

bod

03/01/2024, 12:06 PM
had to do this yesterday with Ktor for some obscure reason 😅
s

Stylianos Gakis

03/01/2024, 12:08 PM
Ah okay so it was just that, thanks 😊. John if you got the confetti code pushed I could perhaps give it a try later today, if you are busy to try this yourself
j

John O'Reilly

03/01/2024, 12:25 PM
Tried it just now and confirmed it fixed the issue
🎉 1
🌟 1
and using new formatting apis now as well 🙂
😍 1
s

Stylianos Gakis

03/01/2024, 12:28 PM
That’s awesome, I’m waiting to see the PR to see those formatting APIs in action, I’ve only read the docs for now and they look very nice to use
j

John O'Reilly

03/01/2024, 12:45 PM
yeah, will create PR with changes once version is available with that fix
17 Views