Home | History | Annotate | Download | only in manual

Lines Matching full:code

25 <p class="code">
26 <code><b>java -jar proguard.jar </b></code><i>options</i> ...
28 You can find the ProGuard jar in the <code>lib</code> directory of the
29 ProGuard distribution. Alternatively, the <code>bin</code> directory contains
31 put most options in a configuration file (say, <code>myconfig.pro</code>), and
33 <p class="code">
34 <code><b>java -jar proguard.jar @myconfig.pro</b></code>
38 <p class="code">
39 <code><b>java -jar proguard.jar @myconfig.pro -verbose</b></code>
43 <code><b>#</b></code> character and continuing until the end of the line.
70 <li><a href="#keepoverview">Overview of <code>Keep</code> Options</a></li>
78 <dt><a name="at"><code><b>@</b></code></a><a href="#filename"><i>filename</i></a></dt>
80 <dd>Short for '<a href="#include"><code>-include</code></a>
83 <dt><a name="include"><code><b>-include</b></code></a>
89 <dt><a name="basedirectory"><code><b>-basedirectory</b></code></a>
95 <dt><a name="injars"><code><b>-injars</b></code></a>
106 <code>-injars</code> options.</dd>
108 <dt><a name="outjars"><code><b>-outjars</b></code></a>
112 directories). The processed input of the preceding <code>-injars</code>
122 <code>-outjars</code> options. Without any <code>-outjars</code> options,
125 <dt><a name="libraryjars"><code><b>-libraryjars</b></code></a>
136 entries can be specified using multiple <code>-libraryjars</code> options.
140 explicitly have to specify the run-time jar that your code will use.
147 <dt><a name="skipnonpubliclibraryclasses"><code><b>-skipnonpubliclibraryclasses</b></code></a></dt>
153 code in the input jars. Ignoring them then speeds up ProGuard, without
160 <dt><a name="dontskipnonpubliclibraryclasses"><code><b>-dontskipnonpubliclibraryclasses</b></code></a></dt>
165 <dt><a name="dontskipnonpubliclibraryclassmembers"><code><b>-dontskipnonpubliclibraryclassmembers</b></code></a></dt>
173 to make sure the processed code remains consistent.</dd>
175 <dt><a name="keepdirectories"><code><b>-keepdirectories</b></code></a>
180 jar size, but it may be undesirable if the program code tries to find them
181 with constructs like "<code>MyClass.class.getResource("")</code>". If the
185 <dt><a name="target"><code><b>-target</b></code></a> <i>version</i></dt>
188 version number can be one of <code>1.0</code>, <code>1.1</code>,
189 <code>1.2</code>, <code>1.3</code>, <code>1.4</code>, <code>1.5</code> (or
190 just <code>5</code>), <code>1.6</code> (or just <code>6</code>), or
191 <code>1.7</code> (or just <code>7</code>). By default, the version numbers
196 <dt><a name="forceprocessing"><code><b>-forceprocessing</b></code></a></dt>
208 <dt><a name="keep"><code><b>-keep</b></code></a>
213 as entry points to your code. For example, in order to <a
219 <dt><a name="keepclassmembers"><code><b>-keepclassmembers</b></code></a>
226 methods</a> of classes that implement the <code>Serializable</code>
229 <dt><a name="keepclasseswithmembers"><code><b>-keepclasseswithmembers</b></code></a>
238 <dt><a name="keepnames"><code><b>-keepnames</b></code></a>
241 <dd>Short for <a href="#keep"><code>-keep</code></a>,<a href="#allowshrinking"><code>allowshrinking</code></a>
247 that implement the <code>Serializable</code> interface, so that the
248 processed code remains compatible with any originally serialized classes.
252 <dt><a name="keepclassmembernames"><code><b>-keepclassmembernames</b></code></a>
255 <dd>Short for <a href="#keepclassmembers"><code>-keepclassmembers</code></a>,<a href="#allowshrinking"><code>allowshrinking</code></a>
260 name of the synthetic <code>class$</code> methods
266 <dt><a name="keepclasseswithmembernames"><code><b>-keepclasseswithmembernames</b></code></a>
269 <dd>Short for <a href="#keepclasseswithmembers"><code>-keepclasseswithmembers</code></a>,<a href="#allowshrinking"><code>allowshrinking</code></a>
276 of their classes, so that the processed code can still link with the
277 native library code. Native methods that aren't used at all can still be
281 <dt><a name="printseeds"><code><b>-printseeds</b></code></a>
285 various <code>-keep</code> options. The list is printed to the standard
298 <dt><a name="dontshrink"><code><b>-dontshrink</b></code></a></dt>
302 listed by the various <code>-keep</code> options, and the ones on which
307 <dt><a name="printusage"><code><b>-printusage</b></code></a>
310 <dd>Specifies to list dead code of the input class files. The list is printed
312 href="examples.html#deadcode">list the unused code of an application</a>.
315 <dt><a name="whyareyoukeeping"><code><b>-whyareyoukeeping</b></code></a>
326 href="#verbose"><code>-verbose</code></a> option if specified, the traces
336 <dt><a name="dontoptimize"><code><b>-dontoptimize</b></code></a></dt>
341 <dt><a name="optimizations"><code><b>-optimizations</b></code></a>
348 <dt><a name="optimizationpasses"><code><b>-optimizationpasses</b></code></a> <i>n</i></dt>
355 <dt><a name="assumenosideeffects"><code><b>-assumenosideeffects</b></code></a>
361 used. Note that ProGuard will analyze your program code to find such
362 methods automatically. It will not analyze library code, for which this
364 <code>System.currentTimeMillis()</code>, so that any idle calls to it will
368 code. <i>Only use this option if you know what you're doing!</i></dd>
370 <dt><a name="allowaccessmodification"><code><b>-allowaccessmodification</b></code></a></dt>
381 processed code otherwise. Only applicable when optimizing (and when
383 href="#repackageclasses"><code>-repackageclasses</code></a> option).
386 processing code that is to be used as a library, since classes and class
390 <dt><a name="mergeinterfacesaggressively"><code><b>-mergeinterfacesaggressively</b></code></a></dt>
407 of the processed code on some JVMs, since advanced just-in-time
409 classes. Worse, some JVMs may not be able to handle the resulting code.
412 <li>Sun's JRE 1.3 may throw an <code>InternalError</code> when
423 <dt><a name="dontobfuscate"><code><b>-dontobfuscate</b></code></a></dt>
427 except for the ones listed by the various <code>-keep</code> options.
431 <dt><a name="printmapping"><code><b>-printmapping</b></code></a>
442 <dt><a name="applymapping"><code><b>-applymapping</b></code></a>
452 piece of code. In such cases, you should consider whether you also need
454 href="#useuniqueclassmembernames"><code>-useuniqueclassmembernames</code></a>.
458 <dt><a name="obfuscationdictionary"><code><b>-obfuscationdictionary</b></code></a>
466 comments after a <code><b>#</b></code> sign are ignored. Note that an
471 as 'Code'), thus reducing the class file sizes just a little bit more.
474 <dt><a name="classobfuscationdictionary"><code><b>-classobfuscationdictionary</b></code></a>
480 href="#obfuscationdictionary"><code>-obfuscationdictionary</code></a>.
483 <dt><a name="packageobfuscationdictionary"><code><b>-packageobfuscationdictionary</b></code></a>
489 href="#obfuscationdictionary"><code>-obfuscationdictionary</code></a>.
492 <dt><a name="overloadaggressively"><code><b>-overloadaggressively</b></code></a></dt>
497 make the processed code even smaller (and less comprehensible). Only
517 <li>Sun's JDK 1.2.2 <code>javac</code> compiler produces an exception when
523 <li>Sun's JRE 1.5 <code>pack200</code> tool reportedly has problems with
528 <dt><a name="useuniqueclassmembernames"><code><b>-useuniqueclassmembernames</b></code></a></dt>
534 'b', etc. The option therefore increases the size of the resulting code
543 obfuscation step. The original obfuscated code is changed, in order to
544 keep the resulting code consistent. With this option <i>in the initial
550 modify parts of your code that are essential for later additions.</dd>
552 <dt><a name="dontusemixedcaseclassnames"><code><b>-dontusemixedcaseclassnames</b></code></a></dt>
559 class files overwrite each other. Code that self-destructs when it's
564 <dt><a name="keeppackagenames"><code><b>-keeppackagenames</b></code></a>
572 <dt><a name="flattenpackagehierarchy"><code><b>-flattenpackagehierarchy</b></code></a>
579 names</a>. It can make the processed code smaller and less comprehensible.
582 <dt><a name="repackageclasses"><code><b>-repackageclasses</b></code></a>
589 href="#flattenpackagehierarchy"><code>-flattenpackagehierarchy</code></a>
592 make the processed code even smaller and less comprehensible. Its
593 deprecated name is <code>-defaultpackage</code>. Only applicable when
601 <dt><a name="keepattributes"><code><b>-keepattributes</b></code></a>
605 specified with one or more <code>-keepattributes</code> directives. The
609 <code>Exceptions</code>, <code>Signature</code>, <code>Deprecated</code>,
610 <code>SourceFile</code>, <code>SourceDir</code>,
611 <code>LineNumberTable</code>, <code>LocalVariableTable</code>,
612 <code>LocalVariableTypeTable</code>, <code>Synthetic</code>,
613 <code>EnclosingMethod</code>, <code>RuntimeVisibleAnnotations</code>,
614 <code>RuntimeInvisibleAnnotations</code>,
615 <code>RuntimeVisibleParameterAnnotations</code>,
616 <code>RuntimeInvisibleParameterAnnotations</code>, and
617 <code>AnnotationDefault</code>. The <code>InnerClasses</code> attribute
620 <code>Exceptions</code>, <code>InnerClasses</code>, and
621 <code>Signature</code> attributes
623 also keep the <code>SourceFile</code> and
624 <code>LineNumberTable</code> attributes
627 to <a href="examples.html#annotations">keep annotations</a> if your code
630 <dt><a name="keepparameternames"><code><b>-keepparameternames</b></code></a></dt>
634 <code>LocalVariableTable</code> and
635 <code>LocalVariableTypeTable</code>. It can be useful when
640 <dt><a name="renamesourcefileattribute"><code><b>-renamesourcefileattribute</b></code></a>
643 <dd>Specifies a constant string to be put in the <code>SourceFile</code>
644 attributes (and <code>SourceDir</code> attributes) of the class files.
646 be preserved explicitly using the <code>-keepattributes</code> directive.
651 <dt><a name="adaptclassstrings"><code><b>-adaptclassstrings</b></code></a>
657 classes that match the filter are adapted. For example, if your code
663 <dt><a name="adaptresourcefilenames"><code><b>-adaptresourcefilenames</b></code></a>
673 <dt><a name="adaptresourcefilecontents"><code><b>-adaptresourcefilecontents</b></code></a>
682 by setting the environment variable <code>LANG</code> or the Java system
683 property <code>file.encoding</code>. For an example,
693 <dt><a name="dontpreverify"><code><b>-dontpreverify</b></code></a></dt>
698 you will need to run an external preverifier on the processed code if you
703 <dt><a name="microedition"><code><b>-microedition</b></code></a></dt>
717 <dt><a name="verbose"><code><b>-verbose</b></code></a></dt>
723 <dt><a name="dontnote"><code><b>-dontnote</b></code></a>
731 <dt><a name="dontwarn"><code><b>-dontwarn</b></code></a>
738 class members are indeed required for processing, the processed code will
742 <dt><a name="ignorewarnings"><code><b>-ignorewarnings</b></code></a></dt>
747 class members are indeed required for processing, the processed code will
751 <dt><a name="printconfiguration"><code><b>-printconfiguration</b></code></a>
760 <dt><a name="dump"><code><b>-dump</b></code></a>
840 For example, "<code>rt.jar(java/**.class,javax/**.class)</code>" matches all
841 class files in the <code>java</code> and <code>javax</code> directories inside
842 the <code>rt</code> jar.
844 For example, "<code>input.jar(!**.gif,images/**)</code>" matches all files in
845 the <code>images</code> directory inside the <code>input</code> jar, except
852 "<code>input.war(lib/**.jar,support/**.jar;**.class,**.gif)</code>" only
853 considers jar files in the <code>lib</code> and <code>support</code>
854 directories in the <code>input</code> war, not any other jar files. It then
877 For example, <code>&lt;java.home&gt;/lib/rt.jar</code> will automatically be
878 expanded to something like <code>/usr/local/java/jdk/jre/lib/rt.jar</code>.
879 Similarly, <code>&lt;user.home&gt;</code> will be expanded to the user's home
880 directory, and <code>&lt;user.dir&gt;</code> will be expanded to the current
889 For example, on the command line, you could use an option like <code>'-injars
890 "my program.jar":"/your directory/your program.jar"'</code>.
901 <tr><td valign="top"><code><b>?</b></code></td>
903 <tr><td valign="top"><code><b>*</b></code></td>
906 <tr><td valign="top"><code><b>**</b></code></td>
911 For example, "<code>java/**.class,javax/**.class</code>" matches all
912 class files in the <code>java</code> and <code>javax</code>.
919 For example, "<code>!**.gif,images/**</code>" matches all files in the
920 <code>images</code> directory, except gif files.
937 <tr><td valign="top"><code><b>?</b></code></td>
939 <tr><td valign="top"><code><b>*</b></code></td>
942 <tr><td valign="top"><code><b>**</b></code></td>
947 For example, "<code>foo,*bar</code>" matches the name <code>foo</code> and
948 all names ending with <code>bar</code>.
959 For example, "<code>!foobar,*bar</code>" matches all names ending with
960 <code>bar</code>, except <code>foobar</code>.
963 <h2><a name="keepoverview">Overview of <codecode> Options</a></h2>
965 The various <code>-keep</code> options for shrinking and obfuscation may seem
980 <td bgcolor="#E0E0E0"><a href="#keep"><code>-keep</code></a></td>
981 <td bgcolor="#E0E0E0"><a href="#keepnames"><code>-keepnames</code></a></td>
986 <td bgcolor="#E0E0E0"><a href="#keepclassmembers"><code>-keepclassmembers</code></a></td>
987 <td bgcolor="#E0E0E0"><a href="#keepclassmembernames"><code>-keepclassmembernames</code></a></td>
992 <td bgcolor="#E0E0E0"><a href="#keepclasseswithmembers"><code>-keepclasseswithmembers</code></a></td>
993 <td bgcolor="#E0E0E0"><a href="#keepclasseswithmembernames"><code>-keepclasseswithmembernames</code></a></td>
999 Each of these <code>-keep</code> options is of course followed by a
1004 <code>-keep</code>. It will make sure the specified classes and class members
1017 point &mdash; any associated code may still be optimized and adapted.</li>
1026 <dt><a name="allowshrinking"><code><b>allowshrinking</b></code></a></dt>
1033 <dt><a name="allowoptimization"><code><b>allowoptimization</b></code></a></dt>
1041 <dt><a name="allowobfuscation"><code><b>allowobfuscation</b></code></a></dt>
1055 methods). It is used in the various <code>-keep</code> options and in the
1056 <code>-assumenosideeffects</code> option. The corresponding option is only
1089 <li>The <code><b>class</b></code> keyword refers to any interface or class.
1090 The <code><b>interface</b></code> keyword restricts matches to interface
1091 classes. The <code><b>enum</b></code> keyword restricts matches to
1092 enumeration classes. Preceding the <code><b>interface</b></code> or
1093 <code><b>enum</b></code> keywords by a <code><b>!</b></code> restricts
1098 <code>java.lang.String</code>. Class names may be specified as regular
1103 <tr><td valign="top"><code><b>?</b></code></td>
1106 separator. For example, "<code>mypackage.Test?</code>" matches
1107 "<code>mypackage.Test1</code>" and "<code>mypackage.Test2</code>", but not
1108 "<code>mypackage.Test12</code>".</td></tr>
1110 <tr><td valign="top"><code><b>*</b></code></td>
1113 example, "<code>mypackage.*Test*</code>" matches
1114 "<code>mypackage.Test</code>" and
1115 "<code>mypackage.YourTestApplication</code>", but not
1116 "<code>mypackage.mysubpackage.MyTest</code>". Or, more generally,
1117 "<code>mypackage.*</code>" matches all classes in
1118 "<code>mypackage</code>", but not in its subpackages.</td></tr>
1120 <tr><td valign="top"><code><b>**</b></code></td>
1123 package separators. For example, "<code>**.Test</code>" matches all
1124 <code>Test</code> classes in all packages except the root package. Or,
1125 "<code>mypackage.**</code>" matches all classes in
1126 "<code>mypackage</code>" and in its subpackages.</td></tr>
1131 lists of class names, with optional <code><b>!</b></code> negators, just
1136 <code><b>*</b></code> refers to any class, irrespective of its package.</li>
1138 <li>The <code><b>extends</b></code> and <code><b>implements</b></code>
1145 <li>The <code><b>@</b></code> specifications can be used to restrict classes
1152 like <code>javadoc</code> and <code>javap</code>). The specifications can
1157 <tr><td valign="top"><code><b>&lt;init&gt;</b></code></td>
1160 <tr><td valign="top"><code><b>&lt;fields&gt;</b></code></td>
1163 <tr><td valign="top"><code><b>&lt;methods&gt;</b></code></td>
1166 <tr><td valign="top"><code><b>*</b></code></td>
1172 <code><b>&lt;init&gt;</b></code> wildcard has an argument list.
1179 <tr><td valign="top"><code><b>?</b></code></td>
1181 <tr><td valign="top"><code><b>*</b></code></td>
1188 <tr><td valign="top"><code><b>%</b></code></td>
1189 <td>matches any primitive type ("<code>boolean</code>", "<code>int</code>",
1190 etc, but not "<code>void</code>").</td></tr>
1191 <tr><td valign="top"><code><b>?</b></code></td>
1193 <tr><td valign="top"><code><b>*</b></code></td>
1195 <tr><td valign="top"><code><b>**</b></code></td>
1198 <tr><td valign="top"><code><b>***</b></code></td>
1201 <tr><td valign="top"><code><b>...</b></code></td>
1206 Note that the <code>?</code>, <code>*</code>, and <code>**</code>
1208 <code>***</code> wildcards will match array types of any dimension. For
1209 example, "<code>** get*()</code>" matches "<code>java.lang.Object
1210 getObject()</code>", but not "<code>float getFloat()</code>", nor
1211 "<code>java.lang.Object[] getObjects()</code>".</li>
1220 preceding <code><b>!</b></code> specifies that the corresponding access
1223 Combining multiple flags is allowed (e.g. <code>public static</code>). It
1224 means that both access flags have to be set (e.g. <code>public</code>
1225 <i>and</i> <code>static</code>), except when they are conflicting, in
1227 <code>public</code>
1228 <i>or</i> <code>protected</code>).
1230 ProGuard supports the additional modifiers <code><b>synthetic</b></code>,
1231 <code><b>bridge</b></code>, and <code><b>varargs</b></code>, which may be