I'm not sure if it a compiler issue or gradle: aft...
# compiler
e
I'm not sure if it a compiler issue or gradle: after we added the compose to our project, the gradle-profiler start to break for one unique scenario: apply-android-resource-change-to
Copy code
e: org.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during IR lowering
File being compiled: /com/x/x/x/x/x/x/RandomLayout.kt
The root cause java.lang.AssertionError was thrown at: org.jetbrains.kotlin.ir.util.IrUtilsKt.copyValueParametersToStatic(IrUtils.kt:960)
.....
Caused by: java.lang.AssertionError: Dispatch receiver type RandomLayout is not a subtype of com.x.CardLayout<com.x.DashboardCard>
	at org.jetbrains.kotlin.ir.util.IrUtilsKt.copyValueParametersToStatic(IrUtils.kt:960)
I don't even know where to start
d
It's either compiler or compose plugin Could you please show the full stacktrace?
e
stacktrace.txt
thank you color 1
d
Is something in
CardAmbientCareGiverLayout.kt
is composable?
e
No. We just added the compose compiler/dependencies to the project
d
Hm, interesting Which compiler and compose versions are you using? Also is it Jetpack Compose (android) or KMP Compose?
e
Copy code
compose-compiler = "1.5.14"
compose-bom = "2024.05.00"
kotlin = "1.9.24"
Jetpack compose
d
Could you please try with Kotlin
2.0.0
(or even with
2.0.10-RC
)? If your project isn't compatible with 2.0.0 you can update the version of the compiler and set
languageVersion
to
1.9
Note that with 2.0.0 you need to specify only kotlin version, corresponding compose plugin will be loaded automatically
e
The issue is that your gradle version is 8.0... (we are working to update as well). Do kotlin 2.0 works on this gradle version?
d
Yes it does The recommended version is 8.3, but it should work with 8.0
e
same error using kotlin 2.0. I use my gradle 8.8 branch to test it
d
It's with language version 1.9. right?
e
No. Plain kotlin 2.0
d
Very strange Is your project open-source?
e
no 😞
d
That's sad, it would be very hard to dig into without being able to reproduce it Could you please try to create a minimized example for it, which can be shared? Usually algorithm for that is following: 1. create a copy of the project 2. delete anything but
CardAmbientCareGiverLayout.kt
file and declarations are used in it 3. delete parts of this file until the issue reproduces 4. replace bodies of used declarations with
TODO()
and renaming classes/functions to some generic stuff to increase privacy
e
I'm very grateful for your support. But this whole cycle would take some time to get done. Do you have any tips based on your experience that I could try to change on code level to solve this issue? Thanks again
d
As I can see by stacktrace the problem is with some local class/anonymous object So firstly you can try to comment out all such places and check if the guess is correct Then you can try, for example, somehow refactor this code in a different ways trying to find a way that it doesn't crash (extract something into separate function, make this class not local and so on)
❤️ 1
Also it would be really helpful if you create an issue with description of the problem and example of problematic code and how you workarounded it
👍 1
BTW, did you use any libraries which already used Compose? Maybe the Compose plugin found those usages and updated them somehow in incorrect way
e
No. This is one of the reasons to add the dependencies. But at the moment we don't have any library using compose
d
Ok I'm just still trying to understand what could be the reason
❤️ 1
cc @shikasd just in case Maybe you'll have some ideas
s
We saw this in AndroidX codebase as a transient failure a couple of months ago. It seems to be related to incremental compilation, when the change was made to a particular abstract class. Haven't seen it since so didn't investigate further
294 Views