Crossposting as probably tied to Kotlin 1.4 : I'm ...
# eap
t
Crossposting as probably tied to Kotlin 1.4 : I'm getting a very weird issue and wonder if someone have already seen that, before trying to find a small repro. On some suspending functions an Android
Copy code
TextView.getText().toString() == ""
works but
Copy code
TextView.text.toString() == ""
(As suggested by IDE and previously worked) triggers
java.lang.ClassCastException: android.text.SpannableStringBuilder cannot be cast to java.lang.String
. It's like in the second case the .toString() call is converted to a cast and not the proper toString()
l
Hello, please consider using formatting
like that
for readability 🙂
Copy code
Or like that for multiline.
t
Yep forget sorry. Anyway it's definitively a Kotlin compiler issue 😞 Adding just a simple run {} wrapping the call fixes the issue 😞
g
it indeed looks like a compiler issue with suspend functions
l
Does it reproduce with IR enabled?
1
g
want ask the same, I have a similar issue with IR and Result
t
Same with both -Xnew-inference and without
g
no, it’s not about type inference
l
new-inference is abbreviated "NI", but that's not full IR
t
will test just after testing with apilevel 1.3, full build is slowwwwwww on this large project 😞
l
I wonder if it'll be quicker with IR 🤔
t
I doubt I think it's slow because of Windows and too many files badly handled by system 😞
Well
e: java.lang.IllegalStateException: Backend Internal error: Exception during IR lowering
l
Worth reporting on kotl.in/issue, preferrably with a reproducing snippet or project so they fix it before it's the default or only option.
I mean, both issues are worth reporting.
t
the second one will be impossible to repro it's a private very large project and the failure occurs on a very large file that is long waiting a refactor 😛
For the first one I still need to figure out proper repro 😞
g
same issue, reported IR crash recently, but I have no idea how to reproduce it, my issue was clossed with “Cannot reproduce” 🙄
t
Yep kotlin support is far from optimal 😞 Got some major build speed issues with incremental and they just vanished from the issue 🙂
l
I guess they hope to see it again with clue to reproduce it 🤷‍♂️
Or hope other changes will end up fixing it. After all, they are still working on it and they "only" need to get it stable in 2021 for Jetpack Compose 1.0
t
Do any one of you know a black magic thing to find all TextView.text called from suspend functions ? 🙂
g
I really don’t think that it’s the case, I think it’s some more tricky case
l
@Tolriq Possibly structural search and replace that is not fully baked and available as a separate plugin. https://youtrack.jetbrains.com/issue/KT-10176#focus=Comments-27-4256401.0-0
g
I wouldn’t update if there is such bug there
t
Unfortunately this was only spotted after going to public beta 😉 Reverting will be a lot of work 😞
g
I think it worth to revert
fortunately we catch a few similar crashes in tests and postoponed update
or maybe check 1.4.10 or 1.4.20 (master) to see was it fixed or not
because I wouldn’t be comfortable to have possibility to get ClassCastException on runtime if someone accidentally changed getText() to text
l
There's dev versions published with a special repo, more convenient than compiling all Kotlin yourself I'd assume
g
yeah, I mean try to use versions from dev repo
t
Trying to build a repro first then I'll see what I do 😞 thanks for support 🙂
Well completely unable to reproduce 😞
n
I think 1.4.20 contains many fixes about thoses issues unfortunatelly it will only be released in a few months
I have many issues with the Result class so I’m staying on Kotlin 1.3.72 for now