Search code examples
javaandroidkotlinenumsproguard

Does proguard converts all enums to int or needs to be configured for this


Does proguard automatically converts enums to integer for memory optimization or I have to configure it to do this? If I do have to configure what is the configuration?


Solution

  • The optimization is listed on ProGuard's optimizations page. It appears to be one of the default optimizations, but it (like other optimizations) can be specified explicitly if you need more control (e.g. disabling all class/* optimizations aside from enum unboxing).

    class/unboxing/enum

    Simplifies enum types to integer constants, whenever possible.