-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/final
class/unboxing/enum
class/merging/vertical
class/merging/horizontal
code/removal/advanced
)field/removal/writeonly
field/marking/private
code/simplification/advanced
)field/propagation/value
method/marking/private
code/removal/advanced
)method/marking/static
method/marking/final
code/removal/advanced
)method/removal/parameter
code/simplification/advanced
)method/propagation/parameter
code/simplification/advanced
)method/propagation/returnvalue
method/inlining/short
method/inlining/unique
method/inlining/tailrecursion
code/merging
code/simplification/variable
code/simplification/arithmetic
code/simplification/cast
code/simplification/field
code/removal/simple
)code/simplification/branch
code/simplification/string
code/removal/advanced
)code/simplification/advanced
code/removal/exception
)code/removal/advanced
code/removal/exception
)code/removal/simple
code/removal/variable
code/removal/exception
code/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.