Default Script - RetroGuard Documentation


Prev   Contents   Next

RetroGuard reverts to an internal default if no script file is provided to RetroGuard and no file called 'script.rgs' exists. This internal default is exactly equivalent to the script:

.option Application
.option Applet
.option Serializable
.option RMI
.option RuntimeAnnotations
.option MapClassString
[RetroGuard-v2.1.x and later]
.option Trim
[RetroGuard-v2.2.x only]
.option Repackage
.option Generic

As you might guess, this default script attempts to preserve all applications, applets, serializable classes, and RMI remote classes from obfuscation, keeps run-time accessible annotations, automatically remaps simple class-name strings in ClassName.class and Class.forName("ClassName"), trims unused methods and classes, safely repackages obfuscated classes to reduce class size, and preserves type signature information used with generics.

We'll see later that many of these '.option' commands are equivalent to groups of '.class', '.method', '.field', and '.attribute' commands.

This internal script provides a safe set of defaults to begin working with RetroGuard. However, this default may preserve an unnecessary number of class, method, and field identifiers from being obfuscated. For example, if you have a Java application that doesn't use serialization or RMI and you don't have any need for annotations to be preserved, it may be better to provide a script file of the form:

.option Application
.option MapClassString
[RetroGuard-v2.1.x and later]
.option Trim
[RetroGuard-v2.2.x only]
.option Repackage

Some additional internal defaults are always applied, even when a separate script file is given. RetroGuard automatically preserves native methods and the classes where they appear. This is equivalent to the script line:

.method;native ** * and_class

Also, RetroGuard always preserves the auto-generated static methods values() and valueOf(...) in JDK5 enumerations. This is equivalent to the script lines:

.method;public;static;final **/values * extends java/lang/Enum
.method;public;static **/valueOf * extends java/lang/Enum

Prev   Contents   Next
 Copyright © 1998-2007 Retrologic Systems.
 All rights reserved.