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?
Some standard methods implicitly convert enum value to integer, as shown in the following code. If the enum is extensible, this generates a warning to the effect " Cast from extensible enum 'Extensible Enumeration (EnumType)' to 'int' potentially harmful and deprecated. " Has anyone encountered this previously? How did you address the warning?
Well, the enumParameter property will anyway use int value, so there is no additional risk in using enum2int vs not using it in this scenario. Makes sense. I was worried since this was an extensible enum.
The size of native libraries is not impacted by the operation either. But ProGuard managed to drastically reduce the code size by a factor of 3, and the package size and download size have been reduced by one-third. Good job! :-) This post provides a practical example of applying Proguard to a real-life application.
-addconfigurationdebugging, a runtime tool used to determine the rules you’ll require in your ProGuard configuration. The new ProGuard Playground online tool, which lets you see the impact of a set of keep rules on the target application. This replaces long build and analyze cycles with immediate visualization.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With