PreEmptive Protection™ DashO™ Optimization speeds up your code and reduces the size of the resulting binary. It performs algebraic identity, strength reduction, and other peephole optimizations. Optimization also controls when DashO makes classes, non-private methods, and non-private fields public.
This article explains how Optimization works. To configure it, see Configuring Optimization.
Bytecode Optimization
You enable or disable Bytecode Optimization globally. Use include and exclude rules to choose which methods, classes, or packages DashO optimizes. For more information, see Choose Which Code to Optimize.
Make Public
Renaming can move classes into new packages. If those classes use protected or package-private access, they may lose access to classes and members that stay in their original package. Make Public solves this by changing the access of classes and non-private members to public.
Make Public doesn't generally change the behavior of your classes. The compiler checks access restrictions at compile time, which generally prevents illegal access.
It may also improve performance. Dynamic linking of public methods should be faster than linking of more restricted methods, because the runtime doesn't need to verify package or class membership.
Choose when DashO makes classes and members public:
| Option | Behavior | Project file equivalent |
| Automatic (default) | DashO makes classes and members public when it appears necessary to preserve access between renamed classes. | — |
| Never | DashO never makes classes or members public. | nomakepublic |
| Always | DashO always makes non-private classes and members public. | makepublic |
Examples and Use Cases
A Renamed Class Loses Package Access
Consider two classes in the same package:
-
com.example.pack.Foois an entry point, so DashO doesn't rename it. -
com.example.pack.Baris renamed tocom.example.a.
The classes are now in different packages, so package-private members of one are no longer accessible to the other. With Make Public set to Automatic, DashO makes the affected classes and members public to preserve access.
Limitations and Troubleshooting
| Limitation or issue | Details |
| Optimization settings have no effect. | Your project uses Android Mode, where DashO ignores them. Configure R8 instead. |
| Access exceptions occur at runtime after protection. | Make Public may be set to Never. Set it to Automatic. |