-dontoptimize option. For
more fine-grained control over individual optimizations, experts can use the
-optimizations option,
with a filter based on the optimization names listed below. The filter works
like any filter in ProGuard.
The following wildcards are supported:
? |
matches any single character in an optimization name. |
* |
matches any part of an optimization name. |
For example,
"code/simplification/variable,code/simplification/arithmetic"
only performs the two specified peephole optimizations.
For example, "!method/propagation/*" performs all optimizations,
except the ones that propagate values between methods.
For example,
"!code/simplification/advanced,code/simplification/*" only
performs all peephole optimizations.
Some optimizations necessarily imply other optimizations. These are then indicated. Note that the list is likely to change over time, as optimizations are added and reorganized.
class/marking/finalclass/unboxing/enumclass/merging/verticalclass/merging/horizontalcode/removal/advanced)field/removal/writeonlyfield/marking/privatecode/simplification/advanced)field/propagation/valuemethod/marking/privatecode/removal/advanced)method/marking/staticmethod/marking/finalcode/removal/advanced)method/removal/parametercode/simplification/advanced)method/propagation/parametercode/simplification/advanced)method/propagation/returnvaluemethod/inlining/shortmethod/inlining/uniquemethod/inlining/tailrecursioncode/mergingcode/simplification/variablecode/simplification/arithmeticcode/simplification/castcode/simplification/fieldcode/removal/simple)code/simplification/branchcode/simplification/stringcode/removal/advanced)code/simplification/advancedcode/removal/exception)code/removal/advancedcode/removal/exception)code/removal/simplecode/removal/variablecode/removal/exceptioncode/allocation/variable
ProGuard also provides some unofficial settings to control optimizations, that
may disappear in future versions. These are Java system properties, which
can be set as JVM arguments (with -D.....):
maximum.inlined.code.length (default = 8 bytes)maximum.resulting.code.length (default = 8000 bytes
for JSE, 2000 bytes for JME)optimize.conservatively (default = unset)NullPointerException,
ArrayIndexOutOfBoundsException, or
ClassCastException, without any other useful purposes. By
default, ProGuard may just discard such seemingly useless instructions,
resulting in better optimization of most common code.