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
Mike
01/10/2020, 12:15 PM
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
stantronic
01/10/2020, 5:06 PM
cool, will check that out, thanks
e
elizarov
01/13/2020, 9:49 AM
What’s wrong with having it as a data in production even if you don’t need it?
s
stantronic
01/13/2020, 1:27 PM
just longer build-times and bigger apk
e
elizarov
01/13/2020, 2:30 PM
Would’t R8 remove unused methods when building apk?
s
stantronic
01/13/2020, 3:07 PM
maybe it does, if it does, that’s great. Is this documented anywhere?