Is there any way of making certain classes compile...
# language-evolution
s
Is there any way of making certain classes compile as data classes for some builds and normal classes for other builds? Thinking specifically of tests where you might want to use data-class style equals for assertions, but you dont need it in production
🤔 1
đźš« 1
m
Use a different assertion library that supports property by property comparisons. AssertJ does this very well, and is one reason I've stuck with it, even for Kotlin code. I believe KotlinTest has added this, or intends to add it to their assertions. Not sure if Atrium, AssertK or others have this type of feature yet. https://assertj.github.io/doc/#assertj-core-recursive-comparison
âž• 1
s
cool, will check that out, thanks
e
What’s wrong with having it as a data in production even if you don’t need it?
s
just longer build-times and bigger apk
e
Would’t R8 remove unused methods when building apk?
s
maybe it does, if it does, that’s great. Is this documented anywhere?