https://kotlinlang.org logo
#splitties
Title
# splitties
i

ispbox

08/25/2019, 8:03 AM
I migrated to Android Studio 3.5, and found a very strange bug in Code Analysis - in runs in a cycle on my Splitties DSL files because of internal crashes. I tried to localize the problem, and found that the root cause is in AppCompat split. It fails on the following declaration:
Copy code
private val appCompatStyles = AppCompatStyles(ctx)
    private val buttons = appCompatStyles.button

    val button = buttons.default {
    }
while the following replacement works well:
Copy code
val button = view<AppCompatButton>(::AppCompatButton){
            }
My initial idea was to file a bug for JetBrains, but looks like the problem is in Splitties, see attachment. Am I wrong?
Compilation goes fine for both cases. And my problem is that file is not analysed, while AS is busy at 99% of CPU.
IDEA log contains direct message to report the problem to JetBrains, so I did that: https://youtrack.jetbrains.net/issue/KT-33521
l

louiscad

08/25/2019, 10:25 AM
Do you have the same issue if you don't put
appCompatStyles.button
in a property and use it only when creating a button?
i

ispbox

08/25/2019, 11:40 AM
@louiscad, yes, the problem is still there if I move styles to method:
Copy code
val appCompatStyles = AppCompatStyles(ctx)
            val buttons = appCompatStyles.button
            val crashingButton = buttons.default { }
For now I just replaced few usages with generic view instantiation (
view<Type>
) and code analysis works perfectly.
l

louiscad

08/25/2019, 11:47 AM
It's weird. I don't use
AppCompatStyles
nowadays since I moved to
MaterialComponentsStyles
, but they are very similar and it works fine for me on AS 3.5.0 and Kotlin 1.3.50. I'm using the latest dev version of Splitties though, compiled with 1.3.41.
i

ispbox

08/25/2019, 12:01 PM
I just tested with Material styles:
Copy code
val materialStyles = MaterialComponentsStyles(ctx)
            val buttons =  materialStyles.button
            val crashingButton = buttons.outlined { }
The problem is the same. I guess we should wait for JetBrains answer.
2 Views