and if it somehow does become a problem, congratul...
# android
j
and if it somehow does become a problem, congratulations! you are facebook and rolling in money and you can retire and hire 300 other Android devs to fix the problem and go live on your private island
👍 9
🧌 8
😂 1
💯 1
🤣 9
g
@adam-mcneilly just for fun grep unpacked Facebook APK and found 74 enum declarations 😬
😂 4
j
I suspect they aggressively optimize them out. At Google we have something called
@SimpleEnum
which requires that the enum can be optimized into an int and fails the build if it can't.
g
Is that optimized by proguard/r8?
j
Yes
g
So is it just enum without fields and methods marked as SimpleEnum?
j
Yes. The key is just that you are prevented from causing de-optimization without explicitly removing the annotation.
g
Such approach is much better than
@IntDef
imo Thanks for information
j
I don't disagree!
👍 4
l
@jw How can I use
@SimpleEnum
in my projects? Does proguard/r8 handle inlining them to int even when there are extension functions/properties for the enum?
j
You cannot. Extensions are static methods so they don't affect the enum.
Just write normal enums. 90% of them will optimize away anyway and you don't have to care.